[R-sig-ME] lmer() - no applicable method for 'profile'

Ben Bolker bbolker at gmail.com
Thu Jan 6 16:03:52 CET 2011


   I believe you're stuck for the time being: profiling is not yet
implemented for GLMMs.
   REML is not implemented for GLMMs either: there is some debate as to
whether a useful analogue of REML can be defined: see
<https://stat.ethz.ch/pipermail/r-sig-mixed-models/2009q1/002104.html>
for example.
   I don't know of any canned approach to computing likelihood profiles
for GLMMs: there are MCMC approaches (e.g. MCMCglmm, or AD Model Builder
followed by MCMC sampling) which give you a marginal posterior
distribution ... in principle AD Model Builder can profile over the
marginal likelihood, although the last time I checked profiling didn't
actually work with random-effects models.

   If you are simply trying to get confidence intervals on your
parameters, your best *simple* bet is to take the Wald test (results of
summary()).  If you want a better answer than that, then I think your
choices are either an MCMC-based approach or bootstrapping (see
<http://glmm.wikidot.com/basic-glmm-simulation> to get started).

  (Since you have 16 variables in the model, I hope you have at least
200-300 observations -- and that's assuming you have only main effects ...)



On 11-01-06 09:35 AM, sam steyaert wrote:
> Thank you for the helping out before. I could install lme4a, and  it ran
> fine for all chunks of chapter 1. Anyhow, if i try with my own data, it
> works, until i specify REML = FALSE in the model script, or use the update()
> function.
> 
> Then, i get the following error message (it is in fact a warning message):
> 
> "In glmer(mymodelstructure),  :
> extra arguments REML are disregarded"
> 
> I can still get the parameter estimates by calling the model name.
> I would like to get the confidence intervals around the parameter estimates,
> and this appears not to work.
> 
>> prM1 = profile(Model1)
> Error: is(fm at resp, "lmerResp") is not TRUE
>> confint(prM1)  (this function logically does not work after the former one)
> Error in UseMethod("vcov") :
>   no applicable method for 'vcov' applied to an object of class "data.frame"
> 
> So i guess there is something with my data structure? I use logistic
> regression to model habitat use, and have 16 variables included in the
> model, and one random factor (as a character).
> 
> Does anyone has some advice?
> 
> Thanks a lot,
> 
> Sam
> 
> 
> 2010/12/29 Douglas Bates <bates at stat.wisc.edu>
> 
>> Thanks for checking that out, Dennis.  I will produce updated scripts
>> etc. if I ever finish my grading of project reports.  (Well I have to
>> finish them because the grades are due tomorrow.)
>>
>> The env stuff has gone away to be replaced by reference classes,
>> something that John Chambers added to R-2.12.0.  They are based on
>> environments but indirectly.
>>
>> On Tue, Dec 28, 2010 at 6:20 PM, Dennis Murphy <djmuser at gmail.com> wrote:
>>> Hi:
>>>
>>> I decided to check Sam's claims but couldn't reproduce them, at least in
>>> Chapter 1. Sam, please check out the sessionInfo() and see if you have
>> the
>>> same packages loaded with the same versions. [I autoload ggplot2, lattice
>>> and sos; of these, only lattice is relevant to lme4(a).]
>>>
>>> OTOH, some glitches did appear when I ran the code chunks from Chapter 1
>> of
>>> the draft book:
>>>
>>> (i) env() could not be found (missing package, maybe?);
>>> (ii) running splom() opens up the browser.
>>>
>>> Abridged transcript:
>>>
>>> ####### Chunk 16, Ch. 1:
>>>
>>> env(fm1ML)$Lambda
>>> Error: could not find function "env"
>>>
>>> ####### Chunk 17 (ditto 18)...which makes sense given the result of 16:
>>>
>>>> print(image(env(fm1)$Lambda, sub=NULL, xlab=NULL, ylab=NULL))
>>> Error in print(image(env(fm1)$Lambda, sub = NULL, xlab = NULL, ylab =
>> NULL))
>>> :
>>>  error in evaluating the argument 'x' in selecting a method for function
>>> 'print'
>>>
>>>
>>> ####### Chunks 19 and 20 work, as does everything through chunk 26:
>>>> pr1 <- profile(fm1ML)
>>>> print(xyplot(pr1, aspect = 1.3))
>>>
>>>
>>> ####### Chunk 27 (and by extension, 28):
>>> ####### calling splom() opens up the browser
>>> ####### the plot seems to render correctly, though
>>>
>>>> print(splom(pr1))
>>> Called from: function (x, y, groups, subscripts, i, j, ...)
>>> {
>>>    tr <- traces[[j]][[i]]
>>>    browser()
>>>    grid::pushViewport(viewport(xscale = c(-1.07, 1.07) * mlev,
>>>        yscale = c(-1.07, 1.07) * mlev))
>>>    dd <- sapply(current.panel.limits(), diff)/50
>>>    psij <- predict(tr$sij)
>>>    ll <- tr$ll
>>>    panel.grid(h = -1, v = -1)
>>>    llines(psij$y, psij$x, ...)
>>>    llines(predict(tr$sji), ...)
>>>    with(ll$tki, lsegments(y - dd[1], x, y + dd[1], x, ...))
>>>    with(ll$tkj, lsegments(x, y - dd[2], x, y + dd[2], ...))
>>>    for (k in seq_along(levels)) llines(ll$pts[k, , ], ...)
>>>    grid::popViewport(1)
>>> }(x = c(3.51976904877845, 4.41462262361588), y = c(0, 145.71944617029
>>> ), groups = NULL, subscripts = 1:2, i = 1L, j = 2L)
>>> Browse[1]>
>>>
>>>  <message iterates three times as I hit CRs to advance the browser and
>> then
>>> exits without error>
>>>
>>> Everything else in Chapter 1 seems to work fine, though, including
>> profile()
>>> and its plots.
>>>
>>>> sessionInfo()
>>> R version 2.12.1 Patched (2010-12-18 r53869)
>>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>>
>>> locale:
>>> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
>>> States.1252
>>> [3] LC_MONETARY=English_United States.1252
>>> LC_NUMERIC=C
>>> [5] LC_TIME=English_United States.1252
>>>
>>> attached base packages:
>>> [1] splines   stats     graphics  grDevices utils     datasets  grid
>>> methods
>>> [9] base
>>>
>>> other attached packages:
>>>  [1] lme4a_0.999375-59  MatrixModels_0.2-1 minqa_1.1.13
>>> Rcpp_0.9.0
>>>  [5] Matrix_0.999375-46 sos_1.3-0          brew_1.0-4
>>> lattice_0.19-13
>>>  [9] ggplot2_0.8.9      proto_0.3-8        reshape_0.8.3
>>> plyr_1.2.1
>>>
>>> loaded via a namespace (and not attached):
>>> [1] codetools_0.2-6 nlme_3.1-97     stats4_2.12.1   tools_2.12.1
>>>
>>> Hope this is of some help.
>>> Dennis
>>>
>>> On Tue, Dec 28, 2010 at 9:22 AM, sam steyaert <samsteyaert at gmail.com>
>> wrote:
>>>
>>>> Dear all,
>>>>
>>>> I am relatively new to this list. I would like to use the 'profile'
>>>> function of the lme4a package. I followed the instructions by Ben
>> Bolker.
>>>>
>>>> "Yes.  For now I think
>>>>
>>>> install.packages("lme4a",repos="http://www.math.mcmaster.ca/bolker/R")
>>>>
>>>> or
>>>> manually getting
>>>> <
>>>>
>> http://www.math.mcmaster.ca/bolker/R/bin/windows/contrib/2.12/lme4a_0.999375-59.zip
>>>>>
>>>>  should work. "
>>>>
>>>> I still get the error message as mentioned before:
>>>>
>>>> "Error in UseMethod("profile") :
>>>>   no applicable method for 'profile' applied to an object of class "mer"
>> "
>>>>
>>>> ...even if lme4a was already installed:
>>>>
>>>> " install.packages("lme4a",repos="http://www.math.mcmaster.ca/bolker/R
>> ")
>>>> Installing package(s) into ‘d:\Documents and Settings\samst\My
>>>> Documents/R/win-library/2.12’
>>>> (as ‘lib’ is unspecified)
>>>> Warning: package 'lme4a' is in use and will not be installed"
>>>>
>>>> Can anyone help me further with this?
>>>>
>>>> Kind regards,
>>>>
>>>> Sam Steyaert
>>>>
>>>>
>>>>
>>>> 2010/12/22 Dennis Murphy <djmuser at gmail.com>
>>>>
>>>>> Hi Ben:
>>>>>
>>>>> Thanks for your early Christmas present :)
>>>>>
>>>>> Best,
>>>>> Dennis
>>>>>
>>>>> On Wed, Dec 22, 2010 at 5:40 AM, Ben Bolker <bbolker at gmail.com> wrote:
>>>>>
>   Yes.  For now I think
> 
> install.packages("lme4a",repos="http://www.math.mcmaster.ca/bolker/R
>>> ")
> 
> or
> 
> manually getting
> 
> <
> 
>>>>>>
>>> http://www.math.mcmaster.ca/bolker/R/bin/windows/contrib/2.12/lme4a_0.999375-59.zip
>>>>>>>>
> 
>  should work.
> 
> 
> 
> 
> On 10-12-22 03:56 AM, lancelot wrote:
>>>>>>>> I have a "page not found" message for this URL.
>>>>>>>>
>>>>>>>> Renaud
>>>>>>>>
>>>>>>>> Le 21/12/2010 19:26, Ben Bolker a écrit :
>>>>>>>> On 10-12-21 01:25 PM, Andrew Dolman wrote:
>>>>>>>>>>> That's an lme4 binary that you linked to on r-forge. Your hosted
>>>>>>>>>>> binary work though cheers.
>>>>>>>>>>>
>>>>>>>>>>> Andy.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> andydolman at gmail.com
>>>>>>>>>>>
>>>>>>>>
>>>>>>>>   Oops.  How about
>>>>>>>>
>>>>>>>> <
> 
>>>>>>
>>> https://r-forge.r-project.org/bin/windows/contrib/latest/lme4a_0.999375-59.zip
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>    ?
>>>>>>>>
>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 21 December 2010 19:11, Ben Bolker<bbolker at gmail.com>
>>>  wrote:
>>>>>>>>>>>> On 10-12-21 12:58 PM, Dieter Menne wrote:
>>>>>>>>>>>>> Ben Bolker<bbolker at ...>  writes:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>    You need to be using the development version (lme4a).
>>>>>>>>>>>>>>    install.packages("lme4a",repos="
>>> http://r-forge.r-project.org
>>>>>> ")
>>>>>>>>>>>>>>    if that fails, try posting sessionInfo()
>>>>>>>>>>>>>
>>>>>>>>>>>>> This fails on Windows, and has been reported several times
>>>>>> already
>>>>>>>>>>>>> and confirmed
>>>>>>>>>>>>> as "temporary broken".
>>>>>>>>>>>>>
>>>>>>>>>>>>> Is there a way to get the Windows build updated?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Dieter
>>>>>>>>>>>>>
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>>>>>>>>
>>>>>>>>>>>>   (Resending to list)
>>>>>>>>>>>>
>>>>>>>>>>>>   I've put up a recent binary (32-bit Windows, R 2.12.x): try
>>>>>>>>>>>>
>>>>>>>>>>>> install.packages("lme4a",repos="
>>>>>> http://www.math.mcmaster.ca/bolker/R
> ")
>>>>>>>>>>>>
>>>>>>>>>>>> and let me know if it works.
>>>>>>>>>>>>
>>>>>>>>>>>> I'm a little puzzled that install.packages() doesn't work from
> R-forge,
>>>>>>>>>>>> there seems to be a binary version there: can you download
>>>>>>>>>>>> <
> 
>>>>>>
>>> https://r-forge.r-project.org/bin/windows/contrib/latest/lme4_0.999375-37.zip
>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>   ... ?
>>>>>>>>>>>>
>>>>>>>>>>>>   Ben
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>>>>>>>>
>>>>>>>>
>>>>>>>>>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>>>>>
> 
>>>>>>
_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>>
>>>>>
>>>>>        [[alternative HTML version deleted]]
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> R-sig-mixed-models at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>>>
>>>>>
>>>>
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>>
>>

> 	[[alternative HTML version deleted]]




> _______________________________________________
> 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