pwr_func_lmer {mmiCATs} | R Documentation |
Power Analysis for Clustered Data
Description
Conducts a power analysis for clustered data using simulation. This function allows for comparing the performance of different estimation methods in terms of power, rejection rate, root mean square error (RMSE), relative RMSE, coverage probability, and average confidence interval width.
Usage
pwr_func_lmer(
betas = list(int = 0, x1 = -5, x2 = 2, x3 = 10),
dists = list(x1 = stats::rnorm, x2 = stats::rbinom, x3 = stats::rnorm),
distpar = list(x1 = list(mean = 0, sd = 1), x2 = list(size = 1, prob = 0.4), x3 =
list(mean = 1, sd = 2)),
N = 25,
reps = 1000,
alpha = 0.05,
var_intr = "x1",
grp = "ID",
mod = paste0("out ~ x1 + x2 + x3 + (1|", grp, ")"),
catsmod = "out ~ x1 + x2 + x3",
r_slope = "x1",
r_int = "int",
n_time = 20,
mean_i = 0,
var_i = 1,
mean_s = 0,
var_s = 1,
cov_is = 0,
mean_r = 0,
var_r = 1,
cor_mat = NULL,
corvars = NULL
)
Arguments
betas |
Named list of true coefficient values for the fixed effects. |
dists |
Named list of functions to generate random distributions for each predictor. |
distpar |
Named list of parameter lists for each distribution function in
|
N |
Integer specifying the number of groups. |
reps |
Integer specifying the number of replications for the simulation. |
alpha |
Numeric value specifying the significance level for hypothesis testing. |
var_intr |
Name of the variable of interest (for power calculations) as a string. |
grp |
Name of the grouping variable as a string. |
mod |
Formula for the mixed-effects model. |
catsmod |
Formula for the CATs model. |
r_slope |
Name of the random slope variable as a string. |
r_int |
Name of the random intercept as a string. |
n_time |
Integer specifying the number of time points per group. |
mean_i |
Mean for the random intercept. |
var_i |
Variance for the random intercept. |
mean_s |
Mean for the random slope. |
var_s |
Variance for the random slope. |
cov_is |
Covariance between the random intercept and slope. |
mean_r |
Mean for the residual error. |
var_r |
Variance for the residual error. |
cor_mat |
Correlation matrix for correlated predictors, if any. |
corvars |
List of vectors, each vector containing names of correlated variables. |
Value
A dataframe summarizing the results of the power analysis, including average coefficient estimate, rejection rate, root mean square error, relative root mean square error, coverage probability, and average confidence interval width for each method.
Examples
pwr_func_lmer(reps = 2)