The estimate in linear mixed model SAS code.

Hi guys, how can i get the equivalent of the estimate code used in proc mixed in SAS linear mixed-method models in R.

The estimate statement is used to show the expected change in the dependent variable given a value of the independent variable. This is what it looks like in SAS.

PROC MIXED DATA=exerclong;
CLASS id group(ref='2')/ref=first;
MODEL y = group day group*day/solution;
random intercept/subject=ID;

  • We use the estimate statement to get predictions based on fixed covariate values;
    estimate 'Weight group: day 6 change in strength intercept 0 group 0 0 day 6 group*day 0 6;

My R code is something like this.

model1= lmer(y ~ factor(group) + Day + factor(group):Day + (1 |id), data = exerclong)

I have tried the predict and fit contrast function but looks like they are not appropriate to predict the value of y at a particular day, say day 6.

Can someone help with this?

There isn't a reproducible example provided, so our help maybe limited, but the lmer cheat sheet is always a good start for checking syntax for Mixed Effects models: mixed model - R's lmer cheat sheet - Cross Validated

This is also a good resource as it seems you are using a nested model:

Outside of that, I would recommend fitting a very basic Mixed effects model first to see if your code works for predicting before introducing additional terms.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.