Re: [R] kernel smooth for tw-dimensional data

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Wed, 06 Jun 2007 07:36:14 +0200 (CEST)


On Tue, 5 Jun 2007, Patrick Wang wrote:

> Hi, I found kde2d in the MASS packages return densities for the bivariate
> random varaibles.
>
> I donot understand why each element of density Z is a 2*2 matrix.
> Why it is not a number.
>
> For example, a bivariate normula distribution given (x, y) will return a
> number, the density, not a matrix.

I think you were asking these questions last week:

library(mvtnorm)
?dmvnorm

not 2D kernel *density* (the word is perhaps overloaded).

However, kde2d() *is* a 2D density(), so maybe you need to consider what you are looking for.

>
> Thanks
> Pat
>
>
> > Hi all:
> >
> > I can use the density() function to get the kernel density for given
> > observed data X with bandwidth.
> >
> > Is there a function in R that can take in two dimensional data(x, y) and
> > return a joint density based
> > on the bandwidth. Do I need to provide bandwith for x and then for y?
> >
> > Is the GRASS package
> > kde2d.G(x, y, h, G, reverse=reverse(G))
> >
> > provide such function?
> >
> > Thanks
> > pat
> >
> > ______________________________________________
> > 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.
> >
>
> ______________________________________________
> 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.
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand_at_nhh.no

______________________________________________
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.
Received on Wed 06 Jun 2007 - 05:46:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Jun 2007 - 06:31:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.