curve(dt(x, df=5), xlim=c(-6,6),
main=paste("Student t-Distribution Probability Density Function, df = ", 5, ")", sep=""),
type="n", las=1, ylab="probability", xlab="t")
Shade(FUN="dt(x, df=5)", xlim=c(-6, qt(0.025, df=5)), col="red")
Shade(FUN="dt(x, df=5)", xlim=c(qt(0.025, df=5), qt(0.975, df=5)), col="green")
Shade(FUN="dt(x, df=5)", xlim=c(qt(0.975, df=5), 6), col="red")
Run the code above in your browser using DataLab