11. One sample inference
11. One sample inference
4
σ = 3.9
€
Y −µ Y −µ
€ We only have a
sample.
t= =
SE Y s/ n
Y = 67.1 s = 3.1
s 3.1
SE Y = = = 1.4
n 5
€ €
We use this as an
estimate of σ Y
€
€
t has a Student’s t €
distribution Degrees of freedom
Discovered by William Gossett, of
the Guinness Brewing Company
df = n - 1
}
Y −µ
Z=
σY
Y −µ
t= Z t9
SE Y
€
We use the t-distribution to calculate a 95% confidence interval for a
confidence interval of the mean mean
Example:
Y −µ Paradise flying snakes
−tα ( 2),df < < tα ( 2),df
SE Y
We rearrange the above to generate:
€
Estimate the mean and standard
deviation
Y = 1.375
https://www.youtube.com/watch?v=16aGSx9gFO4
s = 0.324
n=8
€
Find the critical value of t
Find the standard error
df = n − 1 = 7
Y ± SE Y tα ( 2),df
tα ( 2),df = t 0.05( 2),7
= 2.36
s 0.324
SE Y = = = 0.115
n 8
t.test(undulationRate)$conf.int
[1] 1.104098 1.645902 df s2 2 df s2
attr(,"conf.level") 2
≤σ ≤ 2
[1] 0.95 χα χ α
,df 1− ,df
2 2
t.test(undulationRate,
conf.level = 0.99)$conf.int
[1] 0.9740838 1.7759162
attr(,"conf.level") €
[1] 0.99
2.5%
α = 0.05 95% confidence interval for the variance
of flying snake undulation rate
2.5%
Frequency
df s2 2 df s2
2
≤σ ≤ 2
χα χ α
,df 1− ,df
2 2
df = n - 1 = 7
χ2
χ2 1- α/2 χ2 α/2 € s2 = (0.324)2 = 0.105
χ α2 2
= χ 0.025,7 = 16.01
,df
2
χ2 α 2
= χ 0.975,7 = 1.69
1− ,df > qchisq(0.025,df=7,lower.tail=FALSE)
2
[1] 16.01276
Table A
df > qchisq(0.975,df=7,lower.tail=FALSE)
X 0.999 0.995 0.99 0.975 0.95 0.05 0.025 0.01 0.005 0.001 [1] 1.689869
1 1.6 3.9E-5 0.00016 0.00098 0.00393 3.84 5.02 6.63 7.88 10.83
E-6
€
2 0 0.01 0.02 0.05 0.1 5.99 7.38 9.21 10.6 13.82
3 0.02 0.07 0.11 0.22 0.35 7.81 9.35 11.34 12.84 16.27
4 0.09 0.21 0.3 0.48 0.71 9.49 11.14 13.28 14.86 18.47
5 0.21 0.41 0.55 0.83 1.15 11.07 12.83 15.09 16.75 20.52
6 0.38 0.68 0.87 1.24 1.64 12.59 14.45 16.81 18.55 22.46
7 0.6 0.99 1.24 1.69 2.17 14.07 16.01 18.48 20.28 24.32
8 0.86 1.34 1.65 2.18 2.73 15.51 17.53 20.09 21.95 26.12
95% confidence interval for the variance One-sample t-test
of flying snake undulation rate
2 2
7 (0.324 ) 7 (0.324 )
≤σ2 ≤
16.01 1.69
0.0459 ≤ σ 2 ≤ 0.435
df = n – 1 = 23
A portion of the t table
t.test(bodyTempSmallData$temperature, mu =
98.6)
Y − µ0 98.25 − 98.6 €
t is further out in the tail than the critical value, so we
t=€ = = −5.44 could reject the null hypothesis. Human body
s / n 0.733/ 130 temperature is not 98.6ºF. P = 2.4 x 10–7
€