linearTrendTestScaledMds {EnvStats}  R Documentation 
Compute the scaled minimal detectable slope associated with a ttest for liner trend, given the sample size or predictor variable values, power, and significance level.
linearTrendTestScaledMds(n, x = lapply(n, seq), alpha = 0.05, power = 0.95,
alternative = "two.sided", two.sided.direction = "greater", approx = FALSE,
tol = 1e07, maxiter = 1000)
n 
numeric vector of sample sizes. All values of 
x 
numeric vector of predictor variable values, or a list in which each component is
a numeric vector of predictor variable values. Usually, the predictor variable is
time (e.g., days, months, quarters, etc.). The default value is

alpha 
numeric vector of numbers between 0 and 1 indicating the Type I error level
associated with the hypothesis test. The default value is 
power 
numeric vector of numbers between 0 and 1 indicating the power
associated with the hypothesis test. The default value is 
alternative 
character string indicating the kind of alternative hypothesis. The possible values
are 
two.sided.direction 
character string indicating the direction (positive or negative) for the
scaled minimal detectable slope when 
approx 
logical scalar indicating whether to compute the power based on an approximation to
the noncentral tdistribution. The default value is 
tol 
numeric scalar indicating the toloerance to use in the

maxiter 
positive integer indicating the maximum number of iterations
argument to pass to the 
If the argument x
is a vector, it is converted into a list with one
component. If the arguments n
, x
, 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 ttest 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
linearTrendTestScaledMds
uses the uniroot
search algorithm to
determine the minimal detectable scaled slope for specified values of the power,
sample size, and Type I error level.
numeric vector of computed scaled minimal detectable slopes. When
alternative="less"
, or alternative="two.sided"
and
two.sided.direction="less"
, the computed slopes are negative. Otherwise,
the slopes are positive.
See the help file for linearTrendTestPower
.
Steven P. Millard (EnvStats@ProbStatInfo.com)
See the help file for linearTrendTestPower
.
linearTrendTestPower
, linearTrendTestN
,
plotLinearTrendTestDesign
, lm
,
summary.lm
, kendallTrendTest
,
Power and Sample Size, Normal, t.test
.
# Look at how the scaled minimal detectable slope for the ttest for linear
# trend increases with increasing required power:
seq(0.5, 0.9, by = 0.1)
#[1] 0.5 0.6 0.7 0.8 0.9
scaled.mds < linearTrendTestScaledMds(n = 10, power = seq(0.5, 0.9, by = 0.1))
round(scaled.mds, 2)
#[1] 0.25 0.28 0.31 0.35 0.41
#
# Repeat the last example, but compute the scaled minimal detectable slopes
# based on the approximate power instead of the exact:
scaled.mds < linearTrendTestScaledMds(n = 10, power = seq(0.5, 0.9, by = 0.1),
approx = TRUE)
round(scaled.mds, 2)
#[1] 0.25 0.28 0.31 0.35 0.41
#==========
# Look at how the scaled minimal detectable slope for the ttest for linear trend
# decreases with increasing sample size:
seq(10, 50, by = 10)
#[1] 10 20 30 40 50
scaled.mds < linearTrendTestScaledMds(seq(10, 50, by = 10), alternative = "greater")
round(scaled.mds, 2)
#[1] 0.40 0.13 0.07 0.05 0.03
#==========
# Look at how the scaled minimal detectable slope for the ttest for linear trend
# decreases with increasing values of Type I error:
scaled.mds < linearTrendTestScaledMds(10, alpha = c(0.001, 0.01, 0.05, 0.1),
alternative="greater")
round(scaled.mds, 2)
#[1] 0.76 0.53 0.40 0.34
#
# Repeat the last example, but compute the scaled minimal detectable slopes
# based on the approximate power instead of the exact:
scaled.mds < linearTrendTestScaledMds(10, alpha = c(0.001, 0.01, 0.05, 0.1),
alternative="greater", approx = TRUE)
round(scaled.mds, 2)
#[1] 0.70 0.52 0.41 0.36
#==========
# Clean up
#
rm(scaled.mds)