Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

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.

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.

Author(s)

References

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

See Also

Examples

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

grouped

Regression Analysis of Grouped and Coarse Data

v0.6-0
GPL (>= 2)
Authors
Dimitris Rizopoulos <d.rizopoulos@erasmusmc.nl> and Spyridoula Tsonaka <s.tsonaka@lumc.nl>
Initial release
2009-10-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.