# # Load the "Nassau County Racial Imbalance" Data # downloaded from # http://www.stat.washington.edu/handcock/594/Data/lischool.RData # load("lischool.RData") # # Convert proportion of white # pwhite <- lischool[,"WHITE"] / lischool[,"TOTAL"] # pdf(file = "FigLec7.4.pdf",width=10.5,height=7.5,horiz=T) par(mfrow=c(1,2)) # # Load the the local likelihood library # library(locfit) # hist(pwhite, type='n', probability=T, main="Nassau County Schools\n Alternative estimates", ylim=c(0,5.5), xlab = "Proportion of White Students", ylab = "Probability") lines(locfit(~pwhite, alpha=0.7)) lines(density(pwhite, bw="SJ"),lty=2) rug(pwhite) # # add a legend # legend(x=c(0,0),y=c(5,5),lty=1:2, legend=c("local likelihood with 70% nhbd", "kernel")) # hist(pwhite, type='n', probability=T, main="Nassau County Schools\n Alternative estimates", ylim=c(0,5.5), xlab = "Proportion of White Students", ylab = "Probability") rug(pwhite) lines(locfit(~pwhite, alpha=0.2)) lines(density(pwhite, bw="SJ"),lty=2) # # add a legend # legend(x=c(0,0),y=c(5,5),lty=1:2, legend=c("local likelihood with 20% nhbd", "kernel"))