Description Usage Arguments Details Value Author(s)
Subsets a dataset by a factor then uses power.groups to calculate statistical power for each group
1 2 | power.groupsByFactor(x, f, change, change.type, n1, n2, distribution, test,
alternative = "two.sided", alpha = 0.05, nsims = 1000, nreps = 999)
|
x |
Numerical vector from which the distribution parameters will be calculated using |
f |
Factor the same length as |
change |
Mean of second group minus mean of first group (i.e. mu2-mu1) or percentage change in mu1 to create mu2 (depending on value of |
change.type |
Whether the parameter change represents an additive ( |
n1 |
Vector of sample sizes for group 1. Must be of same dimension as |
n2 |
Vector of sample sizes for group 2. Must be of same dimension as |
distribution |
The statistical distribution for the two groups. Can be either: |
test |
Should be |
alternative |
A character string specifying the alternative hypothesis, must be one of |
alpha |
The type 1 error for assessing statistical significance (default is 0.05) in the power simulations. |
nsims |
Number of repeat simulations to estimate power (default is 1000). |
nreps |
Number of repeat permutations for randomisation test (default is 999). |
This function splits x
into subsets based on f
, then runs power.groups
on each subset. pars1
and pars2
for power.groups
are automatically calculated based on x
and distribution
using basic summary stats (e.g. mean
, sd
) or using MASS::fitdistr
if distribution = "Negbin"
.
An object of class powerByFactor
, which is essentially a list containing the power results for each level of f
. The package includes methods to plot() powerByFactor
objects.
James Hutchison
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.