# Now in the book setting we are only proving "Guilty" or "Not Guilty". The reason is usually that there is one exact hypothesis (that we call the Null and is an articulation of the "Status Quo") #H0: p= p0. # and an Alternate Hypothesis in the following form # H1: p != p0, H1: p > p0, or H1: p < p0, # Hence by H1's nature it includes thing like p=p0 plus or minus say 10^(-100) which we would have no hope of distinguishing from p=p0 for any feasible N (using simulation or the real word). So, to borrow a phrase form the book we can only conclude "guilty" or "not guilty". ######## # With no BELIEFS about the test it very hard to make sense out of the results and extremely hard to design a good test. The book avoids this by being incredibly cagey when interpreting the results. #cagy # 1 : hesitant about committing oneself # 2 a : wary of being trapped or deceived : SHREWD b : marked by cleverness # Another way is to approach problems with an articulation of your BELIEFS. Here is an example, where the key notion of a Power Parameter is developed. ######### # Example. We are to collect "(red)/(not red)" data form an American Roulette wheel that we feel might be biased/loaded. Hence: #H0: p= p0=18/38 #H1: p ! = p0 # Our first goal is to attempt to find a p1!=p0 that satisfies a.... # SYMMETRY BELIEF: We would like a p1!=0 and a test where the risk associated to rejecting p=p0 when p=p0 is true is the same as the risk associated to not rejecting p=p1 if p=p1 happens to be true. # Such a p1 is what we will call our Power Parameter. Often it is simply the closest parameter to p0 that has any "practical significance". For a two sided test we may have to deal with a p1 below p0 and another and above p1 above p0. # In our case, p1=19/38 would make red a "fair bet" and hence a deviation of 1/38 would certainly have practical significance to us. With this choice of p1 we can now mimic our May 3rd discussion of a H0:p=p0 & H1:p=p1 test under the SYMMETRY BELIEF to find a suitable pstar, N and alpha. In other words, with our choice of p1 in hand we can attempt to balance our risks and costs to find a good N and alpha. Notice, if the test is two sided we must use set betap1=alpha/2 where beta1p1 is the beta form the May 3 discussion and where alpha is chance of a type one error in our current H0: p= p0=18/38 & H1: p ! = p0 test. # Notice this gives us some extra flexibility. Namely, if the experiment is too expensive for the largest acceptable beta, then we can give up some p1. The price will be that there WILL EXIST practically significant values of p!=p0 that our test will not be very powerful at discovering. # With our choice of Power Parameter p1 we find the following relationship between alpha and N. p0=18/38 p1=19/38 q0=1-p0 q1=1-p1 N0=20000 Npict=seq(1,N0,by=100) zpict = abs(sqrt(Npict)*((p1-p0)/(sqrt(p0*q0)+sqrt(p1*q1)))) betapict=pnorm(-zpict,0,1) alphapict=2*betapict plot(Npict,alphapict,type="l",main="Prob(Error) as a function of Sample Size",xlab="Sample Size",ylab="Probability") points(c(1,N0),c(.05,.05),type="l",col="red") points(c(1,N0),c(.1,.1),type="l",col="red") points(c(1,N0),c(.01,.01),type="l",col="red") #Recall we can compute N from alpha and alpha from N. N=5000 z = abs(sqrt(N)*((p1-p0)/(sqrt(p0*q0)+sqrt(p1*q1)))) alpha=2*pnorm(-z,0,1) alpha alpha=0.05 beta=alpha/2 N= ceiling((qnorm(beta,0,1)*(sqrt(p0*q0)+sqrt(p1*q1))/((p1-p0)))^2) N # Exercise: Determine an N and alpha and hence whether our p1 is economically feasible to use. If not, then one may have to experiment a bit a larger p1 and then decide whether such an experiment would still be worth our while. ############## # Before running the test one should get a sense for the risk one is taking of a type one error for various parameters where p!=p0 other than just the Power parameter. The nicest way is via the Power Curve. We've determined N and can (for our too sided test) find upper and lower critical values, pstaru and pstarl, as follows: N=5540 pstarl=p0-((p1-p0)/(sqrt(p0*q0)+sqrt(p1*q1)))*sqrt(p0*q0) pstaru=p0+((p1-p0)/(sqrt(p0*q0)+sqrt(p1*q1)))*sqrt(p0*q0) # The Power Curve is P(! D0 | p=p1) = P(pstaru < N(p1,sqrt(p1*q1/N))+P(pstarl > N(p1,sqrt(p1*q1/N)) p=seq(.4,.6,by=.001) q=1-p zl=(pstarl - p)/sqrt(p*q/N) zu=(pstaru - p)/sqrt(p*q/N) Pow=pnorm(zl,0,1)+(1-pnorm(zu,0,1)) plot(p,Pow,type="l",main="A Typical Power Curve",xlab="p=p1",ylab="Power") #Exercise: What is the powers minimum? and why? min(Pow) # For what power parameter are we really safe? p=.5 q=1-p zl=(pstarl - p)/sqrt(p*q/N) zu=(pstaru - p)/sqrt(p*q/N) Pow=pnorm(zl,0,1)+(1-pnorm(zu,0,1)) Pow ######### # Now we can run the test with a good sense for what we are doing. Do it! # Exercise: State your results. Notice we cannot possibly accept the Null Hypothesis since our p1=(p0+10^(-100)) satisfies p1!=p0. But we can reject it. We also my feel comfortable retaining it, and this was another asset of using a power parameter. State the P-value and an appropriate confidence interval to help people interpret the result.