[R-sig-ME] New to LMER with 2 (easy?) questions...

Douglas Bates bates at stat.wisc.edu
Fri May 22 15:51:13 CEST 2009


On Fri, May 22, 2009 at 4:33 AM, Hank Stevens <HStevens at muohio.edu> wrote:
> Hi folks,
> Turns out that regardless how they are coded,
> ... (1|site) + (1|site:block) and
> ... (1|site/block)
>
> give the same model even though Ben is right that USUALLY SITE:BLOCK
> would return a block 72 in each site. I checked str(model) and also
> looked at the outputs and it turns out that lmer must quietly drop
> used levels in random effects.

I think you meant "drop unused levels" and yes, lmer does do that.
It's conventional in model-building functions to set
drop.unused.levels = TRUE in the call to model.frame

I think that the computational methods in lmer would continue to work
even if the unused levels were not dropped (although the conventional
approach wouldn't) but retaining them would just introduce a lot of
extra computation for no gain.

> HOWEVER, if you code BLOCKs
> non-uniquely and then rwrite
>
> ... (1|SITE) + (1|BLOCK)
>
> then you get crossed random effects.
>
> Hank
>
> On Thu, May 21, 2009 at 7:46 PM, Ben Bolker <bolker at ufl.edu> wrote:
>>  what I meant was, that if your blocks within sites were labeled
>> uniquely as 1,...,n*N you should specify your (block "within" site)
>> effect as (1|BLOCK), whereas if they were labeled 1,..,n,1,..,n,1,..,n
>> ... you should specify it as (1|SITE:BLOCK) as Rolf did.  If your
>> blocks are labeled uniquely and you specify (1|SITE:BLOCK) then you
>> end up with a lot of empty SITE:BLOCK combinations (because e.g.
>> block 72 only occurs in site 14, but your model includes terms for
>> block 72 in every site).
>>  I hope that's now clear and that I'm right, but please correct
>> me if necessary!
>>
>>  cheers
>>    Ben
>>
>> Hank Stevens wrote:
>>> Ben,
>>> Did you mean it like this? I was under the impression it was the other
>>> way around ... .
>>> Hank
>>> On Wed, 2009-05-20 at 23:12 -0400, Ben Bolker wrote:
>>>>    The only thing I would check for is that your BLOCK numbers
>>>> are truly "nested" within SITE, i.e. that your blocks are numbered
>>>> 1..n within each site, not 1:(n*N) (where n = # blocks per site,
>>>> N = # of sites).  What are n and N?  A common cause of low estimated
>>>> block variance is low replication ...
>>>>
>>
>>
>> --
>> Ben Bolker
>> Associate professor, Biology Dep't, Univ. of Florida
>> bolker at ufl.edu / www.zoology.ufl.edu/bolker
>> GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc
>>
>
>
>
> --
> Hank Stevens
> http://www.cas.muohio.edu/~stevenmh/
> 513-529-4206
> E pluribus unum
>
> _______________________________________________
> 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