Power and sample size calculations for grouped data
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.
power.grouped(n = NULL, m, X = NULL, theta, sigma, sign.level = 0.05, type.power = c("conditional", "marginal"), MC.iter = 10, type.lik = c("original", "approximate"), gr.mech = c("rounding", "equispaced"), dist.t, dist.x, power. = NULL, limits = c(10, 3000))
n |
Total number of observations. For sample size calculations it must be |
m |
Maximum value of the outcome. |
X |
The model design matrix which must be provided in the
conditional power calculations and |
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 Currently available are two choices for this distribution:
"bernoulli" and "no distr". For the "bernoulli", |
dist.x |
A 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 |
limits |
A vector giving the limits of the interval to be searched for the sample size. Default interval fixed at (10, 3000) |
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
p_c(X) = 1 - F_{nu, delta}(t_nu, 1-alpha/2 | H_a; X) + F_{nu, delta}(t_nu, alpha/2 | H_a; X),
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.
An object of class "power.grouped"
, is a list of the arguments (including the computed one).
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.
Spyridoula Tsonaka spyridoula.tsonaka@med.kuleuven.be
Tsonaka, S., Rizopoulos, D. and Lesaffre, E. (2005) Power and sample size calculations for discrete bounded outcomes. submitted for publication.
## Not run: power.grouped(n = NULL, X = NULL, m = 20, theta = c(0, 1, 0.7), sigma = 1, type.power = "marginal", type.lik = "approximate", gr.mech = "equispaced", dist.t = data.frame("bernoulli", 0.5, 1), dist.x = data.frame("normal", 0, 1), power. = 0.7, limits = c(10,1000)) # to get an initial search area using the approximate likelihood power.grouped(n = NULL, X = NULL, m = 20, theta = c(0, 1, 0.7), sigma = 1, type.power = "marginal", MC.iter = 20, gr.mech = "equispaced", dist.t = data.frame("bernoulli", 0.5, 1), dist.x = data.frame("normal", 0, 1), power. = 0.7, limits = c(10,50)) # redefine the search area and use the original likelihood ## End(Not run) power.grouped(n = 20, X = NULL, m = 20, theta = c(0, 1, 0.7), sigma = 1, type.power = "marginal", gr.mech = "equispaced", dist.t = data.frame("bernoulli", 0.5, 1), dist.x = data.frame("normal", 0, 1), power. = NULL)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.