• Register
1 vote
2k views

Problem :

I have my data as this the ticks feed on three of the groups of treated mouse’s and compare whether my treatment has the effect on ticks the bacteria load.

When I tried to make the mixed model like below:

lmer.model01 = lmer(log10.load ~ treat + (1|mouse.id/tick.id))

My screen shows me the error as below :

Error: number of levels of each grouping factor must be < number of observations

What must have happened and how can fix this error?

7.5k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

If you have only the single measurement per tick then you must leave your explicit mouse.id:tick.id grouping variable out of your model, i.e. use the log10.load ~ treat + (1|mouse.id). Alternatively, if this is the nested design then each mouse gets one of the treatment, each tick is fed on the single mouse and multiple ticks per mice you could also follow the Murtaugh 2007 "Simplicity and complexity in ecological data analysis" Ecology 88 and simply you need to compute the average load per mouse, then you can use the simple lm(log10.load~treat,data=aggregated_data). If you are insisting on fitting your model the way it is then you can use the  control=lmerControl(check.nobs.vs.nlev="ignore"), but if you ask me then I don't advise it.

38.6k points

Related questions

1 vote
1 answer 39 views
39 views
Problem: I&rsquo;m facing a problem while running a mixed effect model. Sample data: data4<-structure(list(code = structure(1:10, .Label = c("10888", "10889", "10890", "10891", "10892", "10893", "10894", "10896", "10897", "10898", "10899", " ... , data4) Error message: Error in checkNlevels(reTrms$flist, n = n, control) : number of levels of each grouping factor must be < number of observations
asked May 8 Raj Tyagi 16k points
0 votes
1 answer 1 view
1 view
Problem : Grouping factor must have exactly 2 levels
asked Jul 13 Sifat55 108k points
0 votes
1 answer 7 views
7 views
Problem: Factor predictors must have at most 32 levels
asked Jul 8 nila 121k points
0 votes
1 answer 19 views
19 views
Question: How does one change the levels of a factor column in a data.table?
asked Apr 14 Atik03 26.5k points
0 votes
1 answer 21 views
21 views
Problem: I am in trouble while solving it .. please help me .. how to change factor levels in r
asked Apr 20 Ifra 43.4k points
0 votes
1 answer 3 views
3 views
Problem : Hi, Is there a way to solve it: Error in ts(x) : 'ts' object must have one or more observations?
asked Jun 21 Siam55 110k points
0 votes
1 answer 14 views
14 views
Problem : How to find a number of observations in r? Please help me with this.
asked May 26 Sifat55 108k points
0 votes
1 answer 34 views
34 views
Problem: Is there a solution for this : Number of predictions in each run must be equal to the number of labels for each run.
asked Jun 13 asha 121k points
0 votes
1 answer 46 views
46 views
Problem what is the function in r to get the # of observations in a data frame ?
asked Feb 9 charles mathews 5.5k points
0 votes
1 answer 24 views
24 views
Problem: What am I going to do about it : Data and reference should be factors with the same levels?
asked Jun 23 Mezbah 130k points