# NOT RUN {
par( mfrow=c(3,3) )
shadeDist( qnorm(0.975), "dnorm", 0, 1 ) # P(Z<1.96) where Z ~ N(0,1)
shadeDist( qnorm(0.975), lower.tail=FALSE ) # P(Z>1.96) where Z ~ N(0,1)
# P(40<X<60) where X~N(mu=50,sigma=10)
shadeDist( c( 40, 60 ), , 50, 10, lower.tail=FALSE, col=c("black", "lightblue") )
shadeDist( c( 40, 60 ), "dnorm", 50, 10, col=c("purple", "lightgreen") )
shadeDist( 6.8, "dchisq", 4, lower.tail=FALSE ) # Chi-squared distribution with 4 d.f.
shadeDist( c( -1.3, 1.3 ), "dt", 13 ) # t with 13 d.f.
shadeDist( 1.19, "dt", 15, 3, lower.tail=FALSE ) # t with 15 d.f. and non-centrality parameter=3
shadeDist( 2.1, "df", 4, 25, lower.tail=FALSE, col=c("hotpink","turquoise") ) # F with 4 and 25 d.f.
shadeDist( 0.6, "dprop", 20, 0.7, xmin=0.4 ) # Probability for sample proportion with n=20 and p=0.7
par( mfrow=c(1,1) )
# }
Run the code above in your browser using DataLab