0
$\begingroup$

after much reading I decided to write because I cannot find a solution to my question.

I already did a priori contrasts before for a continuous variable with normal distribution. Now I have another variable (burrow), which is binomial, and I can do the GLM for it. But when I do the a priori contrasts, it has no result in the cases where all data are 0 (is not that there are no data, they are just all 0 in a category (treat 30-30), and I want to compare this with others that have ones).

Data sructure is like this:

>head(burrow)

##day treat  sp  burrow

## 3   30-30 B      0
## 3   30-30 B      0
## 3   15-30 B      1
## 3   15-30 B      1
## 3   15-30 B      1
## 3   10-25 B      1

My model is this:

> model4B2<-glm(burrow~ treat, family=binomial(link="logit"), data=D4B)

And I did the contrast like this:

> require(multcomp)
> #Test contrasts 30 vs all (there are 4 categories to compare)
> k3010R1<-matrix(c(3,-1,-1,-1),1)
> t3010<-glht(model4B3.2,linfct=k3010R1)
> summary(t3010)

But is not working and I am sure it should work.

Could it be because my explanatory variable is cathegorical? Or is just not possible to do contrasts for binomial when you have all 0 in some cathegory?

Thank you in advance,

$\endgroup$
  • $\begingroup$ If your explanatory variable (treat) is all 0, what do you expect R to form a contrast against? It seems like there is nothing the treat=0 group can be compared to, so presumably R simply does not know what you want it to do. $\endgroup$ – Björn Jan 18 at 11:11
  • $\begingroup$ Thanks for giving feedback. I´m afraid I made a mistake posting the data, now is edited and corrected. Treat are 4 cathegories (30-30, 15-30, 10-25 and 5-20). $\endgroup$ – Rula Jan 18 at 21:33
0
$\begingroup$

Your second explanation is correct. When all the values in one level are all zero (or all one) this will happen. The phenomenon is known as separation and has its own tag here which you can browse for more details. This Q&A How to deal with perfect separation in logistic regression? may be a good starting point. I am surprised you did not notice unusual features in the summary output from your call to glm() as that would also have alerted to the problem.

$\endgroup$
  • $\begingroup$ Many thanks, I will read about this topic. Is a great startpoint because I was stucked. Maybe I just didn´t realize because I haven´t done the summary, jus directly went for Anova. Thanks!! $\endgroup$ – Rula Jan 18 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.