This package offers implementation of analytical and sampling-based power analyses for the Wald, LR, score, and gradient tests in the frameworks of linear hypotheses and marginal maximum likelihood estimation. The methods are described in our paper (Zimmer et al. (2022), https://doi.org/10.1007/s11336-022-09883-5).
You can install the CRAN version using:
Or, you can install the development version of irtpwr from GitHub with:
We can load the irtpwr package using:
library(irtpwr)
library(mirt)
#> Loading required package: stats4
#> Loading required package: lattice
We want to know the power and the required sample size for a test of the Rasch vs 2PL model. We use the LSAT 7 data set which is included the mirt package.
As a first step, we load the data set and fit a 2PL model.
The 2PL parameters are then used as parameters for the alternative hypothesis in our hypothesis definition.
We can now perform the power analysis. We want to determine the sample size necessary for a power of .8 while using an alpha level of .05.
res <- irtpwr(hyp = hyp, power = 0.8, alpha = 0.05)
summary(res)
#>
#> Sample sizes for power = 0.8 (alpha = 0.05):
#>
#> Statistic N
#> Wald 1134
#> LR 887
#> Score 932
#> Gradient 778
#>
#> Method: Analytical
Here we see that the gradient statistic would be the most efficient to test our hypothesis: We would need a sample size of 778 to reach our desired power.
We can also plot the power curves to get a more detailed look on the relationships between sample size and power:
Further documentation on how to use the package is found in the package vignettes:
If the vignettes were included during installation (for example using the methods above), they can be accessed via: