powerlmm
powerlmm copied to clipboard
Allow crossed designs
Cluster can be crossed with treatments, e.g. therapists that deliver two interventions. These models are currently not supported by powerlmm.
I'm a bit unsure how to best specify standardized parameters, in a way that's not completely unintuitive.
The lmer model would be
lmer(y ~ time*treatment + (1 + time | subject) + (1 + time + treatment + time:treatment | cluster))
For the raw parameters we have
crossed <- study_design(nested = FALSE)
p <- study_parameters(design = crossed,
n1 = 3,
n2 = 500,
n3 = 100,
T_end = 2,
fixed_intercept = 4,
fixed_tx = 0,
fixed_slope = -1,
sigma_subject_intercept = 0,
sigma_subject_slope = 0,
sigma_cluster_intercept = 10, # cc intercept
sigma_cluster_slope = 2, # time
sigma_cluster_intercept_x = 20, # treatment
sigma_cluster_slope_x = 1, # time:treatment
cor_cluster_intercept_slope = 0, # cor among 3-lvl RE effects
cor_cluster_intercept_intercept_x = 0,
cor_cluster_intercept_slope_x = 0,
cor_cluster_slope_intercept_x = 0.5,
cor_cluster_slope_slope_x = 0.5,
cor_cluster_intercept_x_slope_x = 0.5,
sigma_error = 10,
cor_subject = 0,
effect_size = -1
)
However, most of the variance components have no impact on the variance of the fixed time:treatment interaction. Extending the syntax I used for nested 3-lvl models would give something like
p <- study_parameters(design = crossed,
n1 = 11,
n2 = 10,
n3 = 4,
var_ratio = 0.03,
icc_pre_subject = 0.5,
icc_pre_cluster = 0.1,
icc_pre_cluster_x = 0.25,
icc_slope = 0.05,
icc_slope_x = 0.25,
sigma_error = 10,
cor_cluster_* = ..., # as above
cor_subject = 0,
effect_size = 0.5
)
Here icc_slope
is the proportion of slope variance at the cluster-level, whereas icc_slope_x
is the proportion of the cluster-level random slopes
u1 <- object$sigma_subject_slope
v2 <- object$sigma_cluster_slope
v3 <- object$sigma_cluster_slope_x
# ICC_slope_x
v3^2/(v2^2 + v3^2)
# ICC_slope
(v2^2 + v3^2)/(u1^2 + v2^2 + v3^2)
The problem with this approach is that it's not an ICC and it's not the actual amount of slope variance - as that depends on the covariance between some of the RE effects.
For a balanced design, the variance of the fixed time:treatment interaction depend on sigma_cluster_slope_x
and not on sigma_cluster_slope
Any input on this issue is welcome!