Usage

Arguments

n.or.n1

numeric vector of sample sizes. When sample.type="one.sample",
n.or.n1 denotes n, the number of observations in the single sample. When sample.type="two.sample", n.or.n1 denotes n_1, the number
of observations from group 1.
Missing (NA), undefined (NaN), and infinite (Inf, -Inf)
values are not allowed.

n2

numeric vector of sample sizes for group 2. The default value is the value of
n.or.n1. This argument is ignored when sample.type="one.sample".
Missing (NA), undefined (NaN), and infinite (Inf, -Inf)
values are not allowed.

ratio.of.means

numeric vector specifying the ratio of the first mean to the second mean.
When sample.type="one.sample", this is the ratio of the population mean to the
hypothesized mean. When sample.type="two.sample", this is the ratio of the
mean of the first population to the mean of the second population. The default
value is ratio.of.means=1.

cv

numeric vector of positive value(s) specifying the coefficient of
variation. When sample.type="one.sample", this is the population coefficient
of variation. When sample.type="two.sample", this is the coefficient of
variation for both the first and second population. The default value is cv=1.

alpha

numeric vector of numbers between 0 and 1 indicating the Type I error level
associated with the hypothesis test. The default value is alpha=0.05.

sample.type

character string indicating whether to compute power based on a one-sample or
two-sample hypothesis test. When sample.type="one.sample", the computed
power is based on a hypothesis test for a single mean. When sample.type="two.sample", the computed power is based on a hypothesis test
for the difference between two means. The default value is sample.type="one.sample" unless the argument n2 is supplied.

alternative

character string indicating the kind of alternative hypothesis. The possible values
are "two.sided" (the default), "greater", and "less".

approx

logical scalar indicating whether to compute the power based on an approximation to
the non-central t-distribution. The default value is FALSE.

Details

If the arguments n.or.n1, n2, ratio.of.means, cv, and
alpha are not all the same length, they are replicated to be the same length
as the length of the longest argument.

The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater"):

H_a: θ > θ_0 \;\;\;\;\;\; (2)

the lower one-sided alternative (alternative="less")

H_a: θ < θ_0 \;\;\;\;\;\; (3)

and the two-sided alternative (alternative="two.sided")

H_a: θ \ne θ_0 \;\;\;\;\;\; (4)

To test the null hypothesis (1) versus any of the three alternatives (2)-(4), one
might be tempted to use Student's t-test based on the
log-transformed observations. Unlike the two-sample case with equal coefficients of
variation (see below), in the one-sample case Student's t-test applied to the
log-transformed observations will not test the correct hypothesis, as now explained.

(see the help file for LognormalAlt). Hence, by Equations (6) and (8) above,
the Student's t-test on the log-transformed data would involve a test of hypothesis
on both the parameters θ and τ, not just on θ.

To test the null hypothesis (1) above versus any of the alternatives (2)-(4), you
can use the function elnormAlt to compute a confidence interval for
θ, and use the relationship between confidence intervals and hypothesis
tests. To test the null hypothesis (1) above versus the upper one-sided alternative
(2), you can also use
Chen's modified t-test for skewed distributions.

Although you can't use Student's t-test based on the log-transformed observations to
test a hypothesis about θ, you can use the t-distribution to estimate the
power of a test about θ that is based on confidence intervals or
Chen's modified t-test, if you are willing to assume the population coefficient of
variation τ stays constant for all possible values of θ you are
interested in, and you are willing to postulate possible values for τ.

The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater")

H_a: \frac{θ}{θ_0} > 1 \;\;\;\;\;\; (11)

the lower one-sided alternative (alternative="less")

H_a: \frac{θ}{θ_0} < 1 \;\;\;\;\;\; (12)

and the two-sided alternative (alternative="two.sided")

H_a: \frac{θ}{θ_0} \ne 1 \;\;\;\;\;\; (13)

For a constant coefficient of variation τ, the standard deviation of the
log-transformed observations σ is also constant (see Equation (7) above).
Hence, by Equation (8), the ratio of the true mean to the hypothesized mean can be
written as:

The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater"):

H_a: θ_1 > θ_2 \;\;\;\;\;\; (18)

the lower one-sided alternative (alternative="less")

H_a: θ_1 < θ_2 \;\;\;\;\;\; (19)

and the two-sided alternative (alternative="two.sided")

H_a: θ_1 \ne θ_2 \;\;\;\;\;\; (20)

Because we are assuming the coefficient of variation τ is the same for
both populations, the test of the null hypothesis (17) versus any of the three
alternatives (18)-(20) can be based on the Student t-statistic using the
log-transformed observations.

To show this, first, let's re-write the hypotheses (17)-(20) as follows. The
null hypothesis (17) is equivalent to:

H_0: \frac{θ_1}{θ_2} = 1 \;\;\;\;\;\; (21)

The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater")

H_a: \frac{θ_1}{θ_2} > 1 \;\;\;\;\;\; (22)

the lower one-sided alternative (alternative="less")

H_a: \frac{θ_1}{θ_2} < 1 \;\;\;\;\;\; (23)

and the two-sided alternative (alternative="two.sided")

H_a: \frac{θ_1}{θ_2} \ne 1 \;\;\;\;\;\; (24)

If coefficient of variation τ is the same for both populations, then the
standard deviation of the log-transformed observations σ is also the
same for both populations (see Equation (7) above). Hence, by Equation (8), the
ratio of the means can be written as:

Thus, for given values of R and τ, the power of the test of the null
hypothesis (21) against any of the alternatives (22)-(24) can be computed based on
the power of a two-sample t-test with

\frac{δ}{σ} = \frac{log(R)}{√{log(τ^2 + 1)}} \;\;\;\;\;\; (27)

(see the help file for tTestPower). Note that for the function
tTestLnormAltPower, R corresponds to the argument ratio.of.means,
and τ corresponds to the argument cv.

Value

a numeric vector powers.

Note

The normal distribution and
lognormal distribution are probably the two most
frequently used distributions to model environmental data. Often, you need to
determine whether a population mean is significantly different from a specified
standard (e.g., an MCL or ACL, USEPA, 1989b, Section 6), or whether two different
means are significantly different from each other (e.g., USEPA 2009, Chapter 16).
When you have lognormally-distributed data, you have to be careful about making
statements regarding inference for the mean. For the two-sample case with
assumed equal coefficients of variation, you can perform the
Student's t-test on the log-transformed observations.
For the one-sample case, you can perform a hypothesis test by constructing a
confidence interval for the mean using elnormAlt, or use
Chen's t-test modified for skewed data.

In the course of designing a sampling program, an environmental scientist may wish
to determine the relationship between sample size, significance level, power, and
scaled difference if one of the objectives of the sampling program is to determine
whether a mean differs from a specified level or two means differ from each other.
The functions tTestLnormAltPower, tTestLnormAltN,
tTestLnormAltRatioOfMeans, and plotTTestLnormAltDesign
can be used to investigate these relationships for the case of
lognormally-distributed observations.