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:yousayitsmalignantwhenitsactuallybenign.Thisisbadbecausethepatientmightgetunnecessarytreatment.TypeIIerror:yousayitsbenignwhenitsactuallymalignant.Thisisbadbecausethepatientmightnotgetnecessarytreatment.Theresaseesaweffect,ifyoudecreasetheprobabilityofonetypeoferror,youincreasetheprobabilityoftheothertypeoferror.Example:Supposewehave$X$whichisthenumberofheads.$XBin(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$Wedonthavemuchevidencetosaythecoinisbiasedtowardsheads,becauseweonlygot1and2headsoutof6flips.Supposewegetextremecases:$TTTHHH$Hereweget$0$andthen$3$.Sowehavemoreevidencetosaythecoinisbiasedtowardsheads,becausewegot3headsoutof6flips.Ourcriticalregionis$X={0,3}$RejectionRegion.Howdowesolveitmathematically?$P(X=x)=(3x)px(1p)3xx=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(XRR|p=23)$$=P(X0|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(XRR|p=23)$$=P(X3|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:
- YBin(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 |Y18|4.
- What is α and β if p=0.7?
- α=P(reject H0|Ha is true)
- =P(|Y18|4|p=0.5)
- =P(Y22|p=0.5)+P(Y14|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(XRR|p=0.7)
- =P(|Y18|<4|p=0.7)
- =P(3Y183|p=0.7)
- =P(15y21|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,,YniidN(μ,σ2)
- Y¯μ0snt(n1)
- Decision rule: reject H0 if Y¯μ0+t(α;n1)sn
- α=P(T>t(α;n1))
- 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μ0Y¯Zα2σnμ0
- α=P(Y¯hY¯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)