[R] Cross-correlated variables in kernel density estimation

Liaw, Andy andy_liaw at merck.com
Wed Nov 17 02:05:41 CET 2004

> From: Adam Gobena
> Hi,
> I am wondering if the kde2d 2-D kernel density estimation 
> function in the
> MASS package can take into account the effect of correlations 
> between the
> variables. I couldn't find any achieved information on this issue.
> Unfortunately, I don't have the 2002 edition of Modern 
> Applied Statistics
> with S by Venables and Ripley in case it was described there. 

The subject of your message doesn't seem to have much to do with your
question...  Also, it's not clear to me what you mean by taking into account
the effect of correlations between variables.  Do you mean a kernel function
that is something like a bivariate Gaussian density with non-diagonal
covariance matrix?  If so, ?kde2d in MASS says:

     Two-dimensional kernel density estimation with an axis-aligned
     bivariate normal kernel, evaluated on a square grid.

so the answer is no.  No other R packages that does 2D kernel density
estimation (that I know of, anyway) can do it, either, and probably for a
good reason.  Why would you need it?  If there are correlation structures in
the (X, Y) data, small enough bandwidths in both direction should give
satisfactory estimate of the density.

> Thanks in advance.
> Adam
> --------------------------------------------------------------
> --------------
> Adam Kenea Gobena
> Research Assistant, Water Resources Engineering
> Department of Civil & Environmental Engineering
> 220 Civil/Electrical Eng Bldg
> University of Alberta
> Edmonton, AB
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list