Last chance! 50% off unlimited learning
Sale ends in
Kernel density estimation for classified data
dclass(
xclass,
burnin = 2,
samples = 5,
boundary = FALSE,
bw = "nrd0",
evalpoints = 200,
adjust = 1,
dFunc = NULL
)
classified values; matrix with two columns: lower and upper value
burn-in sample size
sampling iteration size
TRUE for positive only data (no positive density for negative values)
bandwidth selector method, defaults to "nrd0" see density
for more options
number of evaluation grid points
as in density
, the user can multiply the bandwidth by a certain factor such that bw=adjust*bw
character optional density (with "d", "p" and "q" functions) function name for parametric estimation such as "norm" "gamma" or "lnorm"
The function returns a list object with the following objects (besides all input objects):
Mestimates
kde object containing the corrected density estimate
gridx
Vector Grid on which density is evaluated
resultDensity
Matrix with Estimated Density for each iteration
resultX
Matrix of true latent values X estimates
# NOT RUN {
x=rlnorm(500, meanlog = 8, sdlog = 1)
classes <- c(0,500,1000,1500,2000,2500,3000,4000,5000,6000,8000,10000,15000,Inf)
xclass <- cut(x,breaks=classes)
xclass <- cbind(classes[as.numeric(xclass)], classes[as.numeric(xclass) + 1])
densityEst <- dclass(xclass=xclass, burnin=20, samples=50, evalpoints=1000)
plot(densityEst$Mestimates~densityEst$gridx ,lwd=2, type = "l")
# }
Run the code above in your browser using DataLab