Inferences about \(\mu\)

Part 2: Unknown \(\sigma^2\), t-distribution

Inferences About when \(\sigma\) is unknown

  • For large sample sizes, it follows from the CLT that \(\bar{Y}\) is approximately Normally distributed i.e., \(\bar{Y} \dot{\sim} N(\mu,\frac{\sigma^2}{n})\).

  • It follows that the random variable \[T_{n-1} =\Big( \bar{Y} - \mu \Big) / \Big( S/\sqrt{n} \Big)\] has approximately the Student’s \(t\) distribution with \(n-1\) degrees of freedom.

  • Here \(Y_1, Y_2, \ldots,Y_n\) are sampling random variables and \(\bar{Y} = \frac{1}{n} \displaystyle\sum_i Y_i\) is thus a random variable.

Inferences About when \(\sigma\) is unknown - cont.

The denominator of \(T_{n-1}\) is the random variable

\[ S = \sqrt{\frac{1}{n-1} \sum_{i=1}^n (Y_i - \bar{Y})^2} \]

  • If sampling from a Normal distribution, the sample mean \(\bar{Y}\) has a Normal distribution (exactly) and therefore \((\bar{Y}-\mu)/(S/\sqrt{n})\) will have a Student’s \(t\) distribution (exactly), regardless of sample size.

Until now, we have assumed that \(n\) is large and \(\sigma\) is known, or \(n\) is large and \(n\) is large enough also to use \(s\) as an approximation to \(\sigma\).

  • Since we used the CLT to derive confidence limits and tests of hypotheses, the exact nature of the sampled population was not required to be specified.

  • Now we require that the population distribution to be Normal. We don’t need to know \(\sigma\) or have a large sample, i.e. \(n\) to be large.

  • In this situation, for any \(n\), (\(\bar{Y} - \mu)/(S/\sqrt{n})\) will have a Student’s t-distribution with d.f.\(= n-1.\)

  • Using this fact we can obtain confidence intervals and conduct tests of hypotheses even though \(\sigma\) is unknown.

Standard Normal vs. Student’s t-distribution

Properties of the Student’s distribution

There are many t-distributions each specified by a single parameter called degrees of freedom (\(df\)).

  • Like the standard normal population, the distribution is symmetric about 0 and has mean equal to 0.

  • The t-distribution has variance \(df/(df-1)\), and hence is more variable than the standard normal distribution which has variance equal to 1.

  • We say that the t-distribution has heavier tails than the standard normal distribution.

  • As the degrees of freedom \(df\) increases, the t-distribution approaches that of the standard normal distribution.

The \(t\) table gives quantiles 0.90, 0.95, 0.975, 0.99, 0.995, and 0.999 for \(t\) distributions with selected df.

If \(\alpha\) = 0.05, then \(t_\alpha\) satisfies \(P(T_{10} > t_{.05}) = 0.05\) and from the t table , \(t_{.05} = 1.812\). If \(\alpha\) = 0.05, then \(t_{\alpha/2} \, \equiv t_{0.025}= 2.228\)
Comparison of Normal and \(t\) Quantiles

\(t_\alpha\) with indicated df
\(\alpha\) \(z_\alpha\) 10 20 30 40 60 240
0.1 1.28 1.37 1.32 1.31 1.30 1.30 1.28
0.05 1.65 1.81 1.72 1.70 1.68 1.67 1.65
0.01 2.33 2.76 2.53 2.46 2.42 2.39 2.34

t-distribution R Functions

The process of obtaining \(t_\alpha\) is nearly identical to that of \(z_\alpha\). Again, recall that R computes \(t_\alpha\) such that \(P(T>t_\alpha)=\alpha\). For example, we can obtain \(t_{0.05}\) with the following code:

alpha = 0.05; n = 20
qt(1-alpha, df = n-1)
[1] 1.729133

Or we can compute \(P(T<1)\) with 10 \(df\) using the following:

pt(q=1, df=10)
[1] 0.8295534

Confidence Interval for \(\mu\) based on the t-distribution

Let the sample size be \(n\), and for \(\alpha\) be a specified value, say, for e.g. \(.05\).

  • A \((1-\alpha)100\%\) confidence interval for \(\mu\) is given by \[\left(\bar{y} - t_{\alpha/2} \, \frac{s}{\sqrt{n}}, \quad \bar{y} + t_{\alpha/2} \, \frac{s}{\sqrt{n}}\right)\]

  • This may also be written as \(\left(\bar{y} - t_{\alpha/2} s_{\bar{y}}, \quad \bar{y} + t_{\alpha/2} s_{\bar{y}} \right)\)

  • Here, \(t_{\alpha/2}\) is the \(1-\alpha/2\) percentile of the t-distribution with \(n-1\) degrees of freedom and \(s_{\bar{y}}\) is the standard error of the mean.

Test Procedures based on the t-distribution:

Hypotheses:
Case 1:\(H_0: \mu \leq \mu_0\ \mbox{vs.}\ H_a: \mu >\mu_0\) (right-tailed test)
Case 2: \(H_0: \mu \geq \mu_0\ \mbox{vs.}\ H_a: \mu <\mu_0\) (left-tailed test)
Case 3 \(H_0: \mu = \mu_0\ \mbox{vs.}\ H_a: \mu \not =\mu_0\) (two-tailed test)
T.S: \(t_c = \frac{\bar{y}-\mu_0}{s/\sqrt{n}}\)
R.R: For Type I error probability of \(\alpha\):
Case 1: Reject \(H_0:\) if \(t \geq t_{\alpha,(n-1)}\)
Case 2: Reject \(H_0:\) if \(t \leq -t_{\alpha,(n-1)}\)
Case 3: Reject \(H_0:\) if \(|t| \geq t_{\alpha/2,(n-1)}\)

Test Procedures based on the t-distribution - cont.:

Level of Significance (p-value):
Case 1: \(p = P(T_{n-1} > t_c\)).
Case 2: \(p = P(T_{n-1} < t_c\)).
Case 3: \(p= 2P(T_{n-1} > |t_c|)\).

Exercise

A massive multistate outbreak of food-borne illness was attributed to Salmonella enteritidis. Epidimiologists determined that the source of the illness was ice cream. They sampled nine production runs from the company that produced the ice cream to determine the level of Salmonella enteritidis in the ice cream.

These levels (MPN/g) are as follows
\(.593\quad .142\quad .329\quad .691\quad .231\quad .793\quad .519\quad .392\quad .418\)
Use the data to determine whether the mean level of Salmonella enteritidis in the ice cream is greater than .3 MPN/g with \(\alpha=.01\)

Exercise - cont.

Solution:
Need to test \(H_0: \mu \leq .3\) vs. \(H_a: \mu > .3\)

From the data \(\bar{y}=.456\) and \(s= .2128\) are computed, giving \[t_c= \frac{\bar{y}-\mu_0}{s/\sqrt{n}}=\frac{.456-.3}{.2128/\sqrt{9}}=2.21\] Because for the one-tailed test we need \(t_{\alpha,(n-1)}\); we look up \(t_{.01}\) with \(df=9-1=8\). It is \(2.896\). Thus the rejection region is: \(t>2.896\)

Exercise - cont.

Since \(t_c= 2.214\) does not exceed \(2.896\) it is not in the R.R.
Thus, there is insufficient evidence in the data to reject \(H_0\) i.e to say that the mean level of Salmonella enteritidis exceeds the dangerous level of .3 MPN/g.
The p-value to be computed is \(P(T_8>2.21)\)
To calculate this exactly using the t-table is not possible since it is tabulated for only a few values of \(a\).
However, we can bound the p-value by noting that, for \((df=8)\), 2.21 lies between 1.86 and 2.306.
This gives \(.025<\mbox{p-value}<.05\) showing that the p-value is not less than our \(\alpha\) of \(.01\). Thus we fail to reject \(H_0\).

Exercise - R code

Recall that we are testing \(H_0:\mu=0.3\) vs \(H_A:\mu>0.3\).

# Data
y <- c(.593,.142,.329,.691,.231,.793,.519,.392,.418)

# Compute statistics
n <- length(y)
ybar <- mean(y); s <- sd(y)
tc <- (ybar-0.3)/(s/sqrt(n))

# Critical Region
critical_region <- qt(p=1-0.01, df=n-1)
tc > critical_region
[1] FALSE
# P-value
p_value <- pt(q=tc, df=n-1, lower.tail = F)
p_value
[1] 0.02926516

Type I and Type II Errors

All statistical tests have a level of uncertainty. We can quantify this through Type I and Type II errors. The probabilities of Type I and II error are \(\alpha\) and \(\beta\), respectively.

Type I Error and Type II Error

  • The experimenter can control only the Type I error probability. We do this by specifying an \(\alpha\) for an experiment (before the data values are measured).

  • When we are testing an hypothesis about \(\mu\) using \(\alpha\) for the test, the value of Type II error probability \(\beta\) depends on the actual value \(\mu\) which is not known.

  • This is because \(\beta\) is the probability of incorrectly failing to reject \(H_0\) when \(H_a\) is true.

  • When \(H_a\) is true, the actual value of \(\mu\) may be any value under \(H_a\), i.e, a value not specified under \(H_0\). Since this value of \(\mu\) is unknown, \(\beta\) cannot be calculated.

Illustration

Type I Error and Type II Error

  • The implication of this is that when, based on a test, we find that we cannot reject \(H_0\), we will not say that we accept \(H_0\).

  • Because if we say we accept \(H_0\) and \(\beta\) turns out to be large, then the probability is large that we will be committing a Type II error.

  • Thus the correct way to state the decision is to say, that we fail to reject \(H_0\).

Power of the Test

  • By definition, power of a test is the probability of rejecting \(H_0\) for a specified value of \(\mu\) under \(H_a\).

  • In practice, tests are designed to have large power for some \(\mu\) values of interest so that they have small Type II error probabilities.

  • We can relate to this idea by thinking of a test as having very good power if it has a very good chance of detecting whether a change in \(\mu\) has actually occurred.

  • This is usually done by selecting a sample size \(n\) to be used for the experiment so that the desired power is achieved for a specified \(\mu\) and \(\alpha\).

Departures from Normality

  • When \(\bar{Y}\) is a Normal random variable, i.e., when sampling from a Normal population with mean \(\mu_0\), \(\frac{\bar{Y}-\mu_0}{S/\sqrt{n}}\) is a \(T_{n-1}\) random variable.

  • This is a theoretical fact. In practice, however, we never sample exactly from a Normal population, so (\(\bar{Y}- \mu_0)/S/\sqrt{n}\) will be only approximately \(T_{n-1}\).

  • How much effect can this have on C.I.’s and tests we construct?

  • For symmetrically distributed populations and not too small \(n\) there is little to worry about.

  • For highly skewed population distributions the approximation can be terrible especially for small \(n\).

  • It is recommended that one look at a boxplot, Normal plot, and/or other graphics to see whether severe skewness of the sampling population is indicated. If not, proceed to use the \(t\)-distribution. If yes, one can use a nonparametric procedure or use a transformation. We will look at some of these later.

Using Confidence Intervals to Test Hypotheses

  • We can always look at a (1-\(\alpha\))100% confidence interval and see what the result of a test would be if we carry out the test.

  • For example, consider the (1-\(\alpha\))100% confidence interval for \(\mu\) \[\left(\bar{y} - t_{\alpha/2} \, \frac{s}{\sqrt{n}}, \quad \bar{y} + t_{\alpha/2} \, \frac{s}{\sqrt{n}}\right)\]

  • Suppose that \(\mu_0\) is not included in the above confidence interval because \[\bar{y} - t_{\alpha/2} \, \frac{s}{\sqrt{n}}>\mu_0\]

Using Confidence Intervals to Test Hypotheses - cont.

  • By rearranging this we see that this is equivalent to \(t_c\) being in the rejection region, i.e.,
    \[\frac{\bar{y}-\mu_0}{s/\sqrt{n}} > t_{\alpha/2,(n-1)}\]

  • Observe carefully that this is the same rejection region for the test of \(H_0: \mu \leq \mu_0\) vs. \(H_a: \mu > \mu_0\) at level \(\alpha/2\).

  • That is, we will be rejecting \(H_0\) at level \(\alpha/2\) if
    \[\frac{\bar{y}-\mu_0}{s/\sqrt{n}} > t_{\alpha/2,(n-1)}\]

  • This is equivalent to saying that if \(\mu_0\) was not included in a 100(1-\(\alpha\))% interval, then \(H_0\) will be rejected if the test is carried out at \(\alpha/2\) level.

Using Confidence Intervals to Test Hypotheses - cont.

  • For a two-tailed test, the confidence interval should be based on the same \(\alpha\) as the test to make this inference.

In summary,

  • To test \(H_0: \mu \leq \mu_0, \quad H_a: \mu > \mu_0\), at level \(\alpha/2\), use a 100(1-\(\alpha\))% confidence interval.

  • To test \(H_0: \mu \geq \mu_0, \quad H_a: \mu < \mu_0\), at level \(\alpha/2\), use a 100(1-\(\alpha\))% confidence interval.

  • \(H_0: \mu = \mu_0, \quad H_a: \mu \neq \mu_0\), at level \(\alpha\), use a 100(1-\(\alpha\))% confidence interval.