A priori contrast for binomial GLM

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A priori contrast for binomial GLM

Rula
Hello to everyone,

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)
  date day treat psu  sp  burrow
1    3   0 30-30  36    B      0
2    3   0 30-30  36    B      0
3    3   0 15-30  36    B      1
4    3   0 15-30  36    B      1
5    3   0 15-30  36    B      1
6    3   0 10-25  36    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 contrastes 30 vs all (there are 4 categories to compare)
k3010R1<-matrix(c(3,-1,-1,-1),1)
k3010R1
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,

--
Rula Domínguez Fernández
PhD Student
*Departamento de Ecoloxía e Bioloxía Animal*
*Faculdade de Ciencias do Mar*
*Universidade de Vigo*

www.researchgate.net/profile/Rula_Dominguez
<https://www.researchgate.net/profile/Rula_Dominguez3>
EcoCost
<https://ecocost.webs.uvigo.es/index.php?option=com_content&view=article&id=9&Itemid=164&lang=gl>
Móvil: +34 646521205

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: A priori contrast for binomial GLM

Michael Dewey-3
Dear Rula

That is really a statistical question not one for this list but the
answer is that the fact that they are all zero for that category
explains it. Search on-line for separation for more details.

Michael

On 18/01/2019 09:56, Rula Domínguez wrote:

> Hello to everyone,
>
> 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)
>    date day treat psu  sp  burrow
> 1    3   0 30-30  36    B      0
> 2    3   0 30-30  36    B      0
> 3    3   0 15-30  36    B      1
> 4    3   0 15-30  36    B      1
> 5    3   0 15-30  36    B      1
> 6    3   0 10-25  36    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 contrastes 30 vs all (there are 4 categories to compare)
> k3010R1<-matrix(c(3,-1,-1,-1),1)
> k3010R1
> 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,
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.