Dear all
I'm using this code for a model with fixed and random effects:
Proc mixed data=ds_input;
class id m_time;
model y=x1 x2 x3 /solution
outp=data1 outpm=data2;
repeated m_time / type=ar(1) subject=id;
run;
I would like to calculate the predicted value : y=XB+ZU.
I thought that this was calculate with the option outp=data1 but I ve the same predicted values in data1 & data2 files.
How should I do to calculate the predicted value manually? No problem for the fixed effect but what about the random effect.
I' ve this output
Stime dei parametri di covarianza | ||
Param cov | Soggetto | Stima |
AR(1) | hosp | x.xxxx |
Residual | x.xxxx |
Thank for any help
I’m assuming here that x1, x2 and x3 are measured on each subject=id at each level of m_time.
Using the statement
random intercept / subject=id;
produces a regression of y on x1, x2 and x3 for each subject where the slopes for x1, x2, and x3 are constant (the same) for all subjects, and the intercepts vary among subjects. In the example I experimented with, including or omitting noint on the model statement makes little difference in the estimated regression coefficients—the results vary, but not by much. Notably, intercepts still vary among subjects.
Why do you want to use the noint option? If you are just trying to get the regression coefficient estimates for each subject, you could compute them by hand or, better yet, use the code from Section 8.2 in Littell, RC et al., 2006, SAS for Mixed Models, 2nd ed, Cary, NC: SAS Institute Inc:
proc mixed data=wheat covtest cl scoring=8;
class variety;
model yield = moist / solution;
random int moist / type=un sub=variety solution G Gcorr;
ods output solutionf=fixed solutionr=random;
run;
data lines;
merge random(where=(effect='Intercept') rename=(estimate=rint))
random(where=(effect='moist' ) rename=(estimate=rslope));
if _n_ = 1 then merge
fixed(where=(effect='Intercept') rename=(estimate=fint))
fixed(where=(effect='moist' ) rename=(estimate=fslope));
intercept = fint + rint;
slope = fslope + rslope;
keep variety fint fslope rint rslope intercept slope;
run;
proc print data=lines;
var variety fint rint intercept fslope rslope slope;
run;
This example specifies a random intercepts and random slopes model, but you could modify the code for only random intercepts.
HTH,
Susan
In the MIXED procedure, the repeated statement specifies the structure of the covariance matrix R for the residuals; the random statement controls the structure of the design matrix Z and specifies the structure for the covariance matrix G. Your model syntax has no random statement; hence there is no Z matrix, there are no G-side covariance parameters, and the marginal predictions are equal to the conditional predictions.
If you thought it appropriate, you could consider an AR(1)+RE covariance structure, specified as
random intercept / subject=id;
repeated m_time / type=ar(1) subject=id;
where the random statement now generates a Z matrix. See
Littell, RC et al. (2000) Modelling covariance structure in the analysis of repeated measures data. Statistics in Medicine 19:1793-1819
for more information about the AR(1)+RE structure, including interpretation.
HTH,
Susan
I'm back to you again..
I run the model belove as suggest:
Proc mixed data=ds_input;
class id m_time;
model y=x1 x2 x3 /solution;
random intercept / subject=id;
repeated m_time / type=ar(1) subject=id;
I would like to run the same model without intercept (option noint in the model statement). Is it possible? What about random statement?
Thanks for any help
Kind Regards
I’m assuming here that x1, x2 and x3 are measured on each subject=id at each level of m_time.
Using the statement
random intercept / subject=id;
produces a regression of y on x1, x2 and x3 for each subject where the slopes for x1, x2, and x3 are constant (the same) for all subjects, and the intercepts vary among subjects. In the example I experimented with, including or omitting noint on the model statement makes little difference in the estimated regression coefficients—the results vary, but not by much. Notably, intercepts still vary among subjects.
Why do you want to use the noint option? If you are just trying to get the regression coefficient estimates for each subject, you could compute them by hand or, better yet, use the code from Section 8.2 in Littell, RC et al., 2006, SAS for Mixed Models, 2nd ed, Cary, NC: SAS Institute Inc:
proc mixed data=wheat covtest cl scoring=8;
class variety;
model yield = moist / solution;
random int moist / type=un sub=variety solution G Gcorr;
ods output solutionf=fixed solutionr=random;
run;
data lines;
merge random(where=(effect='Intercept') rename=(estimate=rint))
random(where=(effect='moist' ) rename=(estimate=rslope));
if _n_ = 1 then merge
fixed(where=(effect='Intercept') rename=(estimate=fint))
fixed(where=(effect='moist' ) rename=(estimate=fslope));
intercept = fint + rint;
slope = fslope + rslope;
keep variety fint fslope rint rslope intercept slope;
run;
proc print data=lines;
var variety fint rint intercept fslope rslope slope;
run;
This example specifies a random intercepts and random slopes model, but you could modify the code for only random intercepts.
HTH,
Susan
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.