[6369] in s-news-athena
Re: [Q] is there a 2d analogue of density()?
daemon@ATHENA.MIT.EDU (Ross Gayler)
Thu Feb 2 20:22:31 1995
To: s-news@utstat.toronto.edu
From: ross@psy.uq.oz.au (Ross Gayler)
Date: 2 Feb 1995 23:37:02 GMT
I posted a question requesting pointers to S functions for estimating
the smoothed density of observations as a function of 2 continuous
variables.
The following people were kind enough to send responses (within 1 day!).
Matt Wand wand@agsm.unsw.edu.au
Rick Chappell chappell@biostat.wisc.edu
Rob Hyndman hyndman@staff.monash.edu.au
Vincent Carey stvjc@gauss.med.harvard.edu
Martin Maechler maechler@stat.math.ethz.ch
Clive Loader clive@research.att.com
David Scott scottdw@stat.rice.edu
Don MacQueen macq@mairi.llnl.gov
>>>>> Matt Wand says:
MW>I have a paper in the December 1994 issue of
MW>J. Comput. Graphical Statistics that shows
MW>one way to do this, and some corresponding
MW>S-PLUS code.
Matt sent his code (S + Fortran functions)
>>>>> Rick Chappell suggested that I might be able to use interp()
This would work after 2d binning of the data to get bin counts.
However, the linear interpolation from interp() is not the kind
of smoothing that I had in mind (something more like a gaussian
kernel).
>>>>> Several people suggested the S collection in statlib, where there are
two different bivariate density functions: ash() & kde2d()
>>>>> Martin Maechler says of kde2d()
MM>See our 'kde2d' submission on statlib in the S directory.
MM>
MM>It does 2D Gaussian kernel density estimation
MM> [INCLUDING 'spherizing' which may bbbe important for
MM> strongly correlated data]
MM>it is 'plain S'...
>>>>> David Scott says of ash()
DS>You can use my 2-D averaged shifted
DS>histogram functions (bin2 and ash2) for your
DS>purpose. ftp to ftp.stat.rice.edu and
DS>grab scottdw/ASH.code/ash.9406.shar
DS>
DS>p.s. See my book "Multivariate Density Estimation", 1992, John Wiley&Sons
ash() is also available from statlib
>>>>> Clive Loader says
For a local likelihood approach to this:
CL>anonymous ftp to netlib.att.com
CL>cd netlib/att/stat/prog
CL>get density.shar.Z
CL>
CL>or by mosaic, use ftp://netlib.att.com/att/stat/prog/index.html.Z
>>>>> Don MacQueen says
DM>My father has developed methodology
DM>that calculates multivariate kernel density estimates.
DM>I have used his method to do just what I think you are asking for,
DM>using SAS proc iml, producing bivariate probability contours.
DM>I've been wanting to do the same in S for some time now, but
DM>never found the time. The underlying math is not very difficult.
DM>
DM>I surely have the SAS code sitting around somewhere, but its
DM>been a few years. Let me know how interested you are, and I
DM>might be able to dig up the code.
DM>
DM>He has also written a DOS based program called N-Kernel
DM>which he sells for a smallish price (under 50 $US, I think)
DM>to implement the method. However, the program is designed
DM>to function as a multivariate data smoother. The extension
DM>to bivariate probability contours was my idea.
DM>
DM>His email address is:
agsm.ucla.edu
DM> (Jim MacQueen)
DM>I don't know how often he checks his email; he's only part time
DM>now.
--------------------------------------------------------------------
Once again, thanks to everyone for their help.
Ross Gayler
ross@psy.uq.oz.au