Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convergence problems

    Hi,

    I am trying to calculate RR using logistic regression but there are apparently some convergence problems:

    . glm resistance_new i.sa4code_analysis, family (binomial) link(log) eform


    Iteration 0: log likelihood = -4999.9042 (not concave)
    Iteration 1: log likelihood = -3998.9689 (not concave)
    Iteration 2: log likelihood = -3961.6864 (not concave)
    Iteration 3: log likelihood = -3954.0891 (not concave)
    Iteration 4: log likelihood = -3953.9001 (not concave)
    Iteration 5: log likelihood = -3953.8996 (not concave)
    Iteration 6: log likelihood = -3953.8996 (not concave)
    Iteration 7: log likelihood = -3953.8996 (not concave)
    Iteration 8: log likelihood = -3953.8996 (not concave)
    Iteration 9: log likelihood = -3953.8996 (not concave)
    Iteration 10: log likelihood = -3953.8996 (not concave)
    Iteration 11: log likelihood = -3953.8996 (not concave)
    Iteration 12: log likelihood = -3953.8996 (not concave)
    Iteration 13: log likelihood = -3953.8995 (not concave)
    Iteration 14: log likelihood = -3953.8995 (not concave)
    Iteration 15: log likelihood = -3953.8995 (not concave)
    Iteration 16: log likelihood = -3953.8995 (not concave)
    Iteration 17: log likelihood = -3953.8995 (not concave)
    Iteration 18: log likelihood = -3953.8995 (not concave)


    When I specify number of iterations at 20, I get this:

    . glm resistance_new i.sa4code, family (binomial) link(log) eform iter(20)


    Iteration 0: log likelihood = -4999.9042 (not concave)
    Iteration 1: log likelihood = -3998.9689 (not concave)
    Iteration 2: log likelihood = -3961.6864 (not concave)
    Iteration 3: log likelihood = -3954.0891 (not concave)
    Iteration 4: log likelihood = -3953.9001 (not concave)
    Iteration 5: log likelihood = -3953.8996 (not concave)
    Iteration 6: log likelihood = -3953.8996 (not concave)
    Iteration 7: log likelihood = -3953.8996 (not concave)
    Iteration 8: log likelihood = -3953.8996 (not concave)
    Iteration 9: log likelihood = -3953.8996 (not concave)
    Iteration 10: log likelihood = -3953.8996 (not concave)
    Iteration 11: log likelihood = -3953.8996 (not concave)
    Iteration 12: log likelihood = -3953.8996 (not concave)
    Iteration 13: log likelihood = -3953.8995 (not concave)
    Iteration 14: log likelihood = -3953.8995 (not concave)
    Iteration 15: log likelihood = -3953.8995 (not concave)
    Iteration 16: log likelihood = -3953.8995 (not concave)
    Iteration 17: log likelihood = -3953.8995 (not concave)
    Iteration 18: log likelihood = -3953.8995 (not concave)
    Iteration 19: log likelihood = -3953.8995 (not concave)
    Iteration 20: log likelihood = -3953.8995 (not concave)
    convergence not achieved

    Generalized linear models No. of obs = 7,651
    Optimization : ML Residual df = 7,633
    Scale parameter = 1
    Deviance = 7907.799058 (1/df) Deviance = 1.036001
    Pearson = 6400006511 (1/df) Pearson = 838465.4

    Variance function: V(u) = u*(1-u) [Bernoulli]
    Link function : g(u) = ln(u) [Log]

    AIC = 1.038269
    Log likelihood = -3953.899529 BIC = -60351

    --------------------------------------------------------------------------------
    | OIM
    resistance_new | Risk Ratio Std. Err. z P>|z| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    sa4code |
    302 | .3186184 .0543363 -6.71 0.000 .2280916 .4450742
    303 | .27928 .0513765 -6.93 0.000 .1947387 .4005229
    304 | .4046953 .1011731 -3.62 0.000 .2479301 .6605824
    305 | .2603081 .0624054 -5.61 0.000 .1627134 .4164395
    306 | .231827 .0414789 -8.17 0.000 .1632547 .3292019
    307 | .4443705 .1560037 -2.31 0.021 .2233144 .8842472
    308 | .5627156 .0598641 -5.40 0.000 .4568089 .6931758
    309 | .2273888 .0338319 -9.95 0.000 .1698727 .304379
    310 | .5681479 .0649963 -4.94 0.000 .4540292 .71095
    311 | .3718394 .0459352 -8.01 0.000 .2918784 .4737058
    312 | 2.470708 .0673254 33.19 0.000 2.342214 2.60625
    313 | .2835836 .0781954 -4.57 0.000 .165185 .4868458
    314 | .327395 .059736 -6.12 0.000 .2289618 .4681458
    315 | .6347662 .0340739 -8.47 0.000 .5713758 .7051894
    316 | 2.231104 .0917053 19.52 0.000 2.058415 2.418282
    317 | 1.011726 .2652771 0.04 0.965 .6051682 1.691415
    318 | 3.322281 . . . . .
    319 | .59012 .0511128 -6.09 0.000 .4979826 .6993048
    |
    _cons | .3088778 3.86e-10 -9.4e+08 0.000 .3088778 .3088778
    --------------------------------------------------------------------------------
    Note: _cons estimates baseline risk.
    Warning: parameter estimates produce inadmissible mean estimates in one or
    more observations.
    Warning: convergence not achieved


    Apparently, there is a problem with sa4code=318. Is there any way I could correct this? Option of converting this categorical variable to continuous is not possible in this case. I tried to change the baseline but didn't work either.

    Thanks in advance.

    Andrea

  • #2
    Do you want the link to be log or logit?

    Output would be much easier to read if you used code tags. See pt #12 in the FAQ.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      for RR, there are well-known problems using -glm-; I recommend using -poisson- to get IRR (essentially the same thing), just remember to use "vce(robust)" as an option; the main problem with using -poisson- for this is inefficiency; thus, if your sample size is small, you have no good alternatives

      Comment

      Working...
      X