Hi all, Do any packages implement density estimation in a modelling framework? I want to be able to do something like: dmodel <- density(~ a + b, data = mydata) predict(dmodel, newdata) This isn't how sm or KernSmooth or base density estimation works. Are there other packages that do density estimation? Or is there some reason that this is a bad idea. Hadley -- http://had.co.nz/
>>>>> "hw" == hadley wickham <h.wickham at gmail.com> >>>>> on Fri, 29 Aug 2008 14:03:45 -0500 writes:hw> Hi all, Do any packages implement density estimation in hw> a modelling framework? I want to be able to do hw> something like: hw> dmodel <- density(~ a + b, data = mydata) hw> predict(dmodel, newdata) hw> This isn't how sm or KernSmooth or base density hw> estimation works. Are there other packages that do hw> density estimation? Or is there some reason that this hw> is a bad idea. I always recommend logspline. Martin Maechler, ETH Zurich hw> Hadley hw> -- http://had.co.nz/ hw> ______________________________________________ hw> R-help at r-project.org mailing list hw> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do hw> read the posting guide hw> http://www.R-project.org/posting-guide.html and provide hw> commented, minimal, self-contained, reproducible code.
Hi Hadley, There is also locfit, which is very highly regarded by some authorities (e.g. Hastie, Tibs, and Friedman). Cheers, Mark. hadley wrote:> > Hi all, > > Do any packages implement density estimation in a modelling framework? > I want to be able to do something like: > > dmodel <- density(~ a + b, data = mydata) > predict(dmodel, newdata) > > This isn't how sm or KernSmooth or base density estimation works. Are > there other packages that do density estimation? Or is there some > reason that this is a bad idea. > > Hadley > > -- > http://had.co.nz/ > > ______________________________________________ > R-help at 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. > >-- View this message in context: http://www.nabble.com/Density-estimates-in-modelling-framework-tp19225727p19226399.html Sent from the R help mailing list archive at Nabble.com.
Thanks for all your replies. The suggestions I got were: * gss * logspline * locfit I ended up using locfit because the interface was just right for my needs, and it was faster than the alternatives. Hadley On Fri, Aug 29, 2008 at 2:03 PM, hadley wickham <h.wickham at gmail.com> wrote:> Hi all, > > Do any packages implement density estimation in a modelling framework? > I want to be able to do something like: > > dmodel <- density(~ a + b, data = mydata) > predict(dmodel, newdata) > > This isn't how sm or KernSmooth or base density estimation works. Are > there other packages that do density estimation? Or is there some > reason that this is a bad idea. > > Hadley > > -- > http://had.co.nz/ >-- http://had.co.nz/