Some have argued that the F test for equality of variances should be used to decide whether to use the pooled t-test or the non-pooled t-test. Others have argued that the variances should never be assumed to be exactly equal, and the non-pooled t-test should always be used. You will explore this here via simulation.
We will consider testing the following hypotheses (using either a pooled or a non-pooled t-test) at the 5% level.
H0:m1-m2= 0
H1:m1-m2¹0
Assume that we take independent simple random samples of size 20 from each of two populations. The populations are N(0,12) and a N(m,52). Use a simulation-based method to plot the power curves for the pooled and non-pooled t-tests (on the same graph) as a function of a sequence ofmvalues from -5 to 5.
Use the following R code to plot the power functions (based on simulation) for this test when conditioning on the true difference in means.
mu.vals
nsim
reject.mat.pooled
reject.mat.nonpooled
for (i in 1:length(mu.vals)){
sim.mat1
sim.mat2
reject.mat.pooled[i,]
pval1
reject.mat.nonpooled[i,]
pval1
}
power.vals.pooled
power.vals.nonpooled
plot(c(-5,5),c(0,1),type="n",xlab="True Difference in Means",ylab="Approx Prob of Rejecting")
lines(mu.vals,power.vals.pooled)
lines(mu.vals,power.vals.nonpooled,col="blue",lty=2)
abline(h=.05,lty=2,col="red")
2b) In this scenario, which test would you recommend using, the pooled or non-pooled test? Justify your answer and base your answer on the power curves plotted above?
2c) Now, assume that the two populations are N(0,12) and a N(m,12). Use a simulation-based method to plot the power curves for the pooled and non-pooled t-tests (on the same graph) as a function of a sequence ofmvalues from -5 to 5. You will want to modify the above R code.
2d) When the populations are N(0,12) and a N(m,12), which test would you recommend using, the pooled or non-pooledP test? Why? Base your answer on the power curves plotted above?