knitr::opts_chunk$set(echo = TRUE)
This is a non-exhaustive list of common questions and error messages:
"Does this package currently support power analyses for 3-way interactions?"
power_interaction_3way_r2()
. We do not plan on adding simulation-based power analyses for 3-way interactions. Please get in touch if you have a research question that needs that functionality. "All reliabilities must be greater than 0 and less than or equal to 1"
"All correlations must be within [-1,1]"
"All correlations must be within [-1,1],." or "No valid settings"
adjust.correlations = TRUE
, and a variable is binary or ordinal, the algorithm will increase the correlations so that the output correlations match the effects input by the user. This is necessary because transforming normal variables to be binary or ordinal reduces their correlations with the other variables. However, it can happen that this is impossible, as it would require correlations greater than \|1\|. If you encounter this error, reduce your your correlations between variables. power_interaction()
automatically removes these settings from the input."Settings produce a negative y-variance" or "No valid settings"
"Correlation matrix is impossible - is not positive semi-definite."
Something else not covered...
{dplyr}
and {ggplot2}
packages, so make sure those are updated first (i.e., re-install them).power_estimate()
produces NA
.
power_estimate()
fits a regression model to the output of power_interaction()
to identify when a specified power-level is reached. It will give a result of NA
for three related reasons:
The predicted value where power is reached is outside the range of values tested by the simulation. Simply increase the range of values tested.
The predicted value is within the range of values tested, but only barely. For example, say power_target = .8
, and one simulation achieved a pwr = 0.804
. Even though 0.804 was achieved in one round of simulations, the regression analysis may predict, based on the other values tested in the simulation, that an even larger value is needed to achieve 80% power. The solution is again to increase the range of values tested.
Power-curves taper-off as power increases, eventually flattening out. power_estimate()
fits a threshold regression model using the chngpt package, to identify whether the power-curve has flattened, and to remove the flattened portion if so. This is so that the main power_estimate()
regression model will be more accurate. However, occasionally the threshold regression model is greedy, and it removes too much. This can happen particularly if the simulation only includes a few values. The solution is again to increase the range of values tested.
Results differ each time I run a simulation
n.iter = 1000
simulations, as this is enough to give a general sense of the pattern of results. However, we recommend n.iter = 10000
for more stable results. power_estimate()
fits a regression model, and as with any regression, the number of observations, as well as their variance, impacts results. So, increasing the range and density of parameters in the simulation will also improve the stability of results. The seed
parameter can also be set, so that identical results are given each time. However, this is not recommended until results have stabilized (by increasing n.iter
). If seed
is set n.iter = 50
will yield the same results every time, but that doesn't mean those results are informative.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.