Skip to content

my failing understanding ...

3 messages · Kjetil Halvorsen, David Winsemius

#
The following I do not understand, but then I did'nt really use
S4 methods ...
Function: plot (package graphics)
x="ANY"
x="lmList.confint"
x="merMCMC"
    (inherited from: x="ANY")
Error in as.double(y) :
  cannot coerce type 'S4' to vector of type 'double'
[1] "merMCMC"
attr(,"package")
[1] "lme4"


Kjetil
#
I get a different result, undoubtedly because I have different  
packages loaded:

 > showMethods(plot)

Function "plot":
  <not a generic function>

 > sessionInfo()
R version 2.10.0 Patched (2009-10-29 r50258)
x86_64-apple-darwin9.8.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets   
methods   base

other attached packages:
[1] plm_1.2-1        sandwich_2.2-1   zoo_1.5-8         
MASS_7.3-3       Formula_0.2-0
[6] kinship_1.1.0-23 lattice_0.17-26  nlme_3.1-96      survival_2.35-7

loaded via a namespace (and not attached):
[1] grid_2.10.0  tools_2.10.0

But I get a much longer and informative result with:

methods(plot)
#
On Nov 27, 2009, at 9:39 PM, David Winsemius wrote:

            
As  follow-up, I loaded lme4 (just guessing that was the package that  
was being used) and looked up merMCMC in R-search, finding that such  
objects were created with mcmcsamp. (I also noted that the methods  
available for such objects did NOT include plot, but they did include  
xyplot. So I made the sample object that is in the help page, and  
applied both plot and xyplot:

 > xyplot(samp0)  # plotted what I would expect from an MCMC object
 > plot(samp0)
Error in as.double(y) :
   cannot coerce type 'S4' to vector of type 'double'
 > plot(x=samp0)
Error in as.double(y) :
   cannot coerce type 'S4' to vector of type 'double'

So my (posterior) hypothesis is that you are using the wrong plot  
function.