[R] Performing a glm binomial model

David Winsemius dwinsemius at comcast.net
Sat Feb 7 15:43:35 CET 2009


In R using:

formula = (ENF/TOT) ~ (VAR1 + VAR2 + VAR3 + VAR4)^2 would give you all  
the main effects and 2 way interactions.

What do you mean by the R^2 for a binary model? It is not constructed  
simply by minimizing the squared distances from the 0,1 outcomes.  
There are analogues to R^2 (and one notorious software package offers  
one without adequate explanation of what it means), but the fact that  
you are asking the question suggests you need to crack open your  
texts. You need to focus on the difference in deviance when working  
with generalized linear models.

-- 
David Winsemius

On Feb 7, 2009, at 9:13 AM, Alberto Maceda wrote:

> Hello R-users,
>
> My first consult is that I would like to tackle the relationship  
> between a
> dependent variable and four environmental factors using a glm binomial
> model. The problem is that I want to test the interaction between  
> factors
> too and I would like to learn some way to do it automatically.
>
> Now, my syntax is, for instance:
>
> E1<-glm(formula = (ENF/TOT)~VAR1+VAR2+VAR3+VAR4, family = binomial,  
> data =
> DATA, weights = TOT)
>
> And I would like to add pair interactions at least:  
> VAR1*VAR2+VAR1*VAR3,
> etc... for all possible combinations.
>
> My second question is that the model does not show me the R-squared  
> neither
> using summary(E1) nor writing simply E1.
>
>
> Thank you very much!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.




More information about the R-help mailing list