1. Generate 40 samples of 7 observations from a population that is normal with m
ID: 3251996 • Letter: 1
Question
1. Generate 40 samples of 7 observations from a population that is normal with mean 100 and standard deviation 12. For each sample do a 1-sample t-test of H0:µ100 using =.2. Mark each time you rejected H0. Since you know H0 is true, each time you rejected H0 a type I error was made. Estimate the probability of a type I error.
2. Repeat the above, but this time generate observations from a population with mean 105 and standard deviation 12. (when you do the tests leave, H1: µ100.) Again mark each time you rejected H0 this time, since H1 is true, each time you failed to reject H0 a type II error was made. Estimate the probability of a type II error.
3. Repeat Problem 1 with n=28.
4. Repeat Problem 2 with n=28.
Follow-up Questions
A. What should have happened to the estimated probability of a type I error as n increased? Why?
B. What Happened to the estimated probability of a type II error as n increased? Why?
C. what can we conclude about doing a hypothesis test when n is small?
Explanation / Answer
[software R is used for the simulation]
the R code is as follows
size=40
n=7
alpha=0.2
# question 1
x=array(dim=1)
k=0
for(i in 1:size)
{
x=rnorm(n,100,12)
t=(mean(x)-100)*sqrt(n)/12
if(abs(t)>qt(1-alpha/2,n-1))
k=k+1
}
p1=k/size #p1=probability of type 1 error
p1
#question 2
x=array(dim=1)
p=0
for(i in 1:size)
{
x=rnorm(n,105,12)
t=(mean(x)-100)*sqrt(n)/12
if(abs(t)<qt(1-alpha/2,n-1))
p=p+1
}
p2=p/size #p1=probability of type 2 error
p2
n=28
#question 3
x=array(dim=1)
k=0
for(i in 1:size)
{
x=rnorm(n,100,12)
t=(mean(x)-100)*sqrt(n)/12
if(abs(t)>qt(1-alpha/2,n-1))
k=k+1
}
p1=k/size #p1=probability of type 1 error
p1
#question 4
x=array(dim=1)
p=0
for(i in 1:size)
{
x=rnorm(n,105,12)
t=(mean(x)-100)*sqrt(n)/12
if(abs(t)<qt(1-alpha/2,n-1))
p=p+1
}
p2=p/size #p1=probability of type 2 error
p2
the outputs are
p1=0.15 [problem 1]
p2=0.6 [problem 2]
p1=0.15 [problem 3]
p2=0.15 [problem 4]
A. the estimated probability of type 1 error should decrease as n increased. because as n increases the sample mean would concentrate near the null hypothesized mean as here null hypothesis is ssumed to be true. hence the chance of rejecting H0 decreases because the test statistic value becomes very small.
B. the estimated probability of type 2 error should decrease as n increases. because as n increases the sample mean would concentrate near the alternative hypothesized mean as here alternative hypothesis is ssumed to be true. hence the chance of accepting H0 decreases because the test statistic value becomes large
C when n is small the conclusion that is made is not very efficient. because when n is small then the deviation of the sample values is large. the sample is not a good representative of the population. hence the testing becomes less efficient
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.