[R] logistric regression: model revision

David Winsemius dwinsemius at comcast.net
Mon Nov 7 17:05:46 CET 2011


On Nov 7, 2011, at 10:58 AM, Sally Ann Sims wrote:

> Hello,
>
> I am working on fitting a logistic regression model to my dataset.   
> I removed the squared term in the second version of the model, but  
> my model output is exactly the same.
>
> Model version 1:  GRP_GLM<-glm(HB_NHB~elev 
> +costdis1^2,data=glm_1,family=binomial(link=logit))
> summary(GRP_GLM)
>
>
> Model version 2:  QM_1<-glm(HB_NHB~elev 
> +costdis1,data=glm_2,family=binomial(link=logit))
> summary(QM_1)
>
>
> The call in version 2 has changed:
> Call:
> glm(formula = HB_NHB ~ elev + costdis1, family = binomial(link =  
> logit),
>    data = glm_2)
> But I’m getting the exact same results as I did in the model where  
> costdis1 is squared.

Are you sure that you got output that correctly modeled the  
costdis1^2? I would ahve guessed that you would have needed to use :

  GRP_GLM<-glm(HB_NHB~elev+I(costdis1^2), data=glm_1,  
family=binomial(link=logit))

?I

The "^" in model formulas is for composing interactions.

?formula

>
> Any ideas what I might do to correct this?  Thank you.
>
> Sally
> 	[[alternative HTML version deleted]]

And please post in plain text.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list