Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The scale.fix doesn't seem to work or is displayed incorrectly #9

Open
ghost opened this issue Mar 30, 2022 · 0 comments
Open

The scale.fix doesn't seem to work or is displayed incorrectly #9

ghost opened this issue Mar 30, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2022

For the following data:

d <- structure(list(ID = c(1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 
4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 
9, 9, 10, 10, 10, 10), TimeOrd = structure(c(1L, 2L, 3L, 4L, 
1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 
1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 
1L, 2L, 3L, 4L), .Label = c("M0", "M1", "M2", "M3"), class = c("ordered", 
"factor")), Result = c(1, 1.1, 1.5, 2, 1.1, 1.1, 1.4, 3, 1.1, 
1.2, 1.7, 5, 1.5, 3, 4.6, 6, 2.3, 4.4, 5.5, 8, 2, 2.2, 2.3, 7, 
4.5, 1, 3, 7, 3.3, 4.4, 5.5, 5, 3, 4, 5, 8, 1.1, 2.2, 3.3, 5), 
    SucN = c(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 
    0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 
    1, 1, 1, 1, 0), Time = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 
    3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 
    2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 
    1L, 2L, 3L, 4L), .Label = c("M0", "M1", "M2", "M3"), class = "factor")), row.names = c(NA, 
40L), class = "data.frame")

For any model, when I want to estimate the scale (apart from the sense in this example), it shows me 1, while I know, from other packages, that it should be different.

> summary(geeglm(SucN ~ Time, family=binomial(link = logit), data=d, id=ID, corstr = "unstructured", std.err="san.se", scale.fix = F))

Call:
geeglm(formula = SucN ~ Time, family = binomial(link = logit), 
    data = d, id = ID, corstr = "unstructured", scale.fix = F, 
    std.err = "san.se")

 Coefficients:
            Estimate Std.err Wald Pr(>|W|)  
(Intercept)    -2.20    1.05 4.35    0.037 *
TimeM1          1.35    0.92 2.15    0.142  
TimeM2          2.60    1.08 5.85    0.016 *
TimeM3          3.04    1.53 3.98    0.046 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation structure = unstructured 
Estimated Scale Parameters:

            Estimate Std.err
(Intercept)        1   0.577
  Link = identity 

Estimated Correlation Parameters:
          Estimate Std.err
alpha.1:2   0.5092   0.482
alpha.1:3   0.2722   0.288
alpha.1:4  -0.5092   0.479
alpha.2:3   0.5345   0.409
alpha.2:4  -0.5238   0.492
alpha.3:4  -0.0891   0.332
Number of clusters:   10  Maximum cluster size: 4 

Please note, the link is incorrect ("identity") and the scale is 1. While it should be 1.11. I guess it's unnecessary rounded in the output. Below confirmed by gee::gee and geeM::geem

> summary(gee::gee(SucN ~ Time, family=binomial(link = logit), data=d, id=ID, corstr = "unstructured", scale.fix = F))
Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27
running glm to get initial regression estimate
(Intercept)      TimeM1      TimeM2      TimeM3 
      -2.20        1.35        2.60        3.04 

 GEE:  GENERALIZED LINEAR MODELS FOR DEPENDENT DATA
 gee S-function, version 4.13 modified 98/01/27 (1998) 

Model:
 Link:                      Logit 
 Variance to Mean Relation: Binomial 
 Correlation Structure:     Unstructured 

Call:
gee::gee(formula = SucN ~ Time, id = ID, data = d, family = binomial(link = logit), 
    corstr = "unstructured", scale.fix = F)

Summary of Residuals:
   Min     1Q Median     3Q    Max 
-0.700 -0.300 -0.100  0.325  0.900 


Coefficients:
            Estimate Naive S.E. Naive z Robust S.E. Robust z
(Intercept)    -2.20       1.11   -1.98        1.05    -2.08
TimeM1          1.35       0.97    1.39        0.92     1.47
TimeM2          2.60       1.13    2.30        1.08     2.42
TimeM3          3.04       1.61    1.89        1.53     2.00

Estimated Scale Parameter:  1.11
Number of Iterations:  1

Working Correlation
       [,1]   [,2]    [,3]    [,4]
[1,]  1.000  0.509  0.2722 -0.5092
[2,]  0.509  1.000  0.5345 -0.5238
[3,]  0.272  0.535  1.0000 -0.0891
[4,] -0.509 -0.524 -0.0891  1.0000

or

> summary(geeM::geem(SucN ~ Time, family=binomial(link = logit), data=d, id=ID, corstr = "unstructured", scale.fix = F))
            Estimates Model SE Robust SE  wald      p
(Intercept)     -2.20    1.111      1.05 -2.08 0.0371
TimeM1           1.35    0.727      0.92  1.47 0.1423
TimeM2           2.60    1.039      1.08  2.42 0.0155
TimeM3           3.04    1.732      1.53  2.00 0.0460

 Working Correlation: 
       [,1]   [,2]   [,3]   [,4]
[1,]  1.000  0.764  0.408 -0.764
[2,]  0.764  1.000  0.802 -0.786
[3,]  0.408  0.802  1.000 -0.134
[4,] -0.764 -0.786 -0.134  1.000
 Correlation Structure:  unstructured 
 Est. Scale Parameter:  1.11 

 Number of GEE iterations: 2 
 Number of Clusters:  10    Maximum Cluster Size:  4 
 Number of observations with nonzero weight:  40 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants