[R] About logistic regression

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Thu Apr 1 14:37:01 CEST 2010


Hi Silvano,
this is FAQ 7.17 
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-the-output-from-anova_0028_0029-depend-on-the-order-of-factors-in-the-model_003f

hth.

Silvano schrieb:
> Hi,
>
> I have a dichotomous variable (Q1) whose answers are Yes or No.
> Also I have 2 categorical explanatory variables (V1 and V2) with two 
> levels each.
>
> I used logistic regression to determine whether there is an effect of 
> V1, V2 or an interaction between them.
>
> I used the R and SAS, just for the conference. It happens that there 
> is disagreement about the effect of the explanatory variables between 
> the two softwares.
>
> R:
> q1 = glm(Q1~grau*genero, family=binomial, data=dados)
> anova(q1, test="Chisq")
>
>            Df Deviance Resid. Df Resid. Dev P(>|Chi|)
> NULL                          202     277.82
> grau         1   4.3537       201     273.46   0.03693 *
> genero       1   1.4775       200     271.99   0.22417
> grau:genero  1   0.0001       199     271.99   0.99031
>
> SAS:
> proc logistic data=psico;
> class genero (param=ref ref='0') grau (param=ref ref='0');
> model Q1 = grau genero grau*genero / expb;
> run;
>                                   Type 3 Analysis of Effects
>                                                      Wald
>                         Effect           DF    Chi-Square Pr > ChiSq
>
>                         grau              1        1.6835 0.1945
>                         genero            1        0.7789 0.3775
>                         genero*grau       1        0.0002 0.9902
>
> The parameters estimates are the same for both.
> Coefficients:
>             Estimate Std. Error z value Pr(>|z|)
> (Intercept)  0.191055   0.310016   0.616    0.538
> grau         0.562717   0.433615   1.298    0.194
> genero      -0.355358   0.402650  -0.883    0.377
> grau:genero  0.007052   0.580837   0.012    0.990
>
> What am I doing wrong?
>
> Thanks,
>
> --------------------------------------
> Silvano Cesar da Costa
> Departamento de Estatística
> Universidade Estadual de Londrina
> Fone: 3371-4346
>
> ______________________________________________
> 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.

-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list