Relative Content

Tag Archive for regressionmixed-modelsconfidence-interval

How can I plot a linear mixed model in R with a regression line and confidence interval that match the data?

I am trying to plot this model: m1 <- lmer(tarsus.yc ~ BMR + MMR + Msum + (1|box), data = p2).
I want one plot per predictor and use the parameter estimates from the full model for the regression line. So, first I mean-centered the predictors that I do not want in the plot.
Then, when I use the estimates from the summary table, my regression line does not match my data.
For the confidence interval, I tried to use the predict function but it is not a smooth polygon and that is not what I am trying to do.
Maybe I am not doing it correctly or my code is wrong.