title: Different results Gamma generalized linear model R and SPSS
body: <p>Update: The p-values and S.E.'s are similar between SPSS and R if I change the parameter estimation method in SPSS to 'Hybrid' and the scale parameter method to 'Pearson Chi-square'. Does anyone now how to change these settings in R and what these settings actually mean?</p>
  
  <hr>
  
  <p>I am trying to perform an GLM with a gamma log link function in R, to analyse a multiple imputation dataset.</p>
  
  <p>However, when I compare the results from the same analysis in R and SPSS they are very different. This example is in a non-imputation dataset to make things easier to interpret. The SPSS result is as follows:</p>
  
  <pre><code>Parameter Estimates                         
  Parameter   B   Std. Error  95% Wald Confidence Interval          Hypothesis Test       
          Lower   Upper   Wald Chi-Square df  Sig.
  (Intercept) 3,263   ,2499   2,774   3,753   170,571 1   ,000
  [Comorb=1]  -,631   ,1335   -,893   -,369   22,331  1   ,000
  [Comorb=2]  -,371   ,1473   -,660   -,083   6,358   1   ,012
  [Comorb=3]  0a  .   .   .   .   .   .
  PAIDhoog     ,257   ,1283   ,006    ,509    4,023   1   ,045
  PHQhoog    ,039 ,1504   -,256   ,334    ,068    1       ,794
  [etndich=1,00]  -,085   ,1125   -,306   ,135    ,575    1   ,448
  [etndich=2,00]  0a  .   .   .   .   .   .
  Leeftijd    ,009    ,0035   ,002    ,016    6,588   1   ,010
  (Scale) ,613b   ,0470   ,528    ,712            
  Dependent Variable: totaalhealthcareutilization
  Model: (Intercept), Comorb, PAIDhoog, PHQhoog, etndich, Leeftijd                            
  a Set to zero because this parameter is redundant.                          
  b Maximum likelihood estimate.                          
  </code></pre>
  
  <p>While the same analysis in R yields this result:</p>
  
  <pre><code>  Call:
  glm(formula = (totaalhealthcareutilization) ~ PAIDhoog + PHQhoog + 
     Comorb + Leeftijd + etndich, family = Gamma(link = log), 
     data = F)
  
  Deviance Residuals: 
     Min       1Q   Median       3Q      Max  
  -2.1297  -0.7231  -0.3018   0.2075   3.1365  
  
  Coefficients:
           Estimate Std. Error t value             Pr(&gt;|t|)    
  (Intercept)  3.006208   0.273817  10.979 &lt; 0.0000000000000002 ***
  PAIDhoog     0.201881   0.131777   1.532               0.1264    
  PHQhoog      0.126989   0.157416   0.807               0.4203    
  Comorbgeen  -0.638842   0.144459  -4.422            0.0000128 ***
  Comorb1     -0.348187   0.158484  -2.197               0.0286 *  
  Leeftijd     0.007311   0.003534   2.069               0.0392 *  
  etndich      0.151836   0.118872   1.277               0.2023    
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  
  (Dispersion parameter for Gamma family taken to be 0.9432289)
  
      Null deviance: 286.49  on 381  degrees of freedom
  Residual deviance: 243.01  on 375  degrees of freedom
    (71 observations deleted due to missingness)
  AIC: 3156
  
  Number of Fisher Scoring iterations: 6
  </code></pre>
  
  <p>How is this possible? The results keep differing, even if I use na.omit or na.exclude in R. I have used the function 'relevel' in R, to make sure that the same reference category is used for the categoric variables.</p>
  
  <p>I hope you have any idea what I am doing wrong in R.</p>
  
  <pre><code> This is what a sample of my data looks like: 
  
     verrichtingen verpleegkanders Leeftijd HbA1c  BMI Type_Treat DurationDM
  1               0               0       26    69 26.7    Insulin          5
  2               0               0       69    75 34.5    Insulin         17
  3               0               0       67    62 24.3    Insulin          1
  4               6               0       38    96   NA    Insulin         10
  5               0               0       29    NA 19.1    Insulin         25
  6               0               0       50    86 37.9       Both          9
  7               1               0       29    44 29.1       Both         33
  451             4               0       68   113 37.9       Both         11
  452            21               1       57    62 21.5    Insulin          1
  453             0               0       37    54 25.4       Both         14
           Socstatus PAID1 PAID2 PAID3 PAID4 PAID5 PAIDtot PHQ1 PHQ2 PHQ3
  1    wel achterstandsw     0     1     2     1     0       4    0    0    0
  2   geen achterstandsw     2     1     1     2     0       6    0    0    0
  3                 &lt;NA&gt;     0     0     0     0     0       0    0    0    0
  4   geen achterstandsw     0     0     1     1     0       2    1    0    3
  5   geen achterstandsw     0     0     0     0     0       0    1    1    3
  6    wel achterstandsw     0     1     0     2     0       3    2    0    3
  7   geen achterstandsw     1     1     2     3     0       7    1    1    3
  451 geen achterstandsw     0     0     1     0     0       1    0    0    0
  452  wel achterstandsw     1     0     4     1     0       6    2    0    3
  453  wel achterstandsw     1     1     2     3     2       9    1    0    1
  PHQ4 PHQ5 PHQ6 PHQ7 PHQ8 PHQ9 Geslacht        Etnicit HAPOH Bedrijfsarts MW
  1      1    1    0    0    0    0    vrouw     Overigwest    NA           NA  NA
  2      1    0    0    1    1    0      man            Mar    NA           NA NA
  3      0    0    0    0    0    0      man     Overigwest    NA           NA NA
  4      3    1    1    1    1    0    vrouw Overignietwest    NA           NA NA
  5      0    0    0    3    0    0      man     Overigwest    NA           NA NA
  6      1    1    1    0    0    0      man           Turk    NA           NA NA
  7      3    0    0    2    0    0    vrouw     Overigwest    NA           NA NA
  451    0    0    0    0    0    0      man              4    NA           NA NA
  452    3    0    0    1    0    0    vrouw            Mar    NA           NA NA
  453    2    2    0    0    0    0    vrouw            Mar    NA           NA NA
  FysioErgo Diet Psychiat Psychol Dvk VPtot Internist Specialist ICUopname
  1          NA    5        0       0   5     5         2          3         0
  2          NA    2        0       0   2     2         3          8         0
  3          NA    0        0       0   1     1         2          3         0
  4          NA    0        1       2  11    11         6         25         0
  5          NA    0        0       0   4     4         2          6         0
  6          NA    1        0       0   2     2         2          0         0
  7          NA    3        0       0   4     4         2          3         0
  451        NA    0        0       0   1     1         3          7         0
  452        NA    2        0       0   4     5         0         25         4
  453        NA    1        0       0   2     2         0          5         0
  Opnamegewoon SEH Comorb DMtype PAIDtotaal PHQtotaal PAIDhoog PHQhoog
  1              0   0   geen    DM1          4         2        0       0
  2              0   0   geen    DM2          6         3        0       0
  3              0   0   geen    DM1          0         0        0       0
   4              1   0   geen    DM2          2        NA        0      NA
  5              0   0   geen    DM1          0         8        0       0
  6              0   0   geen    DM2          3         8        0       0
  7              0   0   geen    DM2          7        10        0       0
  451           18   2   &lt;NA&gt;    DM2          1         0        0       0
  452           34   3   &lt;NA&gt;    DM1          6         9        0       0
  453            0   0   &lt;NA&gt;    DM2          9         6        1       0
  interactPHQPAID paidtotaalimp PHQtotaalimp GADtotaalimp PAIDhoogimp
  1                 0             4            2            1           0
  2                 0             6            3            0           0
  3                 0             0            0            0           0
  4                 0             2           11            2           0
  5                 0             0            8            0           0
  6                 0             3            8            0           0
  7                 0             7           10            3           0
  451               0             1            0            0           0
  452               0             6            9            0           0
  453               0             9            6            1           1
  PHQhoogimp GADimphoog kostenopnames kosteninternist kostenspecialist
  1            0          0             0             160              240
  2            0          0             0             240              640
  3            0          0             0             160              240
  4            0          0           443             480             2000
  5            0          0             0             160              480
  6            0          0             0             160                0
  7            0          1             0             160              240
  451          0          0          7974             240              560
  452          0          0         15062               0             2000
  453          0          0             0               0              400
  kostenhuisarts kostenMW kostenfysioergo kostendvk kostendietist
  1               NA       NA              NA       240           240
  2               NA       NA              NA        96            96
  3               NA       NA              NA        48             0
  4               NA       NA              NA       528             0
  5               NA       NA              NA       192             0
  6               NA       NA              NA        96            48
  7               NA       NA              NA       192           144
  451             NA       NA              NA        48             0
  452             NA       NA              NA       192            96
  453             NA       NA              NA        96            48
  totaalkosten jaarHAPOH jaarbedrijfsarts jaarMW jaarfysioergo
  1             NA        NA               NA     NA            NA
  2             NA        NA               NA     NA            NA
  3             NA        NA               NA     NA            NA
  4             NA        NA               NA     NA            NA
  5             NA        NA               NA     NA            NA
  6             NA        NA               NA     NA            NA
  7             NA        NA               NA     NA            NA
  451           NA        NA               NA     NA            NA
  452           NA        NA               NA     NA            NA
  453           NA        NA               NA     NA            NA
  totaalverbruikjaar kostenHAjaar kostenMWjaar kostenjaarfysioergo
  1                   NA           NA           NA                  NA
  2                   NA           NA           NA                  NA
  3                   NA           NA           NA                  NA
  4                   NA           NA           NA                  NA
  5                   NA           NA           NA                  NA
  6                   NA           NA           NA                  NA
  7                   NA           NA           NA                  NA
  451                 NA           NA           NA                  NA
  452                 NA           NA           NA                  NA
  453                 NA           NA           NA                  NA
  kostenopnameICU kostenpsycholoog kostenpsychiater kostenvpanders
  1                 0                0                0              0
  2                 0                0                0              0
  3                 0                0                0              0
  4                 0              188               94              0
  5                 0                0                0              0
  6                 0                0                0              0
  7                 0                0                0              0
  451               0                0                0              0
  452            8060                0                0             48
  453               0                0                0              0
  kostenverrichtingen totaalutilization kostenseh totaalkostennieuw hypoangst
  1                     0                NA         0               880         1
  2                     0                NA         0              1072         1
  3                     0                NA         0               448         0
  4                   876                NA         0              4609         0
  5                     0                NA         0               832         0
  6                     0                NA         0               304         1
  7                   146                NA         0               882         5
  451                 584                NA       518              9924         0
  452                3066                NA       777             29301         0
  453                   0                NA         0               544         3
  contactprimarycare contactsecondarycare totaalhealthcareutilization
  1                   NA                   15                          15
  2                   NA                   15                          15
  3                   NA                    6                           6
  4                   NA                   52                          52
  5                   NA                   12                          12
  6                   NA                    5                           5
  7                   NA                   13                          13
  451                 NA                   35                          35
  452                 NA                   94                          94
  453                 NA                    8                           8
  kostenprimarycare kostensecondarycare totaalkostenhealthcare etndich
  1                  NA                 880                     NA       1
  2                  NA                1072                     NA       2
  3                  NA                 448                     NA       1
  4                  NA                4609                     NA       2
  5                  NA                 832                     NA       1
  6                  NA                 304                     NA       2
  7                  NA                 882                     NA       1
  451                NA                9924                     NA       1
  452                NA               29301                     NA       2
  453                NA                 544                     NA       2
  </code></pre>