Dear Stata Users
I have a question how to compute confidence intervals of the prediction from the three-level model which takes into account the fixed as well as the random effects.
My model is as follows:
xtmixed y year1 year2 year3 x1 x2 x3 || country: year_spline, cov(unstructured) || region: year_spline, covariance (unstructured), mle
where y is a continuous variable.
I figured out that I can predict y using the command:
predict y_hat, fitted
I also managed to figure out from the posts that I would get the standard errors of the y_hat by using the following code if I assumed cov(independent):
predict se_fixed, stdp
predict se_random*, reses
des se_random*
scalar sd_res=exp([lnsig_e]_cons)
g se_y_hat=sqrt(se_fixed^2+(se_random1*year_spline)^ 2+se_random2^2+(se_random3*year_spline)^2+se_rando m4^2+sd_res^2)
But I used cov(unstructured), do I need to add covariances to the compuatation of the standard errors of y_hat? how?
Thanks a lot!
Anna
I have a question how to compute confidence intervals of the prediction from the three-level model which takes into account the fixed as well as the random effects.
My model is as follows:
xtmixed y year1 year2 year3 x1 x2 x3 || country: year_spline, cov(unstructured) || region: year_spline, covariance (unstructured), mle
where y is a continuous variable.
I figured out that I can predict y using the command:
predict y_hat, fitted
I also managed to figure out from the posts that I would get the standard errors of the y_hat by using the following code if I assumed cov(independent):
predict se_fixed, stdp
predict se_random*, reses
des se_random*
scalar sd_res=exp([lnsig_e]_cons)
g se_y_hat=sqrt(se_fixed^2+(se_random1*year_spline)^ 2+se_random2^2+(se_random3*year_spline)^2+se_rando m4^2+sd_res^2)
But I used cov(unstructured), do I need to add covariances to the compuatation of the standard errors of y_hat? how?
Thanks a lot!
Anna