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.
One-Sample Case (sample.type="one.sample"
)
Let \(\underline{x} = x_1, x_2, \ldots, x_n\) denote a vector of \(n\)
observations from a lognormal distribution with mean
\(\theta\) and coefficient of variation \(\tau\), and consider the null hypothesis:
$$H_0: \theta = \theta_0 \;\;\;\;\;\; (1)$$
The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater"
):
$$H_a: \theta > \theta_0 \;\;\;\;\;\; (2)$$
the lower one-sided alternative (alternative="less"
)
$$H_a: \theta < \theta_0 \;\;\;\;\;\; (3)$$
and the two-sided alternative (alternative="two.sided"
)
$$H_a: \theta \ne \theta_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.
Let
$$y_i = log(x_i), \;\; i = 1, 2, \ldots, n \;\;\;\;\;\; (5)$$
Then \(\underline{y} = y_1, y_2, \ldots, y_n\) denote \(n\) observations from a
normal distribution with mean \(\mu\) and standard deviation \(\sigma\), where
$$\mu = log(\frac{\theta}{\sqrt{\tau^2 + 1}}) \;\;\;\;\;\; (6)$$
$$\sigma = [log(\tau^2 + 1)]^{1/2} \;\;\;\;\;\; (7)$$
$$\theta = exp[\mu + (\sigma^2/2)] \;\;\;\;\;\; (8)$$
$$\tau = [exp(\sigma^2) - 1]^{1/2} \;\;\;\;\;\; (9)$$
(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 \(\theta\) and \(\tau\), not just on \(\theta\).
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
\(\theta\), 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 \(\theta\), you can use the t-distribution to estimate the
power of a test about \(\theta\) that is based on confidence intervals or
Chen's modified t-test, if you are willing to assume the population coefficient of
variation \(\tau\) stays constant for all possible values of \(\theta\) you are
interested in, and you are willing to postulate possible values for \(\tau\).
First, let's re-write the hypotheses (1)-(4) as follows. The null hypothesis (1)
is equivalent to:
$$H_0: \frac{\theta}{\theta_0} = 1 \;\;\;\;\;\; (10)$$
The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater"
)
$$H_a: \frac{\theta}{\theta_0} > 1 \;\;\;\;\;\; (11)$$
the lower one-sided alternative (alternative="less"
)
$$H_a: \frac{\theta}{\theta_0} < 1 \;\;\;\;\;\; (12)$$
and the two-sided alternative (alternative="two.sided"
)
$$H_a: \frac{\theta}{\theta_0} \ne 1 \;\;\;\;\;\; (13)$$
For a constant coefficient of variation \(\tau\), the standard deviation of the
log-transformed observations \(\sigma\) 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:
$$R = \frac{\theta}{\theta_0} = \frac{exp[\mu + (\sigma^2/2)]}{exp[\mu_0 + (\sigma^2/2)]} = \frac{e^\mu}{e^\mu_0} = e^{\mu - \mu_0} \;\;\;\;\;\; (14)$$
which only involves the difference
$$\mu - \mu_0 \;\;\;\;\;\; (15)$$
Thus, for given values of \(R\) and \(\tau\), the power of the test of the null
hypothesis (10) against any of the alternatives (11)-(13) can be computed based on
the power of a one-sample t-test with
$$\frac{\delta}{\sigma} = \frac{log(R)}{\sqrt{log(\tau^2 + 1)}} \;\;\;\;\;\; (16)$$
(see the help file for tTestPower
). Note that for the function
tTestLnormAltPower
, \(R\) corresponds to the argument ratio.of.means
,
and \(\tau\) corresponds to the argument cv
.
Two-Sample Case (sample.type="two.sample"
)
Let \(\underline{x}_1 = x_{11}, x_{12}, \ldots, x_{1n_1}\) denote a vector of
\(n_1\) observations from a lognormal distribution with mean
\(\theta_1\) and coefficient of variaiton \(\tau\), and let
\(\underline{x}_2 = x_{21}, x_{22}, \ldots, x_{2n_2}\) denote a vector of
\(n_2\) observations from a lognormal distribution with mean \(\theta_2\) and
coefficient of variation \(\tau\), and consider the null hypothesis:
$$H_0: \theta_1 = \theta_2 \;\;\;\;\;\; (17)$$
The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater"
):
$$H_a: \theta_1 > \theta_2 \;\;\;\;\;\; (18)$$
the lower one-sided alternative (alternative="less"
)
$$H_a: \theta_1 < \theta_2 \;\;\;\;\;\; (19)$$
and the two-sided alternative (alternative="two.sided"
)
$$H_a: \theta_1 \ne \theta_2 \;\;\;\;\;\; (20)$$
Because we are assuming the coefficient of variation \(\tau\) 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{\theta_1}{\theta_2} = 1 \;\;\;\;\;\; (21)$$
The three possible alternative hypotheses are the upper one-sided alternative
(alternative="greater"
)
$$H_a: \frac{\theta_1}{\theta_2} > 1 \;\;\;\;\;\; (22)$$
the lower one-sided alternative (alternative="less"
)
$$H_a: \frac{\theta_1}{\theta_2} < 1 \;\;\;\;\;\; (23)$$
and the two-sided alternative (alternative="two.sided"
)
$$H_a: \frac{\theta_1}{\theta_2} \ne 1 \;\;\;\;\;\; (24)$$
If coefficient of variation \(\tau\) is the same for both populations, then the
standard deviation of the log-transformed observations \(\sigma\) is also the
same for both populations (see Equation (7) above). Hence, by Equation (8), the
ratio of the means can be written as:
$$R = \frac{\theta_1}{\theta_2} = \frac{exp[\mu_1 + (\sigma^2/2)]}{exp[\mu_2 + (\sigma^2/2)]} = \frac{e^\mu_1}{e^\mu_2} = e^{\mu_1 - \mu_2} \;\;\;\;\;\; (25)$$
which only involves the difference
$$\mu_1 - \mu_2 \;\;\;\;\;\; (26)$$
Thus, for given values of \(R\) and \(\tau\), 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{\delta}{\sigma} = \frac{log(R)}{\sqrt{log(\tau^2 + 1)}} \;\;\;\;\;\; (27)$$
(see the help file for tTestPower
). Note that for the function
tTestLnormAltPower
, \(R\) corresponds to the argument ratio.of.means
,
and \(\tau\) corresponds to the argument cv
.