[R-sig-ME] Error when using models with lmer

Douglas Bates bates at stat.wisc.edu
Wed Feb 8 21:11:19 CET 2012


On Wed, Feb 8, 2012 at 12:52 PM, Olga Vitek <ovitek at stat.purdue.edu> wrote:
> Dear Dr. Bates,
>
> May I ask you for a clarification? The two problematic functions are indeed from the package gmodels
>
> ci(fit4)                                         # 'ci' stands for confidence intervals of the fixed effects
> estimable(fit4, c(0, -1, 0, 0))       # produces estimates of SE of the linear combination of the fixed effects
>
> The difficulty is that there was no change in the version of gmodels before or after the problem occurred. The code worked with lme4_0.999375-40 and R2.13.1, but not with lme4_0.999375-42 and R2.14.1.

You need to go through some hidden functions to find out where the
problem lies.  Eventually it boils down to a hidden function called
gmodels:::est.mer which calls mcmcsamp and that function is no longer
available.

> Could you kindly let me know if there were changes in the structure of the class 'mer' since lme4_0.999375-40? Alternatively, could you recommend other options for calculating standard errors of linear combinations of fixed effects?
>
> Many thanks in advance
> Olga Vitek
>
>
>
>
>
> On Feb 8, 2012, at 11:51 AM, Douglas Bates wrote:
>
>> On Tue, Feb 7, 2012 at 2:03 PM, Olga Vitek <ovitek at stat.purdue.edu> wrote:
>>> Hello,
>>>
>>> I am executing the following code
>>>
>>>> library("lme4")
>>>> library(faraway)
>>>> data(penicillin)
>>>> fit4 <- lmer(yield ~ treat + (1|blend), penicillin)
>>>
>>> and the lines below generate error messages
>>>
>>>> library(gmodels)
>>>> ci(fit4)
>>
>> Yes.  Why would you want to try to create a vector from an S4 fitted
>> model object?
>>
>> It almost never makes sense to use
>>
>> c(foo)
>>
>> Most of the time when people use that idiom what they really mean is
>>
>> foo
>>
>> (I say "almost never" because in the old days many of us would use
>> c(myMatrix) to create a vector from a matrix.  The preferred form is
>> now as.vector(myMatrix).)
>>
>>> Error in as.vector(data) :
>>>  no method for coercing this S4 class to a vector
>>>
>>>> contrast.function <- c(0, -1, 0, 0)
>>>> test.result <- estimable(fit4, contrast.function)
>>> Error in as.vector(data) :
>>
>> I assume that the "estimable" function is in the gmodels package, so
>> you should contact the author of that package about this.
>>
>>>  no method for coercing this S4 class to a vector
>>>
>>>
>>> This worked with with lme4_0.999375-40 and R version 2.13.1, but not with lme4_0.999375-42 and R version 2.14.1.
>>>
>>> Would you have suggestions on how to make this work?
>>> Thank you in advance
>>> Olga Vitek
>>>
>>>> sessionInfo()
>>> R version 2.14.1 (2011-12-22)
>>> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
>>>
>>> locale:
>>> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>> other attached packages:
>>> [1] gmodels_2.15.1   faraway_1.0.5    lme4_0.999375-42 Matrix_1.0-3     lattice_0.20-0
>>>
>>> loaded via a namespace (and not attached):
>>> [1] gdata_2.8.2   grid_2.14.1   gtools_2.6.2  MASS_7.3-16   nlme_3.1-102  stats4_2.14.1 tools_2.14.1
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




More information about the R-sig-mixed-models mailing list