Announcement

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

  • Error: "combinations results in numeric overflow; computations cannot proceed"

    Hi folks, I'm running a logit analysis on the data below. Whenever I run the command I get the error: "2,495 (group size) take 1,842 (# positives) combinations results in numeric overflow; computations cannot proceed"

    This is the command: xtlogit voted ldmission gender age age2 education i.urbrur living_cond , fe base
    I notice that when I take out the "fe" function in the command it runs but I'm worried it might not be producing fixed effects outputs.


    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int voted float ldmission byte gender float(age age2 education) byte(urbrur living_cond)
    0 4.4834156 2  18   324 0 2  1
    1  3.173777 1  32  1024 2 1  1
    0 3.7361965 1  22   484 4 1  3
    1 4.6246815 2  35  1225 0 1  4
    1  5.955427 1  50  2500 0 2  2
    1  5.862669 2  38  1444 1 1  1
    1  5.745714 1  27   729 0 2  4
    1 3.9782374 2  28   784 2 2  1
    1  4.136912 2  50  2500 0 2  2
    1  5.747981 1  68  4624 2 2  4
    1  4.410906 1  35  1225 0 2  1
    1  3.323553 2  40  1600 0 2  1
    1  5.982428 2  20   400 2 2  1
    0  3.579334 1  18   324 4 1  2
    1  5.628507 1  37  1369 4 2  3
    0  3.911558 2  20   400 0 2  5
    1 4.4387226 2  35  1225 0 2  3
    1  4.873805 1  60  3600 2 2  3
    1  3.579334 2  32  1024 6 1  1
    1  3.640578 2  60  3600 0 2  1
    1  2.417442 2  30   900 0 2  2
    0  3.579334 2  34  1156 5 1  3
    1  5.263743 1  36  1296 2 1  2
    1 3.7361965 1  21   441 4 1  1
    1 3.7211545 1  48  2304 0 1  3
    1 2.7046986 1  52  2704 8 1  3
    1  4.000275 1  50  2500 0 1  5
    1  4.236455 1  32  1024 2 2  3
    0  5.369433 2  25   625 0 2  3
    1  2.901977 1  34  1156 2 1  3
    1  3.725147 1  20   400 3 2 -1
    1  5.355619 1 101 10201 2 1  2
    0  3.579334 2  46  2116 0 1  2
    1  4.855227 2  26   676 2 2  1
    1 3.1338394 1  28   784 0 2  3
    1  4.060231 2  45  2025 0 2  4
    1  3.680366 1  45  2025 0 2  3
    1  3.759725 2  36  1296 4 2  3
    1  5.277364 1  42  1764 2 2  3
    1  3.911558 1  30   900 2 2  5
    1  4.000275 2  60  3600 0 1  1
    0  3.086412 1  20   400 6 2  4
    1  5.941229 2  50  2500 0 2  4
    1 4.6305914 2  32  1024 0 2  2
    1  2.627803 2  25   625 0 1  3
    1  4.657214 1  22   484 0 1  4
    1 4.5237155 1  27   729 2 2  4
    1 3.9761255 1  35  1225 0 2  1
    1  3.579334 2  58  3364 0 1  2
    1   5.83516 1  37  1369 4 1  4
    1  2.901977 2  30   900 0 1  3
    1  5.355619 1  21   441 4 1  3
    1  5.910907 2  21   441 0 2  2
    1  3.725147 1  38  1444 0 2  3
    1  3.385808 2  58  3364 0 2  3
    1  5.955427 2  18   324 0 2  3
    1   5.26296 2  28   784 5 1  3
    1  3.723254 1  46  2116 4 1  4
    1 3.6986585 1  35  1225 4 2  3
    1   3.11336 2  38  1444 0 2  1
    1  6.085116 1  68  4624 2 2  5
    1  3.579334 2  56  3136 0 1  2
    1  3.723254 2  22   484 0 1  1
    1  3.736703 2  37  1369 0 2  1
    1  .9693093 2  32  1024 0 2  2
    1  3.579334 1  49  2401 5 1  1
    1  3.640578 1  30   900 0 2  1
    1 4.3990054 2  26   676 0 2  4
    1  3.382383 2  27   729 1 2  3
    1  3.579334 1  45  2025 2 1  1
    0  5.056239 2  19   361 0 1  2
    0 4.4614034 2  19   361 4 2  5
    1  3.579334 1  35  1225 4 1  3
    0  2.253905 2  18   324 4 2  1
    1   2.55111 2  54  2916 3 1  3
    1  3.579334 2  24   576 4 1  4
    1  3.385808 1  25   625 3 2  3
    1 4.4012403 1  41  1681 0 2  2
    1  5.319653 1  20   400 0 2  4
    1  2.783074 1  25   625 4 2  2
    1   5.52411 2  35  1225 0 2  4
    1  5.503531 1  55  3025 4 2  4
    1  3.556062 2  35  1225 0 2  1
    1  3.911558 2  38  1444 0 2  1
    1  5.862669 2  22   484 0 1  3
    1  5.745714 2  25   625 4 2  4
    0 3.7211545 1  20   400 3 1  3
    1  5.264586 1  34  1156 0 1  2
    1  3.725147 2  44  1936 2 2  4
    0  5.007741 2  20   400 2 2  2
    1  3.725147 1  21   441 4 2  1
    1   2.55111 1  40  1600 0 1  2
    1  3.086412 1  62  3844 . 2  1
    1  3.173777 2  50  2500 4 1  2
    1  5.319653 1  35  1225 4 2  2
    1  3.334839 2  70  4900 0 1  4
    1 3.7211545 2  32  1024 2 1  3
    1  3.579334 2  27   729 0 1  3
    1 3.9761255 2  62  3844 0 2  2
    1  5.653682 1  55  3025 0 2  1
    end
    label values voted voted
    label def voted 0 "No", modify
    label def voted 1 "Yes", modify
    label values gender LABAR
    label def LABAR 1 "male", modify
    label def LABAR 2 "female", modify
    label values urbrur urbrur
    label def urbrur 1 "urban", modify
    label def urbrur 2 "rural", modify
    label values living_cond LABI
    label def LABI -1 "missing", modify
    label def LABI 1 "much worse", modify
    label def LABI 2 "worse", modify
    label def LABI 3 "same", modify
    label def LABI 4 "better", modify
    label def LABI 5 "much better", modify

  • #2
    Translated into somewhat plainer English, the error message is telling you that somewhere in the data set, you have a panel which contains 2,495 observations, of which 1,842 have voted == 1. To calculation the contribution of that panel to the likelihood function that Stata is trying to maximize, Stata is attempting to compute* the mathematical function 2495C1842 = (2495!)/(1842!*(2495-1842!)) = (2495*2494*2493*...*1844*1843)/(653*652*651*...*3*2*1). You might imagine just from looking at it that this is a truly enormous number. What Stata is telling you is that it is so enormous that it is not possible to represent it as a floating-point number ("numeric overflow"). In fact, it is of the order of magnitude of 10621. The largest floating point numbers representable in standard double precision format are of the order of magnitude of 10308.

    So it is simply not possible to do this fixed-effects logistic regression in Stata. Given that the problem is this huge number, I suspect that you will encounter the same problem with any other statistical package on the same hardware. One would need, I believe, to go to a machine that uses larger precision representations of floating point numbers, including a larger exponent, so that numbers of this magnitude can be represented.

    You correctly observe that if you remove -fe- from the command, the problem disappears. This is because you are no longer fitting a fixed-effects model--the command defaults to random effects when nothing else is specified. The random effects model has a different likelihood function that does not require the calculation of these massive combinatorial numbers.

    Now, you may be able to get around this by using an unconditional fixed-effects estimator:
    Code:
    logit voted ldmission gender age age2 education i.urbrur living_cond i.panel_variable
    (replace panel_variable by the actual name of the panel variable, the one you used in your -xtset- command.)

    While this is not generally acceptable, because of the known problem of incidental parameters bias in unconditional non-linear models, that bias is negligible when all of the panels have very large size. So if your panel size of 2,495 is more or less representative of all the panel sizes in your data, this will work and give you acceptable results. (Well, it will work if the number of panels is not so large as to breach the upper limit on matrix sizes.) If, however, this panel is just an outlier in terms of its size, then this approach is not useful.

    *Stata does not actually directly evaluate 2495C1842, which arises as the size of a set over which an exponential of the linear predictor is summed to form the denominator of the likelihood. Rather, the sum is calculated through a recursive formula. The recursive formula incorporates the exponential of the linear predictor as well, but it is analogous to a walk through Pascal's triangle. Nevertheless, the problem remains that the final result is too large a number to represent, and the calculation aborts.

    Comment


    • #3
      This is helpful, Clyde Schechter. Thank you. I'll look into the data for the appropriateness of an unconditional fixed effects model.

      Comment

      Working...
      X