Announcement

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

  • Generalized linear models interpretations

    I have variable two dependent “total bone density “which measured in cm3 and “bone density percentage” which calculated by dividing dense bone area by total bone area.

    I am trying to investigate if smoking is associated with "total bone density" and "bone density percent" after adjustment to alcohol and BMI. The dependents variables are positively skewed and also the residuals are not normally distributed. Therefore, I am using GLM.

    Did I use the right link and family for both of dependent variables?

    How should I interpret the coefficients for smoking variable?

    How do calculate the adjusted mean and the 95% CI for bone density percentage and total bone density across the categories of the smoking.

    My sample is around 1000 but the results for the GLM present for 418 only.

    For total bone density
    glm mean_tda age i.alcweek3 i.smoker3 i.cbmigroups3 ,family(poisson) link(log) vce(robust)
    note: mean_tda has noninteger values

    Iteration 0: log pseudolikelihood = -3997.8733
    Iteration 1: log pseudolikelihood = -3932.7379
    Iteration 2: log pseudolikelihood = -3932.6239
    Iteration 3: log pseudolikelihood = -3932.6239

    Generalized linear models No. of obs = 418
    Optimization : ML Residual df = 408
    Scale parameter = 1
    Deviance = 6314.324466 (1/df) Deviance = 15.47629
    Pearson = 8143.055288 (1/df) Pearson = 19.95847

    Variance function: V(u) = u [Poisson]
    Link function : g(u) = ln(u) [Log]

    AIC = 18.86423
    Log pseudolikelihood = -3932.623915 BIC = 3851.848

    --------------------------------------------------------------------------------
    | Robust
    mean_tda | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    age | -.022811 .0070187 -3.25 0.001 -.0365674 -.0090546
    |
    alcweek3 |
    three or less | -.0997237 .18797 -0.53 0.596 -.468138 .2686907
    four to nine | .1863415 .2112141 0.88 0.378 -.2276306 .6003136
    ten or more | .0019707 .1883379 0.01 0.992 -.3671648 .3711061
    |
    smoker3 |
    former | -.1395443 .1253079 -1.11 0.265 -.3851433 .1060546
    current | -.205274 .2045921 -1.00 0.316 -.6062672 .1957192
    |
    cbmigroups3 |
    obese | -.4339761 .1483256 -2.93 0.003 -.7246888 -.1432633
    overwight | -.2252917 .1470218 -1.53 0.125 -.5134491 .0628656
    underweight | .0685373 .218682 0.31 0.754 -.3600715 .4971461
    |
    _cons | 4.245983 .468874 9.06 0.000 3.327007 5.164959
    --------------------------------------------------------------------------------

    For bone density percent
    generate bd_pr=bd/100

    glm bd_pr i.alcweek3 i.smoker3 i.cbmigroups3, link (logit) vce(robust)

    Iteration 0: log pseudolikelihood = 215.01385
    Iteration 1: log pseudolikelihood = 264.22253
    Iteration 2: log pseudolikelihood = 271.92475
    Iteration 3: log pseudolikelihood = 271.92981
    Iteration 4: log pseudolikelihood = 271.92981

    Generalized linear models No. of obs = 418
    Optimization : ML Residual df = 409
    Scale parameter = .0162899
    Deviance = 6.662566651 (1/df) Deviance = .0162899
    Pearson = 6.662566651 (1/df) Pearson = .0162899

    Variance function: V(u) = 1 [Gaussian]
    Link function : g(u) = ln(u/(1-u)) [Logit]

    AIC = -1.258037
    Log pseudolikelihood = 271.9298107 BIC = -2461.849

    --------------------------------------------------------------------------------
    | Robust
    bd_pr | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    ---------------+----------------------------------------------------------------
    alcweek3 |
    three or less | -.0583549 .1833873 -0.32 0.750 -.4177874 .3010775
    four to nine | .1018567 .2133562 0.48 0.633 -.3163138 .5200273
    ten or more | .106684 .1986481 0.54 0.591 -.2826591 .4960272
    |
    smoker3 |
    former | -.2902414 .1494269 -1.94 0.052 -.5831127 .00263
    current | -.4650027 .2777897 -1.67 0.094 -1.00946 .0794551
    |
    cbmigroups3 |
    obese | -1.050255 .1678739 -6.26 0.000 -1.379282 -.7212283
    overwight | -.572954 .1492834 -3.84 0.000 -.8655441 -.2803639
    underweight | .5373612 .2693027 2.00 0.046 .0095377 1.065185
    |
    _cons | -1.494728 .1718149 -8.70 0.000 -1.831479 -1.157977
    --------------------------------------------------------------------------------


    . dataex bd mean_tda smoker3 cbmigroups3

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(bd mean_tda) byte(smoker3 cbmigroups3)
     16.365463  18.81128 1 1
      .2624936  .6569816 2 2
     10.473497  18.42222 2 3
      7.537117 16.728163 1 3
      3.052203  7.655602 1 2
     .55155325   .899969 1 2
      22.84368  25.15202 3 .
       52.8951   29.5906 2 3
     12.876885  7.408317 1 1
      21.18159 16.218298 1 1
      6.871165  7.035076 1 1
     16.478045 32.336216 2 2
      22.57178 26.838284 1 3
      .5757041  .7053235 2 3
      .4333925 1.0435233 1 2
      5.899091 12.323744 1 2
      6.383229 8.1892605 2 1
      .9931619  .9373725 1 3
      2.183749  1.460383 2 1
      18.61617 23.217287 2 1
     4.1581864  7.126842 1 3
     15.591076 11.341998 1 1
     19.108936  24.22366 1 1
      12.08951   41.5315 1 2
     34.814568 13.875312 1 4
     16.630676  24.59109 1 1
      18.88097 16.911541 2 3
      3.552727 3.7204306 1 2
       51.6785 36.629566 2 1
      2.426274 4.1825924 2 2
     2.0202687 2.3565574 3 1
     12.494894  11.57091 1 1
     2.4119585  3.584194 2 2
      16.57736  31.79659 2 2
       12.4815 24.271303 1 3
     14.112982 12.440155 1 1
      7.582244  6.519325 2 2
     16.261467  27.14514 1 3
     2.3648822  1.431556 1 3
     13.298046 13.003028 1 1
      1.938546 1.9457574 1 2
     19.626026  32.06744 2 1
      51.60948  26.92982 3 1
    .030849867 .07045104 1 .
      32.83851 30.121876 . .
     3.6494505  4.137619 1 3
      9.280085  4.934806 2 1
      26.71291  23.61595 2 3
     .22426225 .31332225 2 3
     12.666924  20.42655 3 3
      2.127961 2.1698883 2 2
    .016742319 .04563152 1 2
     30.939955  26.72437 2 1
      55.50521  24.20488 1 4
      .8922967 1.5079697 3 1
      9.707381  9.776858 2 1
      9.338659   13.2864 1 1
      9.825716 17.349289 2 2
      4.183007 3.0979486 1 1
       1.53075 1.8140126 1 2
      .3445268  .9344685 2 2
      25.31284  24.73643 2 3
     10.172702 22.785326 1 1
      7.473836 10.912245 1 3
     20.290724 15.662975 1 3
      15.29849 10.704066 1 1
     1.1178778 2.0278342 2 2
       .815134  .9314096 2 3
    .011174798  .0213928 1 2
     1.4868008 2.2582278 1 2
      19.23166 28.618475 2 3
      9.470416  11.99108 1 3
      .4934571  .9587653 2 2
      6.995302 13.102035 1 2
      6.177939 16.233845 1 2
      55.24698 140.71783 1 3
      9.001475 10.394248 2 3
       14.2323  10.14222 1 1
      .8016296  .7042006 1 2
      20.81357 35.962902 1 3
      .4873792  .7268325 1 2
       2.02487 1.2113456 2 3
      20.75257 13.728292 2 1
     16.036518 33.274246 3 2
      1.456532 1.5249872 1 1
      7.016962  6.137817 1 3
      5.493763  5.105213 1 1
     4.5745535  3.688312 2 1
      5.293759  8.490792 3 2
      8.613267  21.78817 1 1
      3.941279 4.2355614 1 3
     3.5713086 4.7329392 1 1
      30.89362 35.173065 2 1
      .3012191  .4954418 1 2
     1.9271665  2.840809 1 2
      3.623339  5.476809 1 3
      17.95036 35.690914 3 3
     .05399648  .1044472 3 2
     10.553843 13.719444 1 3
      6.783232 13.273468 2 1
    end
    label values smoker3 smoker3
    label def smoker3 1 "never", modify
    label def smoker3 2 "former", modify
    label def smoker3 3 "current", modify
    label values cbmigroups3 cbmigroups3
    label def cbmigroups3 1 "healthyweight", modify
    label def cbmigroups3 2 "obese", modify
    label def cbmigroups3 3 "overwight", modify
    label def cbmigroups3 4 "underweight", modify


    . sum mean_tda, detail

    bone total dense area
    -------------------------------------------------------------
    Percentiles Smallest
    1% .0353965 .0026717
    5% .1441546 .0039107
    10% .4248455 .0074923 Obs 1,029
    25% 2.067551 .010919 Sum of Wgt. 1,029

    50% 8.490792 Mean 14.15021
    Largest Std. Dev. 16.82954
    75% 20.56309 103.5658
    90% 33.91737 104.3295 Variance 283.2335
    95% 45.56728 140.7178 Skewness 2.552002
    99% 77.17595 151.412 Kurtosis 13.92762


    sum bd, detail

    bone percentage density
    -------------------------------------------------------------
    Percentiles Smallest
    1% .0176197 .0025312
    5% .08834 .0026645
    10% .2698087 .0047018 Obs 1,029
    25% 1.631838 .0053402 Sum of Wgt. 1,029

    50% 7.836907 Mean 12.44135
    Largest Std. Dev. 13.79967
    75% 19.00105 68.3148
    90% 32.83851 69.05723 Variance 190.4309
    95% 41.48195 71.48179 Skewness 1.528912
    99% 56.84106 82.58966 Kurtosis 5.29763


    Thanks,

    Sonia

  • #2
    Sonia:
    I'm not sure If I got you post right.
    It seems that you have two continuos regressand (the second is simply the first one divided by 100).
    Hence, set aside the reason why you think that -glm- can behave better than -regress- with heteroskeadstic residuals, -poisson- and -logit- does not seem on target here.
    If you want to stick with -glm-, you may want to consider, for both models:
    Code:
    . glm bd mean_tda i.smoker3 i.cbmigroups3, family(gaussian) link(id) vce(robust)
    
    Iteration 0:   log pseudolikelihood = -322.82303 
    
    Generalized linear models                         No. of obs      =         97
    Optimization     : ML                             Residual df     =         90
                                                      Scale parameter =   49.06614
    Deviance         =  4415.952621                   (1/df) Deviance =   49.06614
    Pearson          =  4415.952621                   (1/df) Pearson  =   49.06614
    
    Variance function: V(u) = 1                       [Gaussian]
    Link function    : g(u) = u                       [Identity]
    
                                                      AIC             =   6.800475
    Log pseudolikelihood = -322.8230299               BIC             =   4004.229
    
    ------------------------------------------------------------------------------
                 |               Robust
              bd |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        mean_tda |   .4926885   .0850962     5.79   0.000      .325903    .6594739
                 |
         smoker3 |
         former  |   3.643876   1.545528     2.36   0.018     .6146969    6.673055
        current  |   3.077834   4.113747     0.75   0.454    -4.984961    11.14063
                 |
     cbmigroups3 |
          obese  |  -7.266758   1.502582    -4.84   0.000    -10.21176   -4.321751
      overwight  |  -3.126189   1.942397    -1.61   0.108    -6.933218     .680839
    underweight  |   29.96599   5.705466     5.25   0.000     18.78348     41.1485
                 |
           _cons |   5.813066   1.450938     4.01   0.000     2.969279    8.656853
    ------------------------------------------------------------------------------
    
    . linktest
    
    Iteration 0:   log likelihood = -319.84652 
    
    Generalized linear models                         No. of obs      =         97
    Optimization     : ML                             Residual df     =         94
                                                      Scale parameter =   44.18179
    Deviance         =  4153.088303                   (1/df) Deviance =   44.18179
    Pearson          =  4153.088303                   (1/df) Pearson  =   44.18179
    
    Variance function: V(u) = 1                       [Gaussian]
    Link function    : g(u) = u                       [Identity]
    
                                                      AIC             =   6.656629
    Log likelihood   = -319.8465193                   BIC             =   3723.065
    
    ------------------------------------------------------------------------------
                 |                 OIM
              bd |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            _hat |   1.282397   .1318544     9.73   0.000     1.023967    1.540827
          _hatsq |  -.0057646   .0023633    -2.44   0.015    -.0103967   -.0011326
           _cons |  -1.818257   1.238214    -1.47   0.142    -4.245111    .6085975
    ------------------------------------------------------------------------------
    *Please note that the -linktest- tells you that your model is misspecified*
    .
    As expected, if you divide your regressand by 100, you obtain a simple variation of scale, with no substantive changes:
    Code:
    . glm percent_bd mean_tda i.smoker3 i.cbmigroups3, family(gaussian) link(id) vce(robust)
    
    Iteration 0:   log pseudolikelihood =  123.87848 
    
    Generalized linear models                         No. of obs      =         97
    Optimization     : ML                             Residual df     =         90
                                                      Scale parameter =   .0049066
    Deviance         =  .4415952592                   (1/df) Deviance =   .0049066
    Pearson          =  .4415952592                   (1/df) Pearson  =   .0049066
    
    Variance function: V(u) = 1                       [Gaussian]
    Link function    : g(u) = u                       [Identity]
    
                                                      AIC             =  -2.409866
    Log pseudolikelihood =  123.8784784               BIC             =  -411.2824
    
    ------------------------------------------------------------------------------
                 |               Robust
      percent_bd |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
        mean_tda |   .0049269    .000851     5.79   0.000      .003259    .0065947
                 |
         smoker3 |
         former  |   .0364388   .0154553     2.36   0.018      .006147    .0667305
        current  |   .0307783   .0411375     0.75   0.454    -.0498496    .1114063
                 |
     cbmigroups3 |
          obese  |  -.0726676   .0150258    -4.84   0.000    -.1021176   -.0432175
      overwight  |  -.0312619    .019424    -1.61   0.108    -.0693322    .0068084
    underweight  |   .2996599   .0570547     5.25   0.000     .1878348    .4114849
                 |
           _cons |   .0581307   .0145094     4.01   0.000     .0296928    .0865685
    ------------------------------------------------------------------------------
    
    . linktest
    
    Iteration 0:   log likelihood =  126.85499 
    
    Generalized linear models                         No. of obs      =         97
    Optimization     : ML                             Residual df     =         94
                                                      Scale parameter =   .0044182
    Deviance         =  .4153088196                   (1/df) Deviance =   .0044182
    Pearson          =  .4153088196                   (1/df) Pearson  =   .0044182
    
    Variance function: V(u) = 1                       [Gaussian]
    Link function    : g(u) = u                       [Identity]
    
                                                      AIC             =  -2.553711
    Log likelihood   =    126.85499                   BIC             =  -429.6075
    
    ------------------------------------------------------------------------------
                 |                 OIM
      percent_bd |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            _hat |   1.282397   .1318544     9.73   0.000     1.023967    1.540827
          _hatsq |  -.5764602   .2363334    -2.44   0.015    -1.039665   -.1132552
           _cons |  -.0181826   .0123821    -1.47   0.142    -.0424511     .006086
    ------------------------------------------------------------------------------
    
    .
    *Again, please note that the -linktest- tells you that your model is misspecified*
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment

    Working...
    X