pwrMultimodels: Simulate simultaneous power for multiple tests in separate...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/pwrMultimodels.R

Description

Simulate power to simultaneously detect predicted effects for a set of statistical tests in separate bivariate models. This function simulates data based on a correlation matrix imposed using the mvrnorm function from the MASS package (Venables & Ripley, 2002) and can be used to estimate power for up to 10 bivariate models with single independent variables and single dependent variables. A detailed walkthrough and set of vignettes for this and other SimulPower functions is available here.

Usage

1
2
3
4
5
pwrMultimodels(n = NULL, es_units = NULL,
es1 = NULL, es2 = NULL, es3...es10 = 0,
null_effect = 0, iterations = 5000,
alpha = .05, bonferroni = FALSE, seed = 1,
iv1iv2_cov...iv9iv10_cov = 0)

Arguments

n

Set the size of each sample to be drawn from the population. This is the sample size for which you are estimating statistical power. In other words, setting n to equal 100 will estimate statistical power at n = 100. Accepts any positive number. This argument has no default.

es_units

Set the units in which you are specifying your effect sizes. Accepts "d" for Cohen's d, "r" for correlation coefficients, and "r2" for percent of variance accounted for. This argument has no default.

null_effect

For which, if any, of your models are you computing "null power?" If you want to compute "power" to NOT detect an effect, use this argument to specify which models are predicted nulls by setting this argument equal to the number(s) corresponding to the models you hypothesize to be null. Accepts either a single whole number between 1 and the number of models you have specified or a vector of numbers between 1 and the the number of models you have specified. Default = no null effects.

iterations

How many times you would like to run your models in random samples drawn from your population? One model will be run in each random sample. Accepts any whole number greater than 0. Default = 5000.

alpha

Set your alpha level. This is the threshold below which p-values will be considered significant. Accepts any number greater than 0 and less than 1. Default = 0.05.

bonferroni

Apply a bonferroni correction? This is suggested if you intend on interpreting the results of multiple tests individually, but not if you intend on assessing a single research question by triangulating across multiple tests (REDACTED FOR PEER REVIEW). Accepts TRUE or FALSE. Default = FALSE.

seed

Set a seed to make your results reproducible. Accepts any number. Default = 1.

print_result

Should power analysis results be printed to the console? Accepts TRUE or FALSE. Default = TRUE.

es1...es10

The effect size, expressed in units specified in the es_units argument, for each model. You should always specify these in order, beginning with es1, and not skipping any. Accepts any number. These arguments have no defaults.

iv1iv2_cov...iv9iv10_cov

The relationships between each set of predictors, specified in correlation coefficients. Specifying relationships between predictors is optional. Accepts any number between -1 and 1. Default = 0.

dv1dv2_cov...dv9dv10_cov

The relationships between each set of dependent variables, specified in correlation coefficients. Specifying relationships between DVs is optional. Accepts any number between -1 and 1. Default = 0.

iv1dv2_cov...iv9dv10_cov

The relationships between each set of predictors and dependent variables from separate models, specified in correlation coefficients. Specifying relationships between separate models' predictors and DVs is optional. Accepts any number between -1 and 1. Default = 0.

Details

When you use this function (and we hope you do!), please cite the package:

REDACTED FOR PEER REVIEW

and/or cite the accompanying paper:

REDACTED FOR PEER REVIEW

Value

A dataframe containing a power estiamte, expressed as a decimal, for each of the models individually, and for all the models simultaneously.

Author(s)

Anon

References

REDACTED FOR PEER REVIEW

Venables, W. N. & Ripley, B. D. (2002). Modern applied statistics with S. Springer.

Examples

1
2
3
4
5
6
7
8
# A basic example, leaving all the defaults in place.

pwrMultimodels(n = 150, es_units = "r", es1 = .2, es2 = .45)

# Another example, customizing additional parameters.

pwrMultimodels(n = 300, es_units = "r2", es1 = .04, es2 = .01, es3 = .00,
     null_effect = 3, alpha = .01, seed = 123)

AnonForPeerReview/SimulPowerAnon documentation built on Dec. 17, 2021, 8:52 a.m.