Professional Documents
Culture Documents
TECHNIQUES - II
Dr. Pritha Guha
Problem Number of Frequency (Oi )
observed defects
• X: the no. of defects in pages of a
(i)
book.
• A random sample of size n = 60 pages 0 32
is taken.
• The number of defects are
𝑋1 , 𝑋2 , ⋯ , 𝑋60 , classified as follows:
1 15
• Can this data be modelled by a
Poisson distribution?
2 9
3 4
Solution:
መ 𝜆መ = 1
• Need to estimate 𝜆, 0 × 32 + 1 × 15 + 2 × 9 + 3 × 4 = 0.75
60
0 32 𝑒 0.75 × 0.75 0
60 × = 28.34199
0!
1 15 𝑒 0.75 × 0.75 1
60 × = 21.25649
1!
2 9 𝑒 0.75 × 0.75 2
60 × = 7.971186
2!
≥3 4 60 − 28.34199 − 21.25649 − 7.971186
= 2.430334
Total 60 60
Solution:
• Expected frequency cannot be less than 5, combine the last two classes, then all Ei > 5.
• d=k-m-1=3-1-1=1.
• Suppose α=0.05
0 32 28.34199
1 15 21.25649
≥2 13 10.40152
Total 60 60
Test for Goodness of Fit for a Normal Distribution
• Example from Text (Pg. 509)
• Data: X: Mileage of 50 cars (see Text, Table 1.7, Pg. 15 and data set GasMiles.csv)
• Does this data set come from a normal distribution?
Class 𝑶𝒊 𝑬𝒊
2 12−10 2 6−10 2 12−10 2 9−10 2 11−10 2
𝜒𝑜𝑏𝑠 = + + + + = 2.6
(29.09492- 30.88864] 12 10 10 10 10 10 10
d = k-m-1 = 5-2-1=2
(30.88864-31.35790] 6 10
(31.35790-31.76210] 12 10
(31.76210-32.23136] 9 10
(32.23136-34.02508] 11 10
qqnorm(Mileage, ylab = "Mileage", col = "dark green", pch = 19)
qqline(Mileage, col = "red")
• shapiro.test(Mileage)
In R
TEST OF INDEPENDENCE
Problem
• A recent study of gender preferences among car shoppers found that men and women equally
favour automatic transmission cars.
• A marketing analyst doubts these results. He believes that a person's gender influences
whether he or she purchases an automatic transmission car.
• He collects data on 400 recent car purchases cross-classified by gender and type of
transmission type of the car (automatic transmission versus manual transmission).
• The results are as follows:
Computation:
• Test Statistic:
2
𝑂𝑖𝑗 − 𝐸𝑖𝑗
𝜒𝑜2 =
𝐸𝑖𝑗
𝑎𝑙𝑙 𝑐𝑒𝑙𝑙𝑠
2
• 𝜒𝑜2 ~𝜒𝑑 , where 𝑑 = 𝑟−1 𝑐−1
• Reject 𝐻0 at level of significance α if
2
• 𝜒𝑜2> 𝜒𝑑;𝛼
• p-value < α
Problem Continued: Null and Alternative
• Does the sample data support the marketing analyst's claim? Consider level of significance
as 10%.
Male 𝑟2 𝑐1 𝑟2 𝑐2
𝐸11 = = 𝐸11 = =
𝑛 𝑛
Problem Continued: Test Statistic
Automatic Cars Manual cars
Female 46.75 63.25
• 𝜒𝑜2 =
Problem Continued: Conclusion
• d=
• α=
• Con1 = table(Gender_Car$Gender, Gender_Car$CarTransmission)
• chisq.test(Con1, correct = FALSE)
In R
NON-PARAMETRIC TESTS
Why Non-parametric tests are required?
In R