Given a specific total number of observations and variance-covariance structure for random effect, the function simulates different association of number of group and replicates, giving the specified sample size, and assess p-values and power of random intercept and random slope
SSF(
numsim,
tss,
nbstep = 10,
randompart,
fixed = c(0, 1, 0),
n.X = NA,
autocorr.X = 0,
X.dist = "gaussian",
intercept = 0,
exgr = NA,
exrepl = NA,
heteroscedasticity = c("null")
)data frame reporting estimated P-values and power with CI for random intercept and random slope
number of simulation for each step
total sample size, nb group * nb replicates
number of group*replicates associations to simulate
vector of lenght 4 or 5 with 1: variance component
of intercept, VI; 2: variance component of slope, VS; 3: residual
variance, VR; 4: relation between random intercept and random
slope; 5: "cor" or "cov" determine id the relation between I ans S is
correlation or covariance, set to "cor" by default
vector of lenght 3 with mean, variance and estimate of fixed effect to simulate
number of different values to simulate for the fixed effect (covariate).
If NA, all values of X are independent between groups. If the value specified
is equivalent to the number of replicates per group, repl, then all groups
are observed for the same values of the covariate. Default: NA
correlation between two successive covariate value for a group. Default: 0
specify the distribution of the fixed effect. Only "gaussian" (normal distribution) and
"unif" (uniform distribution) are accepted actually. Default: "gaussian"
a numeric value giving the expected intercept value. Default:0
a vector specifying minimum and maximum value for number of group.
Default:c(2,tss/2)
a vector specifying minimum and maximum value for number
of replicates. Default:c(2,tss/2)
a vector specifying heterogeneity in residual variance
across X. If c("null") residual variance is homogeneous across X. If
c("power",t1,t2) models heterogeneity with a constant plus power variance
function. Letting \(v\) denote the variance covariate and \(\sigma^2(v)s2(v)\)
denote the variance function evaluated at \(v\), the constant plus power
variance function is defined as \(\sigma^2(v) = (\theta_1 + |v|^{\theta_2})^2s2(v) = (t1 + |v|^t2)^2\),
where \(\theta_1,\theta_2t1, t2\) are the variance function coefficients.
If c("exp",t),models heterogeneity with an
exponential variance function. Letting \(v\) denote the variance covariate and \(\sigma^2(v)s2(v)\)
denote the variance function evaluated at \(v\), the exponential
variance function is defined as \(\sigma^2(v) = e^{2 * \theta * v}s2(v) = exp(2* t * v)\), where \(\theta\) is the variance
function coefficient.
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
PAMM(), EAMM() for other simulation functions plot.SSF() for plotting
if (FALSE) {
oursSSF <- SSF(10, 100, 10, c(0.4, 0.1, 0.6, 0))
plot(oursSSF)
}
Run the code above in your browser using DataLab