STA258 Lecture 12

&\text{True State of Nature} \
\text{Decision} & H_{0}\text{ is True} & H_{a}\text{ is True} \
\text{Reject }H_{0} & \underbrace{\text{Type I Error}} _{\alpha} & \underbrace{\text{Correct Decision}} _{1-\beta} \
\text{Accept } H*{0} & \underbrace{\text{Correct Decision}} _{1-\alpha} & \underbrace{\text{Type II Error}} _{\beta}
\end

−Significanceoftheseerrors:−Youhaveamachinelearningalgotodetectifatumorismalignantorbenign.−TypeIerror:yousayit′smalignantwhenit′sactuallybenign.Thisisbadbecausethepatientmightgetunnecessarytreatment.−TypeIIerror:yousayit′sbenignwhenit′sactuallymalignant.Thisisbadbecausethepatientmightnotgetnecessarytreatment.−There′saseesaweffect,ifyoudecreasetheprobabilityofonetypeoferror,youincreasetheprobabilityoftheothertypeoferror.−Example:−Supposewehave$X$whichisthenumberofheads.−$X∼Bin(n=3,p)$−$H0=p=12$−Commonbelief.−$Ha=p=23$−Wewanttotestifthecoinisbiasedtowardsheads.−Weightedcoin.−Whatvaluesof$X$wouldyouassigntotherejectionregionifyouwishtohavetheprobabilityofatypeIerrorof$α≤18$andtominimize$β$correspondingtothevalueof$α$selected.−$P(X=3)=(12)3=18$−Sowecanassign$X=3$totherejectionregion.−Supposewegetthis:−$TTHHTH$−Wedon′thavemuchevidencetosaythecoinisbiasedtowardsheads,becauseweonlygot1and2headsoutof6flips.−Supposewegetextremecases:−$TTTHHH$−Hereweget$0$andthen$3$.Sowehavemoreevidencetosaythecoinisbiasedtowardsheads,becausewegot3headsoutof6flips.−Ourcriticalregionis$X={0,3}$−RejectionRegion.−Howdowesolveitmathematically?−$P(X=x)=(3x)px(1−p)3−xx=0,1,2,3$−Computeprobabilities:−$x0123P(X=x|p=12)18383818P(X=x|p=23)1276271227827$−Whatvaluesdoyouassigntorejectionif$α≤18$−Lookatthe$H0$row.−Weseetwovalues$≤18$−Sowesee$x=0,3$−$x=0$−$β=P(accept H0|H0 is wrong)=P(accept H0|Ha is true)$−$=P(X∉RR|p=23)$−$=P(X≠0|p=23)$−$=P(X=1|p=23)+P(X=2|p=23)+P(X=3|p=23)$−$=627+1227+827=2627$−$x=3$−$β=P(accept H0|Ha is true)$−$=P(X∉RR|p=23)$−$=P(X≠3|p=23)$−$=P(X=0|p=23)+P(X=1|p=23)+P(X=2|p=23)$−$=127+627+1227=1927$−Summary−$$X=0α=18β=26271−β=127X=3α=18β=19271−β=827

- This shows the second rejection region is stronger.
- Example:
- Y∼Bin(n=36,p)
- H0:p=0.5
- Ha:p=0.7
- If it's more than 12, it's biased.
- Let's say 2236=1118=0.611111111111111 is the threshold for the rejection region.
- If we choose the critical region to be |Y−18|≥4.
- What is α and β if p=0.7?
- α=P(reject H0|Ha is true)
- =P(|Y−18|≥4|p=0.5)
- =P(Y≥22|p=0.5)+P(Y≤14|p=0.5)
- Use R
- 1-pbinom(21,36,0.5)+pbinom(14,36,0.5)
- 0.242985
- Answer from prof ≈0.2428
- β=P(retain H0|Ha is true)
- =P(X∉RR|p=0.7)
- =P(|Y−18|<4|p=0.7)
- =P(−3≤Y−18≤3|p=0.7)
- =P(15≤y≤21|p=0.7)
- Use R
- pbinom(21,36,0.7)-pbinom(14,36,0.7)
- 0.09155433
- Answer from prof ≈0.0915
- β<α
- Usually we prioritize minimizing α over β, because we want to minimize the probability of making a type I error, which is usually more severe than making a type II error.
- α<0.1 and β<0.2 are normally good.
- Example:
- Large sample test for mean
- H0:μ=μ0 where μ0 is given
- Ha:μ>μ0
- Reject H0 in favour of Ha if Y¯≫μ0
- Decision rule: reject H0 if Y¯≥μ0+Zασn
- Back to the previous example we can get that 72+1.96σn is our point at which we reject.
- Under normality:
- Y1,…,Yn∼iidN(μ,σ2)
- Y¯−μ0sn∼t(n−1)
- Decision rule: reject H0 if Y¯≥μ0+t(α;n−1)sn
- α=P(T>t(α;n−1))
- What if we have two sided alternative hypothesis?
- H0:μ=μ0
- Ha:μ≠μ0
- Decision rule: reject H0 if |Y¯−μ0|≥Zα2σn
- Zα2σn−μ0≤Y¯≤Zα2σn−μ0
- α=P(Y¯≤h∪Y¯≥k|H0 is true)
- =P(Y¯≤h|H0 is true)+P(Y¯≥k|H0 is true)
- Let the both terms be α2
- Decision rule: reject H0 if |Y¯−μ0|≥Zα2σn
- In case of acceptance:
- Accept H0 if |Y¯−μ0|<Zα2σn
- This is the same as the confidence interval for the mean.
- Accept H0 if μ0∈(Y¯−Zα2σn,Y¯+Zα2σn)