Description Usage Arguments Details See Also
Takes simulation conditions as input, exports power.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  sim_pow_glm_nested(
fixed,
random,
fixed_param,
random_param = list(),
cov_param,
n,
p,
data_str,
cor_vars = NULL,
fact_vars = list(NULL),
unbal = list(level2 = FALSE, level3 = FALSE),
unbal_design = list(level2 = NULL, level3 = NULL),
contrasts = NULL,
outcome_type,
cross_class_params = NULL,
knot_args = list(NULL),
missing = FALSE,
missing_args = list(NULL),
pow_param = NULL,
alpha,
pow_dist = c("z", "t"),
pow_tail = c(1, 2),
lme4_fit_mod = NULL,
lme4_fit_family,
general_mod = NULL,
general_extract = NULL,
...
)

fixed 
One sided formula for fixed effects in the simulation. To suppress intercept add 1 to formula. 
random 
One sided formula for random effects in the simulation. Must be a subset of fixed. 
fixed_param 
Fixed effect parameter values (i.e. beta weights). Must be same length as fixed. 
random_param 
A list of named elements that must contain:
Optional elements are:

cov_param 
List of arguments to pass to the continuous generating function, must be the same order as the variables specified in fixed. This list does not include intercept, time, factors, or interactions. Required arguments include:
Optional arguments to the distribution functions are in a nested list, see the examples or vignettes for example code. 
n 
Cluster sample size. 
p 
Within cluster sample size. 
data_str 
Type of data. Must be "cross", "long", or "single". 
cor_vars 
A vector of correlations between variables. 
fact_vars 
A nested list of factor, categorical, or ordinal variable specification, each list must include:
Optional arguments include:
See also 
unbal 
A named TRUE/FALSE list specifying whether unbalanced simulation design is desired. The named elements must be: "level2" or "level3" representing unbalanced simulation for level two and three respectively. Default is FALSE, indicating balanced sample sizes at both levels. 
unbal_design 
When unbal = TRUE, this specifies the design for unbalanced simulation in one of two ways. It can represent the minimum and maximum sample size within a cluster via a named list. This will be drawn from a random uniform distribution with min and max specified. Secondly, the actual sample sizes within each cluster can be specified. This takes the form of a vector that must have the same length as the level two or three sample size. These are specified as a named list in which level two sample size is controlled via "level2" and level three sample size is controlled via "level3". 
contrasts 
An optional list that specifies the contrasts to be used
for factor variables (i.e. those variables with .f or .c).
See 
outcome_type 
A vector specifying the type of outcome, must be either logistic or poisson. Logitstic outcome will be 0/1 and poisson outcome will be counts. 
cross_class_params 
A list of named parameters when cross classified data structures are desired. Must include the following arguments:

knot_args 
A nested list of named knot arguments. See

missing 
TRUE/FALSE flag indicating whether missing data should be simulated. 
missing_args 
Additional missing arguments to pass to the missing_data
function. See 
pow_param 
Name of variable to calculate power for, must be a name from fixed. 
alpha 
What should the per test alpha rate be used for the hypothesis testing. 
pow_dist 
Which distribution should be used when testing hypothesis test, z or t? 
pow_tail 
Onetailed or twotailed test? 
lme4_fit_mod 
Valid lme4 formula syntax to be used for model fitting. 
lme4_fit_family 
Valid lme4 family specification passed to glmer. 
general_mod 
Valid model syntax. This syntax can be from any R package. By default, broom is used to extract model result information. Note, package must be defined or loaded prior to running the sim_pow function. 
general_extract 
A valid function to extract model results if general_mod argument is used. This argument is primarily used if extracting model results is not possibly using the broom package. If this is left NULL (default), broom is used to collect model results. 
... 
Not currently used. 
Power function to compute power for a regression term for the generalized
linear mixed model. This function would need to be replicated to make any
statement about power. Use sim_pow_glm
as a convenient wrapper
for this.
sim_pow_glm
for a wrapper to replicate.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.