R Chapter 4


#Problems 4.1.1

z=seq(-3,3,.01)
plot(z,dnorm(z),typ='l',ylab="Density",xlab="Score",main="Density")
plot(z,pnorm(z),typ='l',ylab="Probability",xlab="Score",main="CDF")
#at median
median.value=qnorm(.5)
abline(h=.5)
abline(v=median.value)

p=seq(.001,.999,.001)
plot(p,qnorm(p),typ='l',ylab="Value",xlab="Probability",main="Quantile Function")

abline(v=c(.025,.975),lty=3)
abline(h=c(-1.96,1.96),lty=3)

dat=rnorm(10000)
hist(dat,breaks=50,prob=T)
lines(z,dnorm(z))

mean(dat) #estimate of expected value of X
var(dat) #estimate of Var of X
median(dat) #esimtate of 50th percentile of X

Research Methods 3020