• Register
1 vote
1.5k 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?

6 5 3
7,540 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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 29 views
29 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 1.1K views
1.1K views
Problem : I face folowing error when I run an ANOVA on R in model.response(mf, "numeric") : using type = "numeric" with a factor response will be ignored
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 755 views
0 votes
1 answer 4 views
4 views
Problem: i don&rsquo;t understand about this problem please help? error in aperm.default(map, c(2, 1, 3)) : invalid first argument, must be an array
asked Apr 1 Rohit kr 15.5k points
0 votes
1 answer 32 views
32 views
Problem: error in as.date.numeric(value) : 'origin' must be supplied.
asked Feb 16 charles mathews 5.5k points
0 votes
1 answer 302 views
0 votes
1 answer 453 views
453 views
Problem: I have very good knowledge of r, ggplot and unix. I am now a days trying to analyze the dataset of the GSR values. I had first transformed my all the required unix values into the readable data and after that I created the plot of my GSR values in the ... . But I had already supplied the origin when I tried to transform my unix into the readable data and also again in the ggplot code.
asked Jul 27, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 1.2K views
1.2K views
Problem: I have limited knowledge of R and ggplot. I have recently written a function and trying to run the function as shown below: ggplot(datfr, aes(x = dat1[1:951,], y = dat2[1:951,])) + geom_point() After executing above function I am facing below error: Don't ... and when I try to use nrow on my two datasets it again returns the same number of rows. How can I fix above ggplot related error.
asked May 26, 2020 Martin K 6.6k points
1 vote
1 answer 314 views
314 views
Problem: I have very fundamental knowledge of logistic regression. I am trying to write code on logistic regression. I have done a lot of research on this issue but because of my limited knowledge I am still unable to fix the below error. Error ... (data) stock.direction <- data$Direction training_model=glm(stock.direction~data$lag2,data=data,family=binomial) Please help me in fixing above error.
asked May 26, 2020 Martin K 6.6k points
0 votes
2 answers 653 views
653 views
Problem : I am trying to do data manipulation using R. I am trying to import the file which is having headings and also numbers in the multiple columns. I am trying to divide my values in the one column by the other column and then trying to determine the highest values. But ... below error &ldquo;Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : 'x' must be atomic&rdquo;.
asked Feb 17, 2020 mphil 2.3k points