Hi Statlist,
I am struggling into constructing the residuals' specific variance for the following model:
What I would like to do is to generate a variable consisting of the variance of regression residuals so that each residual has its own variance (not gen var = e(sigma_e) which generates a unique value). So, if we call the residuals AVit (resulting from AVit = y - yhat where yhat = predict yhat, xbu) , I would like to obtain Var(AVit ). Afterwords my aim is to compute the average over Nt , where Nt is the number of units with available data in t of such variances. Something like:
Sum for i ranging from 1 to Nt of Var(AVit ) over (Nt )2
Is it possible in STATA to do compute the variance of such residuals?
I am struggling into constructing the residuals' specific variance for the following model:
Code:
xtreg tasso_crescita_sales_prod L.log_sales L.dummy_2 L2.dummy_2 L3.dummy_2 mean_gr_rate_atc2 recalls_sales ageprodcat1 ageprodcat2 ageprodcat3 ageprodcat4 newmolfirm newmolmarket i.Year, fe vce(cluster idpr)
Sum for i ranging from 1 to Nt of Var(AVit ) over (Nt )2
Is it possible in STATA to do compute the variance of such residuals?
Comment