I am using the npudens function in the np package for R.
I am trying to find a kernel density function of a multivariate dataset and the density evaluated at each of the 632 points to run a conditional efficiency analysis.
I have 4 continuous one dummy variable and my sample size is 632 observations.
I use the below function in R.
kerz <- npudens(bws=bw_cx[i,], cykertype="epanechnikov", cxkertype="epanechnikov",
oxkertype="liracine", tdat=tdata, edat=dat)
In earlier versions, this worked fine, as I was able to retrieve the necessary density estimates with kerz$dens
.
In newer version and in Rstudio Cloud I get an error:
Error in if (any(a <= 0)) warning(paste("variable", which(a <= 0), " appears to be constant",:missing value where TRUE/FALSE needed
I suppose some if-statement doesn't evaluate to a TRUE or FALSE somewhere in the npudens
function. I have tried to debug the command by changing it to the following command:
kerz2 <- npudens(bws=(bw_cx[i,]), ckertype="epanechnikov",, okertype="liracine",
tdat=tdata, edat=dat)
Unfortunately, I get the same error.
Any help/advice on how to fix this would be greatly appreciated.