R program for right tailed test based on 50000 replication
nsim=50000
f=function(n,p)
{
t=numeric(nsim)
s=0
for(i in 1:nsim)
{
x=rbinom(1,n,p)
p.hat=x/n
t[i]=sqrt(n)*(p.hat-p)/sqrt(p*(1-p))
if(t[i]>1.645)
s=s+1
else
s=s+0
}
erate=s/nsim
cat("\n","n=",n,",p=",p,",Type I error rate=",round(erate,3))
return(0)
}
R Output
n= 10 ,p= 0.01 ,Type I error rate= 0.098[1] 0
n= 10 ,p= 0.1 ,Type I error rate= 0.069[1] 0
n= 10 ,p= 0.25 ,Type I error rate= 0.078[1] 0
n= 10 ,p= 0.5 ,Type I error rate= 0.054[1] 0
n= 50 ,p= 0.01 ,Type I error rate= 0.09[1] 0
n= 50 ,p= 0.1 ,Type I error rate= 0.058[1] 0
n= 50 ,p= 0.25 ,Type I error rate= 0.057[1] 0
n= 50 ,p= 0.5 ,Type I error rate= 0.059[1] 0
n= 100 ,p= 0.01 ,Type I error rate= 0.08[1] 0
n= 100 ,p= 0.1 ,Type I error rate= 0.072[1] 0
b. We observe that as n increases, type I error rate stabilises near the nominal level 5%.
When Ho: p = 0.25 is true and n = 10 only, the probability of cornmitting Type I error is about 0...
03)-3+3 1 A3-sigma control chart is to be developed for P 0.40 and n 80. (a)- What are the control limits? (b) Determine the probability of a type I error. Determine the probability of a type II error if p shifts to 0.50 d) I0.25 and P, 0.57 on any periods of inspection, do they correspond to an out of control point? Explain. 03)-3+3 1 A3-sigma control chart is to be developed for P 0.40 and n 80. (a)- What...
To test Ho: p=0.35 versus Hy:p>0.35, a simple random sample of n = 200 individuals is obtained and x = 69 successes are observed. (a) What does it mean to make a Type Il error for this test? (b) If the researcher decides to test this hypothesis at the a = 0.01 level of significance, compute the probability of making a Type II error, B, if the true population proportion is 0.38. What is the power of the test? (c)...
Probability and I A recent Gallup Poll asked a simple random sample o cigarettes in the past week?" Suppose that in fact 20 question. The proportion of the sample who answer this, we simulated 1000 samples of size n=1600 from a populatie smoked cigarettes in the past week. The results of this simula the percentage column and write your answers as decimals done for you as an example.) om sample of 1600 American adults, "Have you, yourself smoked any ose...