[R] Computing the density of a median
Dioggban Jakperik
j@kperik@dioggb@n @ending from @tudent@@jku@t@@c@ke
Sun Aug 19 18:33:02 CEST 2018
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
[[alternative HTML version deleted]]
More information about the R-help
mailing list