[R] glm's for a logistic regression - no warnings?

Xochitl CORMON Xochitl.Cormon at ifremer.fr
Tue Oct 1 17:47:20 CEST 2013


Le 01/10/2013 17:41, Dimitri Liakhovitski a écrit :
> Ah, thank you very much - I did not understand first brglm was the name
> of a package!
> Dimitri

My bad!

If there is separation you should see it in the way the coefficient 
diverges from one (it's pretty exponential). You can increase the number 
of step if you see nothing but in my opinion 30 steps are enough.

There is several packages to handle separated data, brglm and logistf 
are the two I recall.

Good luck!

Xochitl C.

>
> On Tue, Oct 1, 2013 at 11:34 AM, Xochitl CORMON
> <Xochitl.Cormon at ifremer.fr <mailto:Xochitl.Cormon at ifremer.fr>> wrote:
>
>
>
>
>     <>< <>< <>< <><
>
>     Xochitl CORMON
>
>     Le 01/10/2013 17:29, Dimitri Liakhovitski a écrit :
>
>         Thank you very much, Bert - it's very helpful.
>         This post says that R issues a warning:
>
>         Warning message:
>         *glm.fit: fitted probabilities numerically 0 or 1 occurred
>         *
>
>
>     Actually the warning message should be something like:
>     glm.fit: algorithm did not converge
>
>     The fist warning is not fatal contrary to the second one..
>     (https://stat.ethz.ch/__pipermail/r-help/2012-March/__307352.html
>     <https://stat.ethz.ch/pipermail/r-help/2012-March/307352.html>)
>
>
>         However, in my case there is no warning. How could I detect complete
>         separation in my data? I need to be able to flag it in my function.
>
>
>     As said use the separation dectection function:
>     separation.detection{brglm}
>
>         Thank you very much!
>         Dimitri
>
>
>
>         On Tue, Oct 1, 2013 at 10:52 AM, Xochitl CORMON
>         <Xochitl.Cormon at ifremer.fr <mailto:Xochitl.Cormon at ifremer.fr>
>         <mailto:Xochitl.Cormon at __ifremer.fr
>         <mailto:Xochitl.Cormon at ifremer.fr>>> wrote:
>
>              Hi,
>
>              I did have warning messages about convergence issues using
>         binomial
>              GLM with logit link with my data in the past....
>
>              Do you detect separation using the function
>         separation.detection{brglm}?
>
>              Regards,
>
>              Xochitl C.
>
>
>         <>< <>< <>< <><
>
>              Xochitl CORMON
>         +33 (0)3 21 99 56 84 <tel:%2B33%20%280%293%2021%2099%2056%2084>
>         <tel:%2B33%20%280%293%2021%__2099%2056%2084>
>
>
>              Doctorante en sciences halieutiques
>              PhD student in fishery sciences
>
>         <>< <>< <>< <><
>
>              IFREMER
>              Centre Manche Mer du Nord
>              150 quai Gambetta
>              62200 Boulogne-sur-Mer
>
>         <>< <>< <>< <><
>
>
>
>              Le 01/10/2013 16:41, Dimitri Liakhovitski a écrit :
>
>                  I have this weird data set with 2 predictors and one
>         dependent
>                  variable -
>                  attached.
>
>                  predictor1 has all zeros except for one 1.
>                  I am runnning a simple logistic regression:
>
>                  temp<-read.csv("x data for reg224.csv")
>                  myreg<- glm(dv~predictor1+predictor2,____data=temp,
>
>                                 family=binomial("logit"))
>                  myreg$coef2
>
>                  Everything runs fine and I get the coefficients - and
>         the fact
>                  that there
>                  is only one 1 on one of the predictors doesn't seem to
>         cause any
>                  problems.
>
>                  However, when I run the same regression in SAS, I get
>         warnings:
>                     Model Convergence Status  Quasi-complete separation
>         of data
>                  points
>                  detected.
>
>                  Warning: The maximum likelihood estimate may not exist.
>                  Warning: The LOGISTIC procedure continues in spite of
>         the above
>                  warning.
>                  Results shown are based on the last maximum likelihood
>                  iteration. Validity
>                  of the model fit is questionable.
>
>                  And the coefficients SAS produces are quite different
>         from mine.
>
>                  I know I'll probably get screamed at because it's not a
>         pure R
>                  question -
>                  but any idea why R is not giving me any warnings in such a
>                  situation?
>                  Does it have no problems with ML estimation in this case?
>
>                  Thanks a lot!
>
>
>
>
>
>                  __________________________________________________
>         R-help at r-project.org <mailto:R-help at r-project.org>
>         <mailto:R-help at r-project.org <mailto:R-help at r-project.org>>
>         mailing list
>         https://stat.ethz.ch/mailman/____listinfo/r-help
>         <https://stat.ethz.ch/mailman/__listinfo/r-help>
>
>         <https://stat.ethz.ch/mailman/__listinfo/r-help
>         <https://stat.ethz.ch/mailman/listinfo/r-help>>
>                  PLEASE do read the posting guide
>         http://www.R-project.org/____posting-guide.html
>         <http://www.R-project.org/__posting-guide.html>
>
>         <http://www.R-project.org/__posting-guide.html
>         <http://www.R-project.org/posting-guide.html>>
>                  and provide commented, minimal, self-contained,
>         reproducible code.
>
>
>              __________________________________________________
>         R-help at r-project.org <mailto:R-help at r-project.org>
>         <mailto:R-help at r-project.org <mailto:R-help at r-project.org>>
>         mailing list
>         https://stat.ethz.ch/mailman/____listinfo/r-help
>         <https://stat.ethz.ch/mailman/__listinfo/r-help>
>
>         <https://stat.ethz.ch/mailman/__listinfo/r-help
>         <https://stat.ethz.ch/mailman/listinfo/r-help>>
>              PLEASE do read the posting guide
>         http://www.R-project.org/____posting-guide.html
>         <http://www.R-project.org/__posting-guide.html>
>
>         <http://www.R-project.org/__posting-guide.html
>         <http://www.R-project.org/posting-guide.html>>
>              and provide commented, minimal, self-contained,
>         reproducible code.
>
>
>
>
>         --
>         Dimitri Liakhovitski
>
>
>
>
> --
> Dimitri Liakhovitski



More information about the R-help mailing list