Dear all,
I have the following function kdenor <- function(aa,q=NULL){ a=sample(aa,500,replace=F) ab=quantile(a, p=0.75)-quantile(a, p=0.25) h=(0.9*min(var(a),ab))/(1.34*n^(1/5)) if(is.null(q)) { q = seq(min(a)-3*h, max(a)+3*h, length.out=length(a)) } nx = length(a) nq = length(q) xmat = matrix(q,nq,nx) - matrix(a,nq,nx,byrow=TRUE) denall= dnorm(xmat/h)/h denhat = apply(denall,1,mean) f<-denhat f1<-median(f) #das<-list(x=q, y=denhat, h=h) #return(das) } f1<-kdenor(aa) My interest is to obtain the estimate of the density at the median of the sample data. But the output of the current function doesn't provide the correct result. Kindly help. Regards. -- Jakperik Dioggban (Student, PAUISTI) PhD Mathematics (Statistics Option) Determination is Key to Success -- Jakperik Dioggban (Student, PAUISTI) PhD Mathematics (Statistics Option) Determination is Key to Success [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.