Power for t tests, including arbitrary linear hypotheses
tpower.RdPower for t tests, including arbitrary linear hypotheses
Arguments
- n
- Sample size (total). 
- delta
- Effect size; if specified, a two-group design is assumed. If more than two groups, use - binstead.
- lam
- Contrast. 
- b
- If a vector, the coefficient for each group. If a matrix, must have - length(n)rows.
- sd
- Standard deviation of outcome. 
- alpha
- Type I error rate. 
- w
- Weights for unequal allocation (normalized to 1). 
- n1, n2
- Sample size for group 1, 2. 
- verbose
- Print details for power calculations. Default: TRUE unless vectorized. 
- power
- Desired power. 
- upper
- Upper bound for - tsamsize(); increase if tsamsize hits this bound. Default: 5000.
- ...
- For - tsamsize(), additional arguments to be passed to- tpower().
Examples
tpower(100, 0.5)
#> Group 1: 50
#> Group 2: 50
#> Power:   0.697
tpower(10*(6:9), 0.5)                # Vectorize sample size
#> [1] 0.4778410 0.5406591 0.5981316 0.6501772
tpower(100, seq(0.25, 1, by=0.25))   # Vectorize effect size
#> [1] 0.2350874 0.6968888 0.9602024 0.9986074
tpower(100, 0.5, alpha=seq(0.01, 0.05, 0.01))   # Vectorize alpha
#> [1] 0.4529913 0.5553191 0.6178457 0.6624989 0.6968888
tpower(99, b=c(0.5, 0.5, 0), lam=c(1,1,-1))    # A multi-group example
#> Group 1: 33
#> Group 2: 33
#> Group 3: 33
#> Power:   0.907
tsamsize(0.5)
#> n1 n2 
#> 64 64 
tsamsize(lam=c(-1,1,0,0), b=c(0,1,1,1))
#> n1 n2 n3 n4 
#> 17 17 17 17