Description Usage Arguments Details Value Author(s) References Examples
Simulate power to simultaneously detect predicted effects for a set of statistical tests in a single model with multiple predictors. 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 models with between 2 and 10 predictor variables and a single dependent variable. A detailed walkthrough and set of vignettes for this and other SimulPower functions is available here.
1 2 3 4 5 |
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 predictors are you computing "null power?" If you want to compute "power" to NOT detect an effect, use this argument to specify which effects are predicted nulls by setting this argument equal to the number(s) corresponding to the predictors you hypothesize to be null. If you predict predictor 3 and predictor 4 to have null effects, you should specify null_effect = c(3, 4). Accepts either a single whole number between 1 and the number of predictors you have specified or a vector of numbers between 1 and the the number of predictors you have specified. Default = no null effects. |
iterations |
How many times you would like to run your model 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 (Le Forestier, Page-Gould, & Chasteen, Forthcoming). 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 the relationship between each predictor and the dependent variable. 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 unless your predictors, together, account for more than 100% of the variance in your DV, in which case you must specify relationships between your predictors to make that possible. Accepts any number between -1 and 1. Default = 0. |
When you use this function (and we hope you do!), please cite the package:
Le Forestier, J. M. (2020). SimulPower: Simultaneous power analysis for a set of statistical tests. https://doi.org/10.31219/osf.io/w96uk
and/or cite the accompanying paper:
Le Forestier, J. M., Page-Gould, E., & Chasteen, A. L. (Forthcoming). Statistical power for a set of tests.
A dataframe containing a power estiamte, expressed as a decimal, for each of the effects individually, and for all the effects simultaneously.
Joel Le Forestier (joel.leforestier@mail.utoronto.ca)
Le Forestier, J. M., Page-Gould, E., & Chasteen, A. (Forthcoming). Statistical power for a set of tests.
Venables, W. N. & Ripley, B. D. (2002). Modern applied statistics with S. Springer.
1 2 3 4 5 6 7 8 | # A basic example, leaving all the defaults in place.
pwrMultivars(n = 150, es_units = "r", es1 = .2, es2 = .15)
# Another example, customizing additional parameters.
pwrMultivars(n = 300, es_units = "d", es1 = .4, es2 = .04, es3 = .05,
null_effect = c(2, 3), iv1iv2_cov = .2, alpha = .01, seed = 123)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.