Description Usage Arguments Details Value Warning Author(s) References See Also Examples

Given a specific sample size, fixed number of group and replicates per group, the function simulate different variance-covariance structure and assess p-values and power of random intercept and random slope

1 2 3 |

`numsim` |
number of simulation for each step |

`group` |
number of group |

`repl` |
number of replicates per group |

`fixed` |
vector of lenght 3 with mean, variance and estimate of
fixed effect to simulate. Default: |

`VI` |
variance component of intercept. Could be specified as a
vector. Default: |

`VS` |
variance component of slope. Could be specified as a vector.
Default: |

`CoIS` |
value of correlation or covariance between random intercept and random slope. Default: 0 |

`relIS` |
"cor" or "cov" set the type of relation give in CoIS. By default the relation is set to correlation |

`n.X` |
number of different values to simulate for the fixed effect (covariate).
If |

`autocorr.X` |
correlation between two successive covariate value for a group. Default: |

`X.dist` |
specify the distribution of the fixed effect. Only "gaussian" (normal distribution) and
"unif" (uniform distribution) are accepted actually. Default: |

`intercept` |
a numeric value giving the expected intercept value. Default: 0 |

`heteroscedasticity` |
a vector specifying heterogeneity in residual
variance across X. If |

`mer.sim` |
Use the simluate.merMod function to simulate the data. Potentially faster for large dataset but more restricted in terms of options |

`mer.model` |
Simulate the data based on a existing data and model structure from a lmer object. Should be specified as a list of 3 components: a mer object fitted via lmer, an environmental covariate for which to test the random slope, a random effect (e.g. |

P-values for random effects are estimated using a log-likelihood ratio test between two models with and without the effect. Power represent the percentage of simulations providing a significant p-value for a given random structure. Residual variance, e, is calculted as 1-VI.

data frame reporting estimated P-values and power with CI for random intercept and random slope

the simulation is based on a balanced data set with unrelated group

Julien Martin

Martin, Nussey, Wilson and Reale Submitted Measuring between-individual variation in reaction norms in field and experimental studies: a power analysis of random regression models. Methods in Ecology and Evolution.

1 2 3 4 5 6 7 8 9 10 11 | ```
## Not run:
ours <- EAMM(numsim=10,group=10,repl=4,fixed=c(0,1,1),VI=seq(0.1,0.3,0.05),
VS=seq(0.05,0.2,0.05) )
plot(ours, "both")
(fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
ours2 <- EAMM(numsim=10, mer.model=list(model=fm1,env="Days",random="Subject"),
VI=seq(0.3,0.5,0.1), VS=seq(0.05,0.2,0.05) )
plot(ours2, "both")
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.