Announcement

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

  • Fixed effects conditional logit model, problems with Age and Year's effect

    Hello everyone,

    I am using unbalanced panel data on individual respondents (T = 11 and N = 83687). I am running a conditional logit model with fixed effects, the dependent variable it's a dummy (at time t) and I run most of the covariates with a lag of one year in (t-1).
    I'm using regional (i.region) and year's effects (i.syear). My problem is due to convergence. If I run the fixed effects conditional logit model with all the year's effects (i.syear) and the covariates Age and Age2 (using squared Age to model the age effect) I get no convergence. Therefore, considering that I got no standard errors (.) in the year effect 2019, I tried to create myself a dummy variable for each year I'm considering and I excluded the year 2019 effect (because I thought there were not enough observations to achieve the convergence). In that case, it works fine and the convergence it's achieved.

    Moreover, I tried to consider instead of Age and Age2 some Age Categories ( 5 categories). With the Age categories everything it's working fine and the convergence it's achieved considering all the year's effects (by using i.syear).

    I think I will probably consider the Age categories model for my final version but I was wondering why was the convergence not achieved when considering the Age and Age2 and all the year's effects (i.syear) and on the contrary, it was when considering the Age categories and all the year's effects?

    here there is the code:

    Code:
    . xtlogit resigning L.insecurity L.ln_income i.region i.syear L.age L.age2 i.L.married i.L.health_status1    L.ye
    > ars_of_education L.n_of_children L.annual_working_hours, fe iterate(20)
    note: multiple positive outcomes within groups encountered.
    note: 12,229 groups (50,752 obs) omitted because of all positive or
    all negative outcomes.
    
    Iteration 0:   log likelihood = -4954.8824  (not concave)
    Iteration 1:   log likelihood = -4923.8604  (not concave)
    Iteration 2:   log likelihood = -4918.2668  (not concave)
    Iteration 3:   log likelihood = -4917.9681  (not concave)
    Iteration 4:   log likelihood = -4917.8448  (not concave)
    Iteration 5:   log likelihood = -4917.7838  (not concave)
    Iteration 6:   log likelihood = -4917.6602  (not concave)
    Iteration 7:   log likelihood = -4917.6032  (not concave)
    Iteration 8:   log likelihood = -4917.3976  (not concave)
    Iteration 9:   log likelihood = -4917.3279  (not concave)
    Iteration 10:  log likelihood = -4917.3174  (not concave)
    Iteration 11:  log likelihood = -4917.3072  (not concave)
    Iteration 12:  log likelihood = -4917.2688  (not concave)
    Iteration 13:  log likelihood = -4917.2554  (not concave)
    Iteration 14:  log likelihood = -4917.2542  (not concave)
    Iteration 15:  log likelihood = -4917.2531  (not concave)
    Iteration 16:  log likelihood =  -4917.252  (not concave)
    Iteration 17:  log likelihood = -4917.2511  (not concave)
    Iteration 18:  log likelihood = -4917.2502  (not concave)
    Iteration 19:  log likelihood = -4917.2493  (not concave)
    Iteration 20:  log likelihood = -4917.2485  (not concave)
    convergence not achieved
    
    Conditional fixed-effects logistic regression        Number of obs    = 13,872
    Group variable: pid                                  Number of groups =  2,474
    
    Obs per group:
    min =      2
    avg =    5.6
    max =     10
    
    LR chi2(34)      = 196.67
    Log likelihood = -4917.2485                          Prob > chi2      = 0.0000
    
    
    resigning  Coefficient  Std. err.      z    P>z     [95% conf. interval]
    
    insecurity 
    L1.    .1586778   .0395872     4.01   0.000     .0810883    .2362673
    
    ln_income 
    L1.   -.0959634   .1089586    -0.88   0.378    -.3095183    .1175914
    
    region 
    2    -.0029459   .6049219    -0.00   0.996    -1.188571    1.182679
    3     .0213726   .8443094     0.03   0.980    -1.633444    1.676189
    4     54.71097          .        .       .            .           .
    5     -1.05323   .7851114    -1.34   0.180     -2.59202    .4855604
    6    -.3901004   .8363038    -0.47   0.641    -2.029226    1.249025
    7     .6840851   1.003371     0.68   0.495    -1.282485    2.650655
    8     .5695272   .8315001     0.68   0.493    -1.060183    2.199237
    9     .0330805   .8980872     0.04   0.971    -1.727138    1.793299
    10    -43.49452   1.72e+09    -0.00   1.000    -3.38e+09    3.38e+09
    11     .9676775   .9933413     0.97   0.330    -.9792356    2.914591
    12     .7399395   1.002769     0.74   0.461    -1.225452    2.705332
    13     .8720612   1.059855     0.82   0.411    -1.205217    2.949339
    14    -.1655239   1.044938    -0.16   0.874    -2.213564    1.882517
    15    -1.174527   1.385044    -0.85   0.396    -3.889163    1.540109
    16    -1.920376   1.317821    -1.46   0.145    -4.503258    .6625068
    
    syear 
    2011     .1142141   .0922802     1.24   0.216    -.0666517    .2950799
    2012      .162089   .0917376     1.77   0.077    -.0177134    .3418914
    2013     .2067589   .0895892     2.31   0.021     .0311674    .3823505
    2014     .1426668   .0795742     1.79   0.073    -.0132957    .2986292
    2015     .0924091   .0750384     1.23   0.218    -.0546635    .2394818
    2016     .0959823   .0722217     1.33   0.184    -.0455696    .2375341
    2017     .0659704   .0703078     0.94   0.348    -.0718303    .2037711
    2018     .1146478   .0704689     1.63   0.104    -.0234688    .2527643
    2019     .0564252          .        .       .            .           .
    
    age 
    L1.   -.1092868   .0493051    -2.22   0.027     -.205923   -.0126507
    
    age2 
    L1.    .0007596   .0005432     1.40   0.162    -.0003051    .0018242
    
    L.married 
    1    -.1836457   .1240138    -1.48   0.139    -.4267083    .0594169
    
    L.health_status1 
    2     .4764549   .2225177     2.14   0.032     .0403282    .9125817
    3     .1984931   .2217544     0.90   0.371    -.2361375    .6331237
    4     .1046584   .2238471     0.47   0.640    -.3340738    .5433906
    5     .2330741   .2369465     0.98   0.325    -.2313325    .6974807
    
    years_of_education 
    L1.   -.0513078   .0984258    -0.52   0.602    -.2442188    .1416031
    
    n_of_children 
    L1.   -.1159357   .0600321    -1.93   0.053    -.2335965    .0017251
    
    annual_working_hours 
    L1.   -.0003312   .0000471    -7.03   0.000    -.0004236   -.0002388
    Code:
    . xtlogit resigning L.insecurity L.ln_income $yearsdummy i.region L.age L.age2 i.L.sex i.L.married    i.L.health_
    > status1 L.years_of_education L.n_of_children L.annual_working_hours, fe iterate(20)
    note: multiple positive outcomes within groups encountered.
    note: 12,229 groups (50,752 obs) omitted because of all positive or
    all negative outcomes.
    note: 1L.sex omitted because of no within-group variance.
    
    Iteration 0:   log likelihood = -4953.8719  
    Iteration 1:   log likelihood = -4917.7094  
    Iteration 2:   log likelihood = -4917.2589  
    Iteration 3:   log likelihood = -4917.2287  
    Iteration 4:   log likelihood = -4917.2222  
    Iteration 5:   log likelihood = -4917.2207  
    Iteration 6:   log likelihood = -4917.2204  
    Iteration 7:   log likelihood = -4917.2203  
    Iteration 8:   log likelihood = -4917.2203  
    
    Conditional fixed-effects logistic regression        Number of obs    = 13,872
    Group variable: pid                                  Number of groups =  2,474
    
    Obs per group:
    min =      2
    avg =    5.6
    max =     10
    
    LR chi2(35)      = 196.73
    Log likelihood = -4917.2203                          Prob > chi2      = 0.0000
    
    
    resigning  Coefficient  Std. err.      z    P>z     [95% conf. interval]
    
    insecurity 
    L1.    .1595486   .0395919     4.03   0.000       .08195    .2371473
    
    ln_income 
    L1.   -.0939751   .1089648    -0.86   0.388    -.3075422     .119592
    
    year11    .1067305   .0922694     1.16   0.247    -.0741142    .2875752
    year12    .1484747   .0917286     1.62   0.106      -.03131    .3282595
    year13    .1870052   .0895873     2.09   0.037     .0114174    .3625931
    year14    .1159637   .0795739     1.46   0.145    -.0399984    .2719258
    year15    .0599535    .075038     0.80   0.424    -.0871184    .2070253
    year16    .0574416   .0722222     0.80   0.426    -.0841113    .1989945
    year17    .0212388   .0703086     0.30   0.763    -.1165636    .1590412
    year18    .0639982   .0704692     0.91   0.364     -.074119    .2021153
    
    region 
    2     -.010283   .6049746    -0.02   0.986    -1.196011    1.175445
    3     .0200304   .8440641     0.02   0.981    -1.634305    1.674366
    4     23.77858   26989.53     0.00   0.999    -52874.74     52922.3
    5    -1.056672   .7848169    -1.35   0.178    -2.594885    .4815409
    6    -.3918029    .836058    -0.47   0.639    -2.030447    1.246841
    7     .6866278   1.003021     0.68   0.494    -1.279258    2.652514
    8     .5670053   .8313347     0.68   0.495    -1.062381    2.196391
    9     .0289339   .8978407     0.03   0.974    -1.730801    1.788669
    10    -14.35951   810.0542    -0.02   0.986    -1602.037    1573.318
    11      .966391   .9924808     0.97   0.330    -.9788356    2.911618
    12     .7433985   1.002162     0.74   0.458    -1.220804    2.707601
    13       .87058   1.059877     0.82   0.411    -1.206741    2.947901
    14    -.1643945   1.044952    -0.16   0.875    -2.212463    1.883674
    15    -1.177462   1.385052    -0.85   0.395    -3.892115     1.53719
    16    -1.923164   1.317747    -1.46   0.144    -4.505901    .6595729
    
    age 
    L1.   -.1143711   .0492992    -2.32   0.020    -.2109957   -.0177464
    
    age2 
    L1.     .000883   .0005431     1.63   0.104    -.0001814    .0019474
    
    L.sex 
    1            0  (omitted)
    
    L.married 
    1    -.1807483   .1240086    -1.46   0.145    -.4238007    .0623041
    
    L.health_status1 
    2     .4649026   .2221624     2.09   0.036     .0294722    .9003329
    3     .1864222   .2213913     0.84   0.400    -.2474967    .6203412
    4     .0925622   .2234899     0.41   0.679    -.3454699    .5305943
    5     .2207287   .2366089     0.93   0.351    -.2430162    .6844736
    
    years_of_education 
    L1.   -.0487996   .0984007    -0.50   0.620    -.2416614    .1440622
    
    n_of_children 
    L1.    -.112988   .0600387    -1.88   0.060    -.2306617    .0046858
    
    annual_working_hours 
    L1.   -.0003305   .0000471    -7.01   0.000    -.0004229   -.0002381
    and with Age categories

    Code:
    . xtlogit resigning L.insecurity L.ln_income i.syear i.region i.L.age_cate i.L.sex i.L.married    i.L.health_stat
    > us1 L.years_of_education L.n_of_children L.annual_working_hours, fe iterate(20)
    note: multiple positive outcomes within groups encountered.
    note: 12,207 groups (50,651 obs) omitted because of all positive or
    all negative outcomes.
    note: 1L.sex omitted because of no within-group variance.
    
    Iteration 0:   log likelihood = -4954.8564  
    Iteration 1:   log likelihood =    -4914.5  
    Iteration 2:   log likelihood = -4914.0655  
    Iteration 3:   log likelihood = -4914.0341  
    Iteration 4:   log likelihood = -4914.0284  
    Iteration 5:   log likelihood = -4914.0271  
    Iteration 6:   log likelihood = -4914.0269  
    Iteration 7:   log likelihood = -4914.0268  
    Iteration 8:   log likelihood = -4914.0268  
    
    Conditional fixed-effects logistic regression        Number of obs    = 13,866
    Group variable: pid                                  Number of groups =  2,474
    
    Obs per group:
    min =      2
    avg =    5.6
    max =     10
    
    LR chi2(37)      = 201.15
    Log likelihood = -4914.0268                          Prob > chi2      = 0.0000
    
    
    resigning  Coefficient  Std. err.      z    P>z     [95% conf. interval]
    
    insecurity 
    L1.    .1568622   .0395197     3.97   0.000      .079405    .2343195
    
    ln_income 
    L1.   -.0901518   .1090069    -0.83   0.408    -.3038015    .1234978
    
    syear 
    2011     .0686782   .0977131     0.70   0.482    -.1228359    .2601924
    2012     .0736324   .1028235     0.72   0.474    -.1278979    .2751627
    2013      .080782   .1058594     0.76   0.445    -.1266987    .2882627
    2014    -.0216384   .1040958    -0.21   0.835    -.2256624    .1823856
    2015    -.1144291   .1060272    -1.08   0.280    -.3222386    .0933803
    2016    -.1529156   .1085844    -1.41   0.159    -.3657372     .059906
    2017    -.2264816   .1120058    -2.02   0.043     -.446009   -.0069543
    2018    -.2151943   .1162956    -1.85   0.064    -.4431294    .0127408
    2019     -.319139   .1217926    -2.62   0.009     -.557848   -.0804299
    
    region 
    2    -.0053282   .6031277    -0.01   0.993    -1.187437     1.17678
    3    -.0144088   .8435746    -0.02   0.986    -1.667785    1.638967
    4      23.9593   29766.11     0.00   0.999    -58316.55    58364.47
    5    -1.077494   .7862965    -1.37   0.171    -2.618607    .4636191
    6    -.4071589   .8362864    -0.49   0.626     -2.04625    1.231932
    7      .658063   1.002816     0.66   0.512     -1.30742    2.623546
    8     .5285258   .8313712     0.64   0.525    -1.100932    2.157983
    9     .0023187   .8976535     0.00   0.998     -1.75705    1.761687
    10    -14.84499   1041.706    -0.01   0.989    -2056.552    2026.862
    11     .9501312   .9967343     0.95   0.340    -1.003432    2.903694
    12     .6816164   1.005483     0.68   0.498    -1.289094    2.652327
    13     .8610184   1.057921     0.81   0.416    -1.212469    2.934506
    14    -.2024885   1.044481    -0.19   0.846    -2.249633    1.844656
    15    -1.178271   1.384005    -0.85   0.395     -3.89087    1.534328
    16    -1.944648   1.316166    -1.48   0.140    -4.524285    .6349899
    
    L.age_cate1 
    2    -.3518934   .1504093    -2.34   0.019    -.6466902   -.0570965
    3    -.3433212   .1950824    -1.76   0.078    -.7256756    .0390332
    4    -.2346913   .2379139    -0.99   0.324     -.700994    .2316115
    
    L.sex 
    1            0  (omitted)
    
    L.married 
    1    -.1878148   .1241472    -1.51   0.130    -.4311388    .0555092
    
    L.health_status1 
    2     .4630734    .222156     2.08   0.037     .0276556    .8984911
    3     .1842551   .2213972     0.83   0.405    -.2496754    .6181855
    4     .0916305   .2234936     0.41   0.682     -.346409    .5296699
    5     .2184561   .2366326     0.92   0.356    -.2453354    .6822476
    
    years_of_education 
    L1.   -.0569611   .0980777    -0.58   0.561    -.2491898    .1352676
    
    n_of_children 
    L1.   -.1095408   .0597734    -1.83   0.067    -.2266946     .007613
    
    annual_working_hours 
    L1.   -.0003309   .0000471    -7.02   0.000    -.0004233   -.0002385
    Thank you for your help.

    Alessandro

  • #2
    Alessandro:
    welcome to this forum-
    I'm not sure if what follows cam be an answer to your issue, but creating a linear and a squared term for the same variable (instead of relying on -fvvarlist- notation) can increase convergence problem, as Stata consider them as two different variables.
    What if you go:
    Code:
    L.age##L.age
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you very much for your answer, Carlo. I'll try it now.

      Comment


      • #4
        I did try what you suggested and the convergence it's actually achieved with your command.

        Code:
        . xtlogit resignin L.insecurity L.ln_income i.region i.syear L.age##L.age i.L.married i.L.health_status1    L.ye
        > ars_of_education L.n_of_children L.annual_working_hours, fe iterate(20)
        note: multiple positive outcomes within groups encountered.
        note: 12,229 groups (50,752 obs) omitted because of all positive or
        all negative outcomes.
        note: 75L.age omitted because of no within-group variance.
        note: 76L.age omitted because of no within-group variance.
        note: 77L.age omitted because of no within-group variance.
        note: 78L.age omitted because of no within-group variance.
        note: 79L.age omitted because of no within-group variance.
        note: 80L.age omitted because of no within-group variance.
        note: 81L.age omitted because of no within-group variance.
        note: 89L.age omitted because of no within-group variance.
        note: 90L.age omitted because of no within-group variance.
        
        Iteration 0:   log likelihood = -4924.8066  (not concave)
        Iteration 1:   log likelihood = -4886.3771  (not concave)
        Iteration 2:   log likelihood = -4884.2786  (not concave)
        Iteration 3:   log likelihood = -4881.7287  (not concave)
        Iteration 4:   log likelihood = -4881.2378  (not concave)
        Iteration 5:   log likelihood = -4880.9989  (not concave)
        Iteration 6:   log likelihood = -4880.8407  
        Iteration 7:   log likelihood = -4874.7921  (not concave)
        Iteration 8:   log likelihood = -4874.7851  
        Iteration 9:   log likelihood = -4874.7805  (not concave)
        Iteration 10:  log likelihood = -4874.7805  (not concave)
        Iteration 11:  log likelihood = -4874.7804  (not concave)
        Iteration 12:  log likelihood = -4874.7804  (not concave)
        Iteration 13:  log likelihood = -4874.7804  
        
        Conditional fixed-effects logistic regression        Number of obs    = 13,872
        Group variable: pid                                  Number of groups =  2,474
        
        Obs per group:
        min =      2
        avg =    5.6
        max =     10
        
        LR chi2(33)      = 281.61
        Log likelihood = -4874.7804                          Prob > chi2      = 0.0000
        
        
        resignin  Coefficient  Std. err.      z    P>z     [95% conf. interval]
        
        insecurity 
        L1.    .1731396    .040145     4.31   0.000     .0944569    .2518223
        
        ln_income 
        L1.   -.0854216   .1100344    -0.78   0.438     -.301085    .1302417
        
        region 
        2    -.0858452   .6053189    -0.14   0.887    -1.272248    1.100558
        3    -.0334152   .8441329    -0.04   0.968    -1.687885    1.621055
        4     31.61253    1357427     0.00   1.000     -2660476     2660539
        5    -1.116175   .7876348    -1.42   0.156    -2.659911    .4275609
        6    -.4549247   .8382414    -0.54   0.587    -2.097848    1.187998
        7     .6425368   1.008681     0.64   0.524    -1.334441    2.619515
        8     .4972582   .8318461     0.60   0.550     -1.13313    2.127647
        9    -.1007028   .8990822    -0.11   0.911    -1.862871    1.661466
        10    -20.47941   18161.98    -0.00   0.999    -35617.31    35576.36
        11     1.010452   .9993453     1.01   0.312    -.9482288    2.969133
        12     .7041266   1.012967     0.70   0.487    -1.281253    2.689506
        13     .8711515   1.074713     0.81   0.418    -1.235247     2.97755
        14    -.2317229   1.052131    -0.22   0.826    -2.293862    1.830416
        15     -1.25657   1.395447    -0.90   0.368    -3.991597    1.478457
        16    -1.955408   1.317524    -1.48   0.138    -4.537707     .626891
        
        syear 
        2011    -.5215926   526128.3    -0.00   1.000     -1031193     1031192
        2012      -1.1301    1052257    -0.00   1.000     -2062386     2062384
        2013    -1.734734    1578385    -0.00   1.000     -3093579     3093576
        2014    -2.445464    2104513    -0.00   1.000     -4124772     4124767
        2015    -3.160096    2630641    -0.00   1.000     -5155965     5155959
        2016    -3.816079    3156770    -0.00   1.000     -6187159     6187151
        2017    -4.503509    3682898    -0.00   1.000     -7218352     7218343
        2018    -5.099108    4209026    -0.00   1.000     -8249545     8249535
        2019    -5.814061    4735154    -0.00   1.000     -9280738     9280726
        
        L.age 
        21    -14.22477     526129    -0.00   1.000     -1031208     1031180
        22    -14.49808    1052257    -0.00   1.000     -2062400     2062371
        23    -13.71678    1578385    -0.00   1.000     -3093592     3093565
        24      -13.332    2104513    -0.00   1.000     -4124784     4124757
        25    -12.33958    2630642    -0.00   1.000     -5155975     5155951
        26    -11.83848    3156770    -0.00   1.000     -6187167     6187144
        27    -11.80915    3682898    -0.00   1.000     -7218360     7218336
        28    -11.07769    4209027    -0.00   1.000     -8249551     8249529
        29    -10.72403    4735155    -0.00   1.000     -9280744     9280722
        30    -10.38078    5261283    -0.00   1.000    -1.03e+07    1.03e+07
        31    -9.610205    5787411    -0.00   1.000    -1.13e+07    1.13e+07
        32    -9.019671    6313540    -0.00   1.000    -1.24e+07    1.24e+07
        33     -8.62279    6839668    -0.00   1.000    -1.34e+07    1.34e+07
        34    -7.813861    7365796    -0.00   1.000    -1.44e+07    1.44e+07
        35    -7.273703    7891924    -0.00   1.000    -1.55e+07    1.55e+07
        36    -6.592699    8418053    -0.00   1.000    -1.65e+07    1.65e+07
        37    -6.139983    8944181    -0.00   1.000    -1.75e+07    1.75e+07
        38     -5.62687    9470309    -0.00   1.000    -1.86e+07    1.86e+07
        39    -4.694531    9996437    -0.00   1.000    -1.96e+07    1.96e+07
        40    -4.111663   1.05e+07    -0.00   1.000    -2.06e+07    2.06e+07
        41    -3.733726   1.10e+07    -0.00   1.000    -2.17e+07    2.17e+07
        42     -3.02814   1.16e+07    -0.00   1.000    -2.27e+07    2.27e+07
        43     -2.20537   1.21e+07    -0.00   1.000    -2.37e+07    2.37e+07
        44    -1.873841   1.26e+07    -0.00   1.000    -2.47e+07    2.47e+07
        45    -1.254301   1.32e+07    -0.00   1.000    -2.58e+07    2.58e+07
        46    -.5209168   1.37e+07    -0.00   1.000    -2.68e+07    2.68e+07
        47      .196691   1.42e+07     0.00   1.000    -2.78e+07    2.78e+07
        48     1.107385   1.47e+07     0.00   1.000    -2.89e+07    2.89e+07
        49     1.631821   1.53e+07     0.00   1.000    -2.99e+07    2.99e+07
        50     2.221574   1.58e+07     0.00   1.000    -3.09e+07    3.09e+07
        51     2.888617   1.63e+07     0.00   1.000    -3.20e+07    3.20e+07
        52     3.345772   1.68e+07     0.00   1.000    -3.30e+07    3.30e+07
        53     4.241327   1.74e+07     0.00   1.000    -3.40e+07    3.40e+07
        54     4.952747   1.79e+07     0.00   1.000    -3.51e+07    3.51e+07
        55     5.490245   1.84e+07     0.00   1.000    -3.61e+07    3.61e+07
        56     5.798003   1.89e+07     0.00   1.000    -3.71e+07    3.71e+07
        57     6.568023   1.95e+07     0.00   1.000    -3.82e+07    3.82e+07
        58     6.887176   2.00e+07     0.00   1.000    -3.92e+07    3.92e+07
        59     7.788285   2.05e+07     0.00   1.000    -4.02e+07    4.02e+07
        60     8.065138   2.10e+07     0.00   1.000    -4.12e+07    4.12e+07
        61     8.452867   2.16e+07     0.00   1.000    -4.23e+07    4.23e+07
        62     9.279859   2.21e+07     0.00   1.000    -4.33e+07    4.33e+07
        63     10.34993   2.26e+07     0.00   1.000    -4.43e+07    4.43e+07
        64     10.68859   2.31e+07     0.00   1.000    -4.54e+07    4.54e+07
        65     10.95062   2.37e+07     0.00   1.000    -4.64e+07    4.64e+07
        66     11.74541   2.42e+07     0.00   1.000    -4.74e+07    4.74e+07
        67     12.75738   2.47e+07     0.00   1.000    -4.85e+07    4.85e+07
        68     12.43254   2.53e+07     0.00   1.000    -4.95e+07    4.95e+07
        69    -6.040998   2.58e+07    -0.00   1.000    -5.05e+07    5.05e+07
        70    -4.656019   2.63e+07    -0.00   1.000    -5.16e+07    5.16e+07
        71    -4.370693   2.68e+07    -0.00   1.000    -5.26e+07    5.26e+07
        72    -3.712264   2.74e+07    -0.00   1.000    -5.36e+07    5.36e+07
        73    -3.105545   2.79e+07    -0.00   1.000    -5.47e+07    5.47e+07
        74    -2.422734   2.84e+07    -0.00   1.000    -5.57e+07    5.57e+07
        75            0  (empty)
        76            0  (empty)
        77            0  (empty)
        78            0  (empty)
        79            0  (empty)
        80            0  (empty)
        81            0  (empty)
        89            0  (empty)
        90            0  (empty)
        
        L.married 
        1    -.1846463   .1251609    -1.48   0.140    -.4299571    .0606645
        
        L.health_status1 
        2      .454165   .2239479     2.03   0.043     .0152352    .8930949
        3     .1718108   .2232293     0.77   0.442    -.2657106    .6093322
        4     .0728824   .2252964     0.32   0.746    -.3686905    .5144553
        5      .212181   .2386899     0.89   0.374    -.2556425    .6800046
        
        years_of_education 
        L1.   -.0143068   .0993486    -0.14   0.885    -.2090264    .1804128
        
        n_of_children 
        L1.      -.0754   .0623098    -1.21   0.226    -.1975249    .0467249
        
        annual_working_hours 
        L1.   -.0003315   .0000475    -6.97   0.000    -.0004246   -.0002383
        But what do I technically ask STATA when I type L.age##L.age (sorry I'm quite new to the software)?

        Thank you for your help.

        Kind regards,

        Alessandro

        Comment


        • #5
          Alessandro:
          you're basically asking an interaction between (lagged) -age- and itself.
          This code tells Stata that you want both the linear and the squared terms for the very same variabe -age-.
          This is very helpful, as, over and above making your regression easier, this way you have a priority lane to exploit the wonderful capabilities of -margisn. and -marginsplot- commands.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Ok, I get it. Thank you Carlo for your help.

            Kind regards,

            Alessandro

            Comment


            • #7
              Hi Carlo,

              I actually realised that with the code that you suggested I do not find the squared age effect, on the contrary, I think I might find the effect of Age if Age is considered as a categorical variable with 54 categories. While if I run the regression with the code:

              Code:
              c.L.age##c.L.age
              I get the squared term. With this new code, STATA still cannot find convergence. So I don't know if the convergence problem was caused by what you suggested in #3

              Here is the code:

              Code:
               xtlogit jobchange L.insecurity L.ln_income i.region i.syear c.L.age##c.L.age i.L.married i.L.health_status1 L.yea
              > rs_of_education L.n_of_children L.annual_working_hours if resignin1 == 0, fe iterate(40)
              note: multiple positive outcomes within groups encountered.
              note: 12,623 groups (55,604 obs) omitted because of all positive or
                    all negative outcomes.
              
              Iteration 0:   log likelihood = -5000.2675  (not concave)
              Iteration 1:   log likelihood = -4970.1339  (not concave)
              Iteration 2:   log likelihood = -4965.8388  (not concave)
              Iteration 3:   log likelihood = -4964.7925  (not concave)
              Iteration 4:   log likelihood = -4964.2802  (not concave)
              Iteration 5:   log likelihood = -4964.0256  (not concave)
              Iteration 6:   log likelihood = -4963.7475  (not concave)
              Iteration 7:   log likelihood = -4963.3296  (not concave)
              Iteration 8:   log likelihood = -4963.1443  (not concave)
              Iteration 9:   log likelihood =  -4963.002  (not concave)
              Iteration 10:  log likelihood = -4962.8849  (not concave)
              Iteration 11:  log likelihood = -4962.7828  (not concave)
              Iteration 12:  log likelihood = -4962.6791  (not concave)
              Iteration 13:  log likelihood =  -4962.601  (not concave)
              Iteration 14:  log likelihood = -4962.5308  (not concave)
              Iteration 15:  log likelihood = -4962.4606  (not concave)
              Iteration 16:  log likelihood = -4962.4027  (not concave)
              Iteration 17:  log likelihood = -4962.3511  (not concave)
              Iteration 18:  log likelihood = -4962.3021  (not concave)
              Iteration 19:  log likelihood = -4962.2592  (not concave)
              Iteration 20:  log likelihood = -4962.2206  (not concave)
              Iteration 21:  log likelihood = -4962.1851  (not concave)
              Iteration 22:  log likelihood = -4962.1531  (not concave)
              Iteration 23:  log likelihood = -4962.1242  (not concave)
              Iteration 24:  log likelihood = -4962.0979  (not concave)
              Iteration 25:  log likelihood = -4962.0741  (not concave)
              Iteration 26:  log likelihood = -4962.0525  (not concave)
              Iteration 27:  log likelihood =  -4962.033  (not concave)
              Iteration 28:  log likelihood = -4962.0153  (not concave)
              Iteration 29:  log likelihood = -4961.9992  (not concave)
              Iteration 30:  log likelihood = -4961.9923  (not concave)
              Iteration 31:  log likelihood = -4961.9872  (not concave)
              Iteration 32:  log likelihood = -4961.9822  (not concave)
              Iteration 33:  log likelihood = -4961.9374  (not concave)
              Iteration 34:  log likelihood =   -4961.89  (not concave)
              Iteration 35:  log likelihood = -4961.8844  (not concave)
              Iteration 36:  log likelihood =  -4961.883  (not concave)
              Iteration 37:  log likelihood = -4961.8819  (not concave)
              Iteration 38:  log likelihood = -4961.8808  (not concave)
              Iteration 39:  log likelihood = -4961.8797  (not concave)
              Iteration 40:  log likelihood = -4961.8787  (not concave)
              convergence not achieved
              
              Conditional fixed-effects logistic regression        Number of obs    = 14,507
              Group variable: pid                                  Number of groups =  2,472
              
                                                                   Obs per group:
                                                                                min =      2
                                                                                avg =    5.9
                                                                                max =     11
              
                                                                   LR chi2(35)      = 266.06
              Log likelihood = -4961.8787                          Prob > chi2      = 0.0000
              
              --------------------------------------------------------------------------------------
                         jobchange | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
              ---------------------+----------------------------------------------------------------
                        insecurity |
                               L1. |   .1686361   .0398847     4.23   0.000     .0904635    .2468086
                                   |
                         ln_income |
                               L1. |   -.124592   .1075287    -1.16   0.247    -.3353444    .0861603
                                   |
                            region |
                                2  |   .2909467   .5697053     0.51   0.610     -.825655    1.407549
                                3  |  -.0096278   .7890984    -0.01   0.990    -1.556232    1.536977
                                4  |   78.52162          .        .       .            .           .
                                5  |  -.5981331    .738387    -0.81   0.418    -2.045345    .8490788
                                6  |  -.8611125    .791931    -1.09   0.277    -2.413269    .6910437
                                7  |  -.1669472   .9298269    -0.18   0.858    -1.989374     1.65548
                                8  |   .0864494   .7810748     0.11   0.912    -1.444429    1.617328
                                9  |  -.4170926   .8429763    -0.49   0.621    -2.069296    1.235111
                               10  |    .617145   1.835276     0.34   0.737     -2.97993     4.21422
                               11  |   .6460224   .9387501     0.69   0.491    -1.193894    2.485939
                               12  |   .8378722   .9435949     0.89   0.375     -1.01154    2.687284
                               13  |   1.891317   1.061946     1.78   0.075    -.1900594    3.972693
                               14  |  -.6767784   .9460082    -0.72   0.474     -2.53092    1.177364
                               15  |  -1.110674   1.415976    -0.78   0.433    -3.885935    1.664588
                               16  |  -1.683184    1.10992    -1.52   0.129    -3.858587    .4922199
                                   |
                             syear |
                             2011  |   .1299577    .102722     1.27   0.206    -.0713738    .3312892
                             2012  |   .1784093   .1006204     1.77   0.076    -.0188031    .3756217
                             2013  |   .2792189   .0968137     2.88   0.004     .0894675    .4689704
                             2014  |   .1314178   .0879603     1.49   0.135    -.0409812    .3038168
                             2015  |   .1052914    .082946     1.27   0.204    -.0572797    .2678626
                             2016  |   .1319805   .0790316     1.67   0.095    -.0229186    .2868795
                             2017  |   .1080491   .0771426     1.40   0.161    -.0431476    .2592457
                             2018  |   .1030712   .0777513     1.33   0.185    -.0493186    .2554609
                             2019  |   .0092368    .079064     0.12   0.907    -.1457258    .1641994
                             2020  |  -.2364942          .        .       .            .           .
                                   |
                               age |
                               L1. |  -.1721143   .0467997    -3.68   0.000    -.2638401   -.0803885
                                   |
                     cL.age#cL.age |   .0015522   .0005174     3.00   0.003     .0005382    .0025662
                                   |
                         L.married |
                                1  |  -.2069814   .1216313    -1.70   0.089    -.4453744    .0314116
                                   |
                  L.health_status1 |
                                2  |   .3088299   .2329175     1.33   0.185    -.1476799    .7653398
                                3  |   .0511977   .2319515     0.22   0.825    -.4034189    .5058142
                                4  |  -.0551506   .2338465    -0.24   0.814    -.5134812    .4031801
                                5  |   .0653898   .2455752     0.27   0.790    -.4159287    .5467082
                                   |
                years_of_education |
                               L1. |   -.021139   .0898088    -0.24   0.814     -.197161     .154883
                                   |
                     n_of_children |
                               L1. |  -.0662271   .0584493    -1.13   0.257    -.1807856    .0483314
                                   |
              annual_working_hours |
                               L1. |  -.0003555   .0000466    -7.64   0.000    -.0004468   -.0002643
              --------------------------------------------------------------------------------------
              Thank you again in advance for your help.
              Last edited by Alessandro Gallo; 13 May 2022, 08:55.

              Comment


              • #8
                Alesandro:
                the following
                note: multiple positive outcomes within groups encountered.
                note: 12,623 groups (55,604 obs) omitted because of all positive or
                all negative outcomes.
                might have caused convergence problem.
                Categorizing a continous predictor like -Age- does not make much sense (see, if interested,
                https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.462.859&rep=rep1&type=pdf
                ).
                The usual recipe when convergence is not achieved is to start it all over again, adding one predictor at a time and see when the MLE starts to gasp.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment

                Working...
                X