size.test.slope: Sample size for a test of a slope

View source: R/statpsych2.R

size.test.slopeR Documentation

Sample size for a test of a slope

Description

Computes the total sample size required to test a population slope with desired power in a between-subjects design with a quantitative factor. In an experimental design, the total sample size would be allocated to the levels of the quantitative factor and it might be necessary to use a larger total sample size to achieve equal sample sizes. Set the error variance planning value to the largest value within a plausible range for a conservatively large sample size.

For more details, see Section 1.25 of Bonett (2021, Volume 2)

Usage

size.test.slope(alpha, pow, evar, x, slope, h)

Arguments

alpha

alpha level for hypothesis test

pow

desired power

evar

planning value of within-group (error) variance

x

vector of x values of the quantitative factor

slope

planning value of slope

h

null hypothesis value of slope

Value

Returns the required total sample size

References

\insertRef

Bonett2021statpsych

Examples

x <- c(2, 5, 8)
size.test.slope(.05, .9, 31.1, x, .75, 0)

# Should return:
# Total sample size
#               100
 


statpsych documentation built on Jan. 13, 2026, 1:07 a.m.