On Mar 3, 2012, at 17:01 , drflxms wrote: > # this is the critical block, which I still do not comprehend in detail > z <- array() > for (i in 1:n){ > z.x <- max(which(den$x < x[i])) > z.y <- max(which(den$y < y[i])) > z[i] <- den$z[z.x, z.y] > }
As far as I can tell, the point is to get at density values corresponding to the values of (x,y) that you actually have in your sample, as opposed to den$z which is for an extended grid of all possible (x_i, y_j) combinations. It's unclear to me what happens if you look at quantiles for the entire den$z. I kind of suspect that it is some sort of approximate numerical integration, but maybe not of the right thing.... Re SD: Once you go into two dimensions, SD loses all meaning, and adding nonparametric density estimation into the mix doesn't help, so just stop thinking in those terms! -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list 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.