Comments on Assignment 7 ======================== 1.(a) Using the default "width", for example, you found that all the kernels lead to essentially the same density estimate, except perhaps for the rectangular kernel which produces a rather "bumpy" estimate (Why is that?). (b) Findings as discussed in lab: small ==> rough estimate (low bias and high variability); large ==> smooth estimate (high bias and low variability). Need to balance these two aspects. 2.(a) For an exponential with mean = theta: - var = theta^2 - median = theta x log(2) (b) The normal approximations to the sampling distributions become: sample mean: mean = theta, var = theta^2/n sample median: mean = theta x log(2), var = theta^2/n (also!) For theta = 1, the normal approximations become: sample mean: mean = 1.00, var = 0.10 sample median: mean = 0.69, var = 0.10 Then you needed to simulate a bunch (500 at a minimum) of such exponential samples to obtain a bunch of sample means and medians (use the function you wrote for Assignment #3). Do QQplots with the quantiles of the specific normals (not any normal) above. #R codes expmean<-function(b) { meanvec <- NULL for (i in 1:b) { meanvec[i] <- mean(rexp(10,rate=1)) } return(meanvec) } expmedian<-function(b) { medianvec <- NULL for (i in 1:b) { medianvec[i] <- median(rexp(10,rate=1)) } return(medianvec) } meanvector<-expmean(1000) medianvector<-expmedian(1000) qqplot( meanvector, qnorm( ppoints(meanvector),mean=1,sd=sqrt(.10) ) ) qqplot(medianvector, qnorm(ppoints(medianvector),0.69,sd=sqrt(.10) ) ) mean(meanvector) # should be close to 1 var(meanvector) # should be close to .10 mean(medianvector) # should be close to .69 var(medianvector) # should be close to .10 For n = 10, these normal approximations are far from perfect, but they will be adequate for rough calculations.