Inference on the mean and variance of a Normal population
2026-10-26
Throughout let \(X_1,\dots,X_n \overset{\operatorname{ind}}{\sim} \mathcal{N}(\mu,\sigma^2)\).
In this lecture we review how to:
We call \(X_1,\dots,X_n\) a random sample.
A class of \(n = 27\) students measured \(B/A\) on themselves:
What is the true mean of \(B/A\)? Could it be the golden ratio?!?
Check if \(B/A\) measurements come from a Normal distribution.
Based on \(X_1,\dots,X_n\), define the sample statistics
Then \(\bar X_n\) and \(S_n^2\) are unbiased estimators of \(\mu\) and \(\sigma^2\), respectively.
We have \(\bar X_n =\) mean(gr) \(= 1.565\) and \(S_n^2 =\) var(gr) \(= 0.022\).
Provided \(X_1,\dots,X_n \overset{\operatorname{ind}}{\sim} \mathcal{N}(\mu,\sigma^2)\), we have
Relate these to the results on the previous slide.
The sampling distribution results give \((1-\alpha)100\%\) CIs as
Derive the above.
Build \(95\%\) CIs for population mean and variance of \(B/A\) values:
The \(95\%\) CI for \(\mu\) is \([1.506,1.623]\). For \(\sigma^2\) it is \([0.014,0.041]\).
Consider testing hypotheses about \(\mu\) of the form \[ \begin{array}{lclcl} H_0\text{: } \mu \geq \mu_0 &\text{ or } & H_0\text{: } \mu = \mu_0 &\text{ or } & H_0\text{: } \mu \leq \mu_0\\ H_1\text{: } \mu < \mu_0 && H_1\text{: } \mu \neq \mu_0 && H_1\text{: } \mu > \mu_0. \end{array} \] Reject or fail to reject \(H_0\) based on the value of the test statistic \[ T_{\operatorname{test}}= \frac{\bar X_n - \mu_0 }{S_n / \sqrt{n}}. \] Rejection rules for the above at significance level \(\alpha\) are \[ \begin{array}{lclcl} T_{\operatorname{test}}< -t_{n-1,\alpha} &\text{ or } & |T_{\operatorname{test}}| > t_{n-1,\alpha/2}&\text{ or } & T_{\operatorname{test}}> t_{n-1,\alpha}. \end{array} \]
The corresponding p-values are, with \(T \sim t_{n-1}\), the probabilities \[ \begin{array}{lclcl} P(T < T_{\operatorname{test}}) &\text{ or } & 2 \times P(T > |T_{\operatorname{test}}|) & \text{ or } & P(T > T_{\operatorname{test}}). \end{array} \]
Test \(H_0\): \(\mu = 1.618\) vs \(H_1\): \(\mu \neq 1.618\) at \(\alpha = 0.05\) based on data.
Fail to reject \(H_0\) since \(T_{\operatorname{test}}= -1.866\) is smaller in absolute value than \(t_{n-1,\alpha/2} = 2.056\).
Equivalently, the p-value, which is 0.073, is greater than \(\alpha = 0.05\).
Demonstrate the t.test() function in R:
The function t.test() tests \(H_0\): \(\mu = 0\) vs \(H_1\): \(\mu \neq 0\) by default.
Now test \(H_0\): \(\mu = 1.618\) versus \(H_1\): \(\mu \neq 1.618\), ask for 99% CI.
Now test \(H_0\): \(\mu \leq 1.618\) versus \(H_1\): \(\mu > 1.618\).
Consider testing hypotheses about \(\sigma^2\) of the form \[ \begin{array}{lcl} H_0\text{: } \sigma^2 \geq \sigma^2_0 &\text{ or } & H_0\text{: } \sigma^2 \leq \sigma^2_0 \\ H_1\text{: } \sigma^2 < \sigma^2_0 && H_1\text{: } \sigma^2 > \sigma^2_0 \end{array} \] Reject or fail to reject \(H_0\) based on the value of the test statistic \[ W_{\operatorname{test}}= \frac{(n-1)S_n^2 }{\sigma_0^2}. \] Rejection rules for the above at significance level \(\alpha\) are \[ \begin{array}{lclcl} W_{\operatorname{test}}< \chi^2_{n-1,1-\alpha} &\text{ or } & W_{\operatorname{test}}> \chi^2_{n-1,\alpha} \end{array} \]
The corresponding p-values are, with \(W \sim \chi^2_{n-1}\), the probabilities \[ \begin{array}{lclcl} P(W < W_{\operatorname{test}}) & \text{ or } & P(W > W_{\operatorname{test}}). \end{array} \]
Test \(H_0\): \(\sigma^2 \geq 0.03\) vs \(H_1\): \(\sigma^2 < 0.03\) at \(\alpha = 0.05\) based on data.
Fail to reject \(H_0\) since \(W_{\operatorname{test}}= 19.009\) exceeds \(\chi_{n-1,1-\alpha}^2 = 15.379\).
Equivalently, the p-value, which is \(0.164\), is greater than \(\alpha = 0.05\).
The weights in lbs of several wooden pallets were recorded.
We can choose a sample size based on the desired:
A CI for \(\mu\) takes the form \(\bar X_n \pm M\), where
For ease, use the “\(\sigma\)-known” version.
If one wants \(M \leq M^*\), find smallest \(n\) such that \(\displaystyle z_{\alpha/2}\frac{\sigma}{\sqrt{n}} \leq M^*\).
So take \(\displaystyle n = \left\lceil \left(\frac{z_{\alpha/2}\sigma}{M^*}\right)^2\right \rceil\), where \(\lceil \cdot \rceil\) rounds up.
Must put in a guess for \(\sigma\).
Find \(n\) required to make the \(95\%\) CI for \(\mu\) no wider than \(0.08\).
The required sample size is \(53\).
The power of a test is the probability with which it rejects \(H_0\).
For tests of \(H_0\) concerning the mean \(\mu\) we write the power as \[ \gamma(\mu) = P(\text{Reject $H_0$ when true mean is $\mu$}) = P_\mu(\text{Reject $H_0$}). \]
So the power depends on the true value of \(\mu\), i.e. is a function of \(\mu\).
Derive the power functions for the tests of \[ \begin{array}{lclcl} H_0\text{: } \mu \geq \mu_0 &\text{ and } & H_0\text{: } \mu = \mu_0 &\text{ and } & H_0\text{: } \mu \leq \mu_0\\ H_1\text{: } \mu < \mu_0 && H_1\text{: } \mu \neq \mu_0 && H_1\text{: } \mu > \mu_0 \end{array} \] with the rejection rules \[ \begin{array}{lclcl} Z_{\operatorname{test}}< -z_\alpha &\text{ and } & |Z_{\operatorname{test}}| > z_{\alpha/2}&\text{ and } & Z_{\operatorname{test}}> z_\alpha, \end{array} \] respectively, where \(\displaystyle Z_{\operatorname{test}}= \frac{\bar X_n - \mu_0}{\sigma/\sqrt{n}}\) (\(\sigma\)-known case).
Set \(\mu_0 = 1.618\), \(n = 27\), and \(\alpha = 0.05\) and use \(\sigma = 0.148\).
alpha <- 0.05
mu0 <- 1.618
sigma <- sd(gr)
n <- length(gr)
mu <- seq(mu0-4*sigma/sqrt(n),mu0+4*sigma/sqrt(n),length=500)
za <- qnorm(1-alpha)
za2 <- qnorm(1-alpha/2)
d <- sqrt(n) * (mu - mu0) / sigma
rp <- 1 - pnorm(za - d)
lp <- pnorm(-za - d)
rp2 <- 1 - pnorm(za2 - d)
lp2 <- pnorm(-za2 - d)
tsp <- lp2 + rp2Test \(H_0\): \(\mu \leq 1.618\) vs \(H_1\): \(\mu > 1.618\). Use \(\alpha = 0.05\) and \(\sigma = 0.148\).
alpha <- 0.05
mu0 <- 1.618
sigma <- sd(gr)
n <- length(gr)
mu <- seq(mu0-1*sigma/sqrt(n),mu0+4*sigma/sqrt(n),length=500)
za <- qnorm(1-alpha)
# various sample sizes
nn <- c(10,20,30,40,50,60)
rp <- matrix(NA,500,length(nn))
for(j in 1:length(nn)){
d <- sqrt(nn[j]) * (mu - mu0) / sigma
rp[,j] <- 1 - pnorm(za - d)
}To find the smallest sample size guaranteeing a desired power:
For our tests concerning \(\mu\) when \(\sigma\) is known, we obtain:
In the above \(\beta^* = 1 - \gamma^*\).
Derive the sample size formula for the test of \[ \text{$H_0$: $\mu \leq \mu_0$ vs $H_1$: $\mu > \mu_0$} \] when \(\sigma\) is known.
Suppose the true mean of \(B/A\) in the population is \(1.65\).
Give the sample size \(n\) required to reject \(H_0\): \(\mu \leq 1.618\) vs \(H_1\): \(\mu > 1.618\) with power \(\geq 0.80\). Use \(S_n = 0.148\) as a guess of \(\sigma\).
The required sample size is \(133\).