1

I have fitted the following mixed model in r, using lme4

model<-FMI~MVPAper + Age + (1|Child_ID)

And I was wondering if someone can help me code for ggplot to examine the differences at each age? (8,9,12,15). I will print the summary command from the mixed model below,

> summary(mixedmodel)
Linear mixed model fit by REML ['lmerMod']
Formula: (FMI) ~ MVPAper + Age + (1 | Child_ID)

REML criterion at convergence: 34444.6

Scaled residuals: 
  Min     1Q Median     3Q    Max 
-1.216 -0.123 -0.093  0.061 51.872 

Random effects:
Groups   Name        Variance Std.Dev.
Child_ID (Intercept)   6.459   2.541  
Residual             283.758  16.845  
Number of obs: 4048, groups:  Child_ID, 1023

Fixed effects:
          Estimate Std. Error t value
(Intercept)  2.1850969  0.5697864   3.835
MVPAper      0.0028865  0.0007984   3.615
Age9         0.0908241  0.7482005   0.121
Age12       -0.3519625  0.7478261  -0.471
Age15       -0.4881878  0.7499429  -0.651

Correlation of Fixed Effects:
    (Intr) MVPApr Age9   Age12 
MVPAper -0.350                     
Age9    -0.639 -0.040              
Age12   -0.652 -0.004  0.498       
Age15   -0.671  0.056  0.494  0.496

Any help is greatly appreciated, cheers.

  • 1
    I'm not clear on what you're asking. Please make your [example reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including sample data? What do you want to plot? Perhaps show a mock-up of your expected output plot. – Maurits Evers Jul 27 '18 at 13:26
  • I'm trying to produce a plot with four different slopes (one for each age) with the response variable being the FMI and the explanatory variable being the MVPAper. I have looked at some coding online, but it just doesn't seem to be running. Is that any help ? – Oliver Mitchell Jul 27 '18 at 13:33
  • You don't have 4 slopes. You have 4 intercepts. For age8 it is 2.1850969, for age9 it is 2.1850969+0.0908241, age 12 2.1850969--0.3519625 and age15 2.1850969-0.4881878. Perhaps you can see in your code that age was defined as a factor. – papgeo Jul 27 '18 at 15:23
  • Yes, apologies that's what I meant. I'm just having troubles plotting it. – Oliver Mitchell Jul 27 '18 at 17:53

0 Answers0