R: Power and sample size calculations for grouped data
power.grouped
R Documentation
Power and sample size calculations for grouped data
Description
Uses the method of Tsonaka, Rizopoulos and Lesaffre (2005) to estimate the power
(or sample size to achieve desired power) of the Wald's test statistic
for two-tailed two group comparisons in grouped data.
Total number of observations. For sample size calculations it must be NULL.
m
Maximum value of the outcome.
X
The model design matrix which must be provided in the
conditional power calculations and NULL in the
marginal power calculations. Default is NULL.
theta
A vector of the assumed regression coefficient values corresponding to the
intercept, treatment indicator and additional (when needed) covariates.
sigma
The residual standard deviation.
sign.level
Significance level (Type I error probability). Default value fixed at 0.05.
type.power
Type of power calculations.
MC.iter
Number of Monte Carlo iterations for the marginal power calculations. Default value fixed at 10.
type.lik
Type of the likelihood function to be used in the sample size calculations.
For the power calculations always the original likelihood function is used.
gr.mech
Grouping mechanism.
dist.t
A data.frame with 1 row that gives for the treatment indicator the name
of the assumed distribution and the assumed values
of its parameters. This argument must always be provided
for marginal power calculations and missing for conditional
power calculations.
Currently available are two choices for this distribution:
"bernoulli" and "no distr". For the "bernoulli", n values are simulated
from the Bernoulli distribution using the function rbinom and thus the
parameters that must be specified are prob
and size. In the case of "no distr", only the sample size of the two
treatment groups must be specified.
dist.x
A data.frame with number of rows the number of the additional
covariates (except from the treatment indicator).
In each row it is given for each covariate the name
of the assumed distribution and the assumed values
of their parameters. When adjustment for additional
covariates is not envisaged this argument must be missing.
Currently available are the following options for
the covariate distribution: "normal", "gamma",
"beta", "chisquare", "uniform" and "bernoulli".
power.
Power of test (1 minus Type II error probability).
For power calculations it must be NULL.
limits
A vector giving the limits of the interval
to be searched for the sample size. Default interval fixed at (10, 3000)
Details
power.grouped performs power or sample size calculations for bounded outcome scores under
the model described in grouped using the Wald's test statistic. An important feature
of this method is that it allows for covariate adjustments that can considerably increase the power.
Two types of the power function are considered: the conditional and the marginal (i.e., argument type.power).
The conditional power function p_c(X) assumes that the values of the covariates are known and can
be used for post-hoc power analysis. In particular, it is assumed that the Wald's test follows a non central
Student's-t under the alternative hypothesis with power function given by
where F_{nu, delta} is the distribution function of the non-central
Student's-t distribution with ν degrees of freedom and non-centrality parameter δ,
α is the type I error (i.e., argument sign.level) and X the realized values of
the covariates. The marginal power function (mainly used for sample size calculations) acknowledges that prior
to a study the actual values of the covariates are not known and is defined as the expected value of the
conditional power
p_m = int p_c(X) dH(X),
with respect to the assumed distribution of the covariates
H(X), based on pilot or historical data. This expectation is approximated using Monte Carlo integration.
In order to reduce the computational burden (induced by the Monte Carlo integration) for sample size
calculation, an approximation to the likelihood is performed using a first order Taylor series expansion
(i.e., argument type.lik). The approximate likelihood is suggested to be used for sample size
calculations to get a better initial search area than the default (i.e., argument limits).
Then the sample size calculations can be made using the original likelihood function. See Examples
below.
Value
An object of class "power.grouped", is a list of the arguments (including the computed one).
Note
power.grouped currently performs power or sample size calculations for the two-sided test.
uniroot is used to solve power equation for unknowns, so you may see errors from it, notably
about inability to bracket the root when invalid arguments are given.