data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
smth<-svysmooth(api00~api99+ell,dstrat, bandwidth=c(40,10))
dens<-svysmooth(~api99, dstrat,bandwidth=30)
plot(smth)
plot(smth, which="ell",lty=2)
svyhist(~api99,design=dstrat)
lines(dens,col="purple",lwd=3)
Run the code above in your browser using DataLab