Hi,
I'm using Stata 12 and I've a problem with a graphics of a linear regression with mixed effects. Tempomesi is a continuous variable while trattato is binary.
When I graph this regression with this command:
but red line is wrong. Why?
I'm using Stata 12 and I've a problem with a graphics of a linear regression with mixed effects. Tempomesi is a continuous variable while trattato is binary.
Code:
. xtmixed ild c.tempomesi##i.trattato || pid:, mle nolog variance Mixed-effects ML regression Number of obs = 143 Group variable: pid Number of groups = 61 Obs per group: min = 2 avg = 2.3 max = 6 Wald chi2(3) = 28.76 Log likelihood = -550.1897 Prob > chi2 = 0.0000 -------------------------------------------------------------------------------------- ild | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------------------+---------------------------------------------------------------- tempomesi | .3300396 .0657651 5.02 0.000 .2011423 .4589369 1.trattato | -3.826831 4.163937 -0.92 0.358 -11.988 4.334336 | trattato#c.tempomesi | 1 | -.2629648 .1021319 -2.57 0.010 -.4631397 -.0627899 | _cons | 20.78178 3.101511 6.70 0.000 14.70293 26.86063 -------------------------------------------------------------------------------------- ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ pid: Identity | var(_cons) | 226.6245 44.9081 153.6852 334.181 -----------------------------+------------------------------------------------ var(Residual) | 43.09052 6.757185 31.6885 58.59517 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 96.58 Prob >= chibar2 = 0.0000
Code:
twoway (lfit ild tempomesi if trattato==0) (lfit ild tempomesi if trattato==1)
Comment