Hello, I have a n*2 matrix, called "plan", which contains n observations from 2 variates. I want a kernel density estimate of the joint distribution of these 2 variates. I try : density(plan). Unfortunately, R thinks there is 2n observations (if n=10, 20 observations), where there is only n. How to to make a multivariate kernel density estimate ? Thank you very much. _________________________________________________________________ météo et bien plus encore ! [[alternative HTML version deleted]]
There's a nice package ('ks') which even allows you to specify a matrix of bandwidths (not only one bandwidth for each coordinate direction). Hope this helps, Emili Missatge citat per Bruce Willy <croero at hotmail.com>:> > Hello, > > I have a n*2 matrix, called "plan", which contains n observations from 2 > variates. > > I want a kernel density estimate of the joint distribution of these 2 > variates. > I try : density(plan). Unfortunately, R thinks there is 2n observations (if > n=10, 20 observations), where there is only n. > > How to to make a multivariate kernel density estimate ? > > Thank you very much. > _________________________________________________________________ > > m?t?o et bien plus encore ! > > [[alternative HTML version deleted]] > >
Try bkde2D {KernSmooth} or kde2d {MASS}. Bruce Willy wrote:> Hello, > > I have a n*2 matrix, called "plan", which contains n observations from 2 variates. > > I want a kernel density estimate of the joint distribution of these 2 variates. > I try : density(plan). Unfortunately, R thinks there is 2n observations (if n=10, 20 observations), where there is only n. > > How to to make a multivariate kernel density estimate ? > > Thank you very much. > _________________________________________________________________ > > m?t?o et bien plus encore ! > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code.