linearTrendTestN(slope.over.sigma, alpha = 0.05, power = 0.95, alternative = "two.sided", approx = FALSE, round.up = TRUE, n.max = 5000, tol = 1e-07, maxiter = 1000)
slope.over.sigma=0
.
alpha=0.05
.
power=0.95
.
"two.sided"
(the default), "greater"
, and "less"
.
approx=FALSE
.
TRUE
.
n.max=5000
.
uniroot
search algorithm.
The default value is tol=1e-7
.
uniroot
function. The default
value is maxiter=1000
.
slope.over.sigma
, alpha
, and power
are not
all the same length, they are replicated to be the same length as the length of
the longest argument. Formulas for the power of the t-test of linear trend for specified values of
the sample size, scaled slope, and Type I error level are given in
the help file for linearTrendTestPower
. The function
linearTrendTestN
uses the uniroot
search algorithm to
determine the required sample size(s) for specified values of the power,
scaled slope, and Type I error level.
linearTrendTestPower
.
linearTrendTestPower
, linearTrendTestScaledMds
,
plotLinearTrendTestDesign
, lm
,
summary.lm
, kendallTrendTest
,
Power and Sample Size, Normal, t.test
.
# Look at how the required sample size for the t-test for zero slope
# increases with increasing required power:
seq(0.5, 0.9, by = 0.1)
#[1] 0.5 0.6 0.7 0.8 0.9
linearTrendTestN(slope.over.sigma = 0.1, power = seq(0.5, 0.9, by = 0.1))
#[1] 18 19 21 22 25
#----------
# Repeat the last example, but compute the sample size based on the approximate
# power instead of the exact:
linearTrendTestN(slope.over.sigma = 0.1, power = seq(0.5, 0.9, by = 0.1),
approx = TRUE)
#[1] 18 19 21 22 25
#==========
# Look at how the required sample size for the t-test for zero slope decreases
# with increasing scaled slope:
seq(0.05, 0.2, by = 0.05)
#[1] 0.05 0.10 0.15 0.20
linearTrendTestN(slope.over.sigma = seq(0.05, 0.2, by = 0.05))
#[1] 41 26 20 17
#==========
# Look at how the required sample size for the t-test for zero slope decreases
# with increasing values of Type I error:
linearTrendTestN(slope.over.sigma = 0.1, alpha = c(0.001, 0.01, 0.05, 0.1))
#[1] 33 29 26 25
Run the code above in your browser using DataLab