[R] small issue with densityplot

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Aug 21 20:17:39 CEST 2007


On 8/21/07, Horace Tso <Horace.Tso at pgn.com> wrote:
> Hi folks,
>
> This is really minor but to someone not familiar with the various tentacles of the lmer package it could be really annoying. I was trying to plot the posterior density of the fixed effect parameters of a lmer model,
>
> > hr.mcmc = mcmcsamp(hr.lmer, n=50000)
> > densityplot(hr.mcmc, plot.points=F)
>
> There is this error,
>
> "Error in densityplot(hr.mcmc, plot.points = F) :
>         no applicable method for "densityplot" "
>
> It kind of smells like something I've come across before. So I checked the mcmcsamp help page, and alas, the example suggests that the package coda is needed.
>
> >From the help page of densityplot alone, there is no way one could figure out this dependency. It says, together with histogram, it is part of lattice.
>
> Could the function author *please* make clarification in future editions of lattice.

There is nothing to clarify. densityplot() is a generic function, and
it is not possible for the author of the generic function to
anticipate and document all possible methods, especially those in
other packages. I would say that since you are using mcmcsamp(), it's
perfectly reasonable to expect you to look at its help page to figure
out what you can do with the results.

What gave you the idea that densityplot would work on the result of
mcmcsamp in the first place?

-Deepayan



More information about the R-help mailing list