Skip to content

To be completed....

Hypothesis Testing Introduction

Reject H0Fail to reject H0
H0 is TrueType I Error
H0 is FalseType II Error

1 hidden cell
Example. General picture: Type I Error
Hidden code
Example. General picture: Type II Error
t.test_plot(null.mean=20, null.sd=5,
		     alt.mean=21.5,  alt.sd=15, n=70,
 		    alpha=.05)
Example. Power of test vs Significance of test
par(mfrow=c(2,2))
for (alpha in (.2-.06*(0:3))) {
	t.test_plot(null.mean=20, null.sd=7,
			     alt.mean=21.5,  alt.sd=8,
				n=70, alpha=alpha,
 			    legend=FALSE)
}
Example. t-test output from R and underlying graphs
observations <- rnorm(50,22,5)

t.test(observations,mu=20)

t.test_plot(observations,null.mean=20)
Example. Increasing n for hypothesis test
par(mfrow=c(2,2))
for (n in (40+20*(0:3))) { 
	t.test_plot( null.mean=20, alt.mean=22, null.sd=8, n=n, legend=FALSE) 
}
Example. Decreasing sample variance for hypothesis test
par(mfrow=c(2,2))
for (sd in (8-(0:3))) { 
	t.test_plot( null.mean=20, alt.mean=22, alt.sd=sd, n=50, legend=FALSE) 
}