[R-sig-ME] Multiple-membership models with lme4

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Tue May 19 00:52:01 CEST 2020


        I haven't looked at this carefully, but it's sometimes the case 
that when you do 'fancy' stuff like multi-membership models, you have to 
override the default checks that lme4 does.  You can check out the 
"check.*" arguments in ?lme4::lmerControl, e.g. specifying

   control=lmerControl(check.nobs.vs.nlev = "ignore")


(you may also need to adjust check.nobs.vs.nRE)


   cheers

    Ben Bolker


On 5/18/20 11:25 AM, Sijia Huang wrote:
> Thanks for the response, Thierry!
>
> I am fitting a multiple-membership model. Since a participant can belong to
> more than one cluster, it is possible that the cluster number (number of
> random effects) is larger than the number of observations. I wonder if
> there is any trick I can perform in lme4 if I want to fit this model with
> lme4.
>
> Thank you all!
>
>
> Best,
> sIJIA
>
> On Sun, May 17, 2020 at 11:35 PM Thierry Onkelinx <thierry.onkelinx using inbo.be>
> wrote:
>
>> Dear Sijia,
>>
>> The error message seems clear to me. The number of random effect levels
>> must be less than the number of observations. Otherwise the can't distinct
>> between the random effect and the residual.
>>
>> Best regards,
>>
>> ir. Thierry Onkelinx
>> Statisticus / Statistician
>>
>> Vlaamse Overheid / Government of Flanders
>> INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND
>> FOREST
>> Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
>> thierry.onkelinx using inbo.be
>> Havenlaan 88 bus 73, 1000 Brussel
>> www.inbo.be
>>
>>
>> ///////////////////////////////////////////////////////////////////////////////////////////
>> To call in the statistician after the experiment is done may be no more
>> than asking him to perform a post-mortem examination: he may be able to say
>> what the experiment died of. ~ Sir Ronald Aylmer Fisher
>> The plural of anecdote is not data. ~ Roger Brinner
>> The combination of some data and an aching desire for an answer does not
>> ensure that a reasonable answer can be extracted from a given body of data.
>> ~ John Tukey
>>
>> ///////////////////////////////////////////////////////////////////////////////////////////
>>
>> <https://www.inbo.be>
>>
>>
>> Op ma 18 mei 2020 om 07:32 schreef Sijia Huang <huangsjcc using gmail.com>:
>>
>>> Hi everyone,
>>> I am working on estimating multiple membership models with lme4, following
>>> the instructions posted here
>>> https://bbolker.github.io/mixedmodels-misc/notes/multimember.html
>>>
>>> Below is my code, in which J2 is the number of clusters (in my case, the
>>> clusters are clique-2s, and J2=1345) and N is the number of participants
>>> (N=968). These participants belong to 0 to 11 of the clique-2s.
>>>
>>> I got the below error. Could anyone help? Thanks!
>>>
>>>> fake2 <- rep(1:J2, length.out=N)
>>>> lmod  <- lFormula(formula=y~1+(1|fake2), data=data)
>>> Error: number of levels of each grouping factor must be < number of
>>> observations
>>>
>>>
>>>
>>> Best,
>>> Sijia
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-mixed-models using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models using 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