Learn R Programming

grouped (version 0.6-0)

power.grouped: 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.

Usage

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))

Arguments

n
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 margin
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
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)

Value

  • An object of class "power.grouped", is a list of the arguments (including the computed one).

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 $$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 $\nu$ degrees of freedom and non-centrality parameter $\delta$, $\alpha$ 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.

References

Tsonaka, S., Rizopoulos, D. and Lesaffre, E. (2005) Power and sample size calculations for discrete bounded outcomes. submitted for publication.

See Also

grouped, rounding, equispaced, uniroot

Examples

Run this code
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

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)

Run the code above in your browser using DataLab