Learn R Programming

ssanv (version 1.1)

ss.nonadh: Find sample sizes accounting for nonadherence

Description

Calculate sample sizes needed for a two-sample difference in means test accounting for nonadherence (i.e., noncompliance) in a proportion of subjects.

Usage

ss.nonadh(mu0 = NULL, mu1 = NULL, delta = NULL, sigma0.sq = 1, rho0 = 0, rho1 = 0, ss.ratio = 1, var.ratio = 1, deltaB = 0, sig.level = 0.05, power = 0.8, alternative = c("two.sided", "one.sided"), refinement = NULL,error.fisher=10^-6)

Arguments

mu0
mean of control group
mu1
mean of treatment group
delta
mu0 - mu1
sigma0.sq
variance of control group
rho0
probability that a subject randomized to control will switch to treatment
rho1
probability that a subject randomized to treatment will switch to control (or respond like control subjects)
ss.ratio
n1/n0, where n0 (n1) is sample size of control (treatment) group for proposed study
var.ratio
$sigma1^2/sigma0^2$, where $sigma0$ ($sigma1$) is standard deviation of control (treatment) group for proposed study
deltaB
boundary value between null and alternative hypotheses for one-sided tests (see details)
sig.level
significance level (Type I error)
power
minimum power that you want the sample size to achieve
alternative
One- or two-sided test
refinement
More precise sample size estimates for certain types of responses, possible values: NULL (use asymptotic method), `Normal' or 'N','Bernoulli' or 'B', and 'Fisher.exact' or 'F'.
error.fisher
bound on the abolute error of the power calculations for the Fisher.exact refinement

Value

(including the computed sample sizes) augmented with 'METHOD' and 'NOTE' elements. The values 'n0' and 'n1' are the samples sizes for the two groups, rounded up to the nearest integer.

Details

Calculates the sample sizes for a study designed to test the difference between the means of two groups, where a proportion of those randomized to the control regimin switch to the treatment regimin (rho0) and a proportion of those randomized to the treatment regimin switch to the control regimin (rho1).

You must supply either mu0 and mu1 or delta=mu0-mu1. The one-sided tests are designed to test either $H0: delta <= deltab$="" vs.="" $h1:="" delta=""> deltaB$ or to test $H0: delta >= deltaB$ vs. $H1: delta < deltaB$. The choice of hypotheses is determined by the value of delta; if delta $>$ deltaB then the former hypotheses are tested, otherwise the latter are.

The responses may be continuous, discrete, or even binary. The value refinement defines different methods related to the response type. When refinement=NULL, the method is based on asymptotic normal approximation. For refinement='Normal' the method is based on the t-distribution derived when the responses are normal. For refinement='Bernoulli' the sigma0.sq and var.ratio values are defined by mu0 and mu1, and the sample sizes do not use any continuity correction. For refinement='Fisher.exact' only the two-sided alternative is allowed and the sample size related to exact powers for the 2X2 Fisher exact test are calculated.

See Fay, Halloran and Follmann (2007) for details.

References

Fay, M.P., Halloran, M.E., and Follmann, D.A. (2007). `Accounting for Variability in Sample Size Estimation with Applications to Nonadherence and Estimation of Variance and Effect Size' Biometrics 63: 465-474.

See Also

uniroot.integer, ss.fromdata.neff, ss.fromdata.pois, ss.fromdata.nvar

Examples

Run this code

### Suppose treatment will not work on about 30 percent of subjects 
### then rho0=.3 and clinically significant difference in means is .5 
ss.nonadh(delta=.5,rho0=.3)

## Binary data, quick calculation
ss.nonadh(mu0=.1,mu1=.4,refinement="B")
# Calculate Fisher.exact before packaging, took about 8 seconds
#example.of.Fisher.exact<-ss.nonadh(mu0=.1,mu1=.4,refinement="Fisher.exact")
data(example.of.Fisher.exact)
example.of.Fisher.exact

Run the code above in your browser using DataLab