annennenne / geeasy

R package with tools for fitting generalized linear models with clustered observations using generalized estimating equations.
3 stars 1 forks source link

Trying to match SAS results #2

Open danielinteractive opened 2 years ago

danielinteractive commented 2 years ago

Hi @annennenne and team,

first of all thanks for the nice geeasy package! It is really easy to fit GEE models with it, and I think it is the most modern of the GEE packages for R. Because of this, we are currently working on a clinical reporting package (see https://github.com/insightsengineering/tern.gee/tree/2_prototype) that would build on geeasy as the computation engine.

In order to check the results, I am trying to match results from SAS currently. In very small toy examples this looked good. Now in a more realistic example I get quite different results (using version 0.1.1 of geeasy), see below the reproducible example. I am wondering if you have any ideas what could be differences between the geeasy call and the SAS specs maybe? Or if I could try some other geeasy options?

Thanks a lot for any pointers,

best regards Daniel

Reproducible example: (apologies for the large data)

data <- structure(list(FEV1_BIN = c(
  NA, 1L, NA, 0L, NA, 1L, 1L, 1L,
  NA, 1L, NA, 1L, 1L, 1L, NA, 1L, 1L, NA, 1L, 1L, NA, NA, 1L, NA,
  1L, 1L, NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, NA, NA, 1L, NA,
  1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, NA, NA, 1L, 1L, NA, NA, 1L, NA,
  NA, NA, 1L, 1L, NA, 1L, NA, 1L, 0L, NA, NA, 1L, 1L, 1L, NA, 1L,
  1L, 1L, 1L, 1L, NA, 1L, 1L, NA, NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
  0L, 1L, 1L, NA, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
  0L, NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L, 1L, 1L,
  0L, NA, 1L, NA, 1L, NA, NA, 1L, 0L, 1L, NA, 1L, 1L, 1L, 1L, 1L,
  1L, 1L, NA, 1L, NA, 1L, NA, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, NA,
  1L, NA, 1L, 1L, 1L, 1L, 1L, NA, NA, 1L, 1L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L, 1L, 1L, NA, 1L, 1L, NA,
  NA, NA, NA, 1L, 1L, NA, 1L, NA, 1L, 1L, 1L, NA, 0L, 1L, 1L, 1L,
  1L, 1L, 1L, NA, 1L, NA, 1L, 1L, 0L, NA, NA, NA, 1L, 1L, 1L, NA,
  1L, 1L, NA, NA, 1L, NA, NA, NA, NA, NA, NA, 1L, NA, NA, 1L, NA,
  1L, 1L, 1L, NA, NA, 1L, 1L, 1L, 1L, 1L, 1L, NA, 1L, 1L, NA, 1L,
  1L, NA, NA, 1L, 1L, 1L, 1L, 1L, 1L, NA, NA, NA, NA, 1L, 1L, NA,
  0L, 1L, 1L, 0L, NA, 1L, 1L, 1L, NA, 1L, 1L, 1L, NA, 1L, 1L, 1L,
  1L, 1L, 1L, 0L, 1L, NA, NA, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, NA,
  NA, NA, 1L, 1L, 0L, 1L, NA, 1L, NA, 1L, NA, 1L, NA, NA, NA, NA,
  0L, 1L, NA, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, NA, NA, 1L, 1L, 1L,
  1L, 1L, 1L, NA, NA, 1L, 1L, NA, 1L, 1L, 1L, 1L, NA, NA, 1L, 1L,
  1L, 1L, NA, 1L, NA, 1L, NA, 1L, 0L, 1L, 1L, 1L, 1L, 1L, NA, 1L,
  1L, NA, 1L, 1L, 1L, 1L, 1L, 1L, 1L, NA, NA, 1L, NA, 1L, 1L, 1L,
  0L, 1L, NA, NA, NA, 1L, 1L, 1L, NA, 1L, NA, NA, 0L, NA, NA, 1L,
  NA, 1L, NA, 1L, NA, 1L, 1L, 1L, 1L, NA, NA, NA, 0L, NA, NA, NA,
  1L, 1L, NA, 1L, 0L, 1L, 1L, NA, 0L, 1L, NA, NA, NA, 1L, 1L, 1L,
  NA, 0L, NA, 1L, 1L, 1L, 1L, NA, 1L, 1L, 1L, NA, 1L, 1L, 1L, NA,
  0L, 1L, NA, 1L, 1L, 1L, NA, 1L, NA, NA, 1L, NA, 1L,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,
  15L, 16L, 16L, 16L, 16L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L,
  19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 21L, 21L, 21L, 21L, 22L,
  22L, 22L, 22L, 23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 25L, 25L,
  25L, 25L, 26L, 26L, 26L, 26L, 27L, 27L, 27L, 27L, 28L, 28L, 28L,
  28L, 29L, 29L, 29L, 29L, 30L, 30L, 30L, 30L, 31L, 31L, 31L, 31L,
  32L, 32L, 32L, 32L, 33L, 33L, 33L, 33L, 34L, 34L, 34L, 34L, 35L,
  35L, 35L, 35L, 36L, 36L, 36L, 36L, 37L, 37L, 37L, 37L, 38L, 38L,
  38L, 38L, 39L, 39L, 39L, 39L, 40L, 40L, 40L, 40L, 41L, 41L, 41L,
  41L, 42L, 42L, 42L, 42L, 43L, 43L, 43L, 43L, 44L, 44L, 44L, 44L,
  45L, 45L, 45L, 45L, 46L, 46L, 46L, 46L, 47L, 47L, 47L, 47L, 48L,
  48L, 48L, 48L, 49L, 49L, 49L, 49L, 50L, 50L, 50L, 50L, 51L, 51L,
  51L, 51L, 52L, 52L, 52L, 52L, 53L, 53L, 53L, 53L, 54L, 54L, 54L,
  54L, 55L, 55L, 55L, 55L, 56L, 56L, 56L, 56L, 57L, 57L, 57L, 57L,
  58L, 58L, 58L, 58L, 59L, 59L, 59L, 59L, 60L, 60L, 60L, 60L, 61L,
  61L, 61L, 61L, 62L, 62L, 62L, 62L, 63L, 63L, 63L, 63L, 64L, 64L,
  64L, 64L, 65L, 65L, 65L, 65L, 66L, 66L, 66L, 66L, 67L, 67L, 67L,
  67L, 68L, 68L, 68L, 68L, 69L, 69L, 69L, 69L, 70L, 70L, 70L, 70L,
  71L, 71L, 71L, 71L, 72L, 72L, 72L, 72L, 73L, 73L, 73L, 73L, 74L,
  74L, 74L, 74L, 75L, 75L, 75L, 75L, 76L, 76L, 76L, 76L, 77L, 77L,
  77L, 77L, 78L, 78L, 78L, 78L, 79L, 79L, 79L, 79L, 80L, 80L, 80L,
  80L, 81L, 81L, 81L, 81L, 82L, 82L, 82L, 82L, 83L, 83L, 83L, 83L,
  84L, 84L, 84L, 84L, 85L, 85L, 85L, 85L, 86L, 86L, 86L, 86L, 87L,
  87L, 87L, 87L, 88L, 88L, 88L, 88L, 89L, 89L, 89L, 89L, 90L, 90L,
  90L, 90L, 91L, 91L, 91L, 91L, 92L, 92L, 92L, 92L, 93L, 93L, 93L,
  93L, 94L, 94L, 94L, 94L, 95L, 95L, 95L, 95L, 96L, 96L, 96L, 96L,
  97L, 97L, 97L, 97L, 98L, 98L, 98L, 98L, 99L, 99L, 99L, 99L, 100L,
  100L, 100L, 100L, 101L, 101L, 101L, 101L, 102L, 102L, 102L, 102L,
  103L, 103L, 103L, 103L, 104L, 104L, 104L, 104L, 105L, 105L, 105L,
  105L, 106L, 106L, 106L, 106L, 107L, 107L, 107L, 107L, 108L, 108L,
  108L, 108L, 109L, 109L, 109L, 109L, 110L, 110L, 110L, 110L, 111L,
  111L, 111L, 111L, 112L, 112L, 112L, 112L, 113L, 113L, 113L, 113L,
  114L, 114L, 114L, 114L, 115L, 115L, 115L, 115L, 116L, 116L, 116L,
  116L, 117L, 117L, 117L, 117L, 118L, 118L, 118L, 118L, 119L, 119L,
  119L, 119L, 120L, 120L, 120L, 120L, 121L, 121L, 121L, 121L, 122L,
  122L, 122L, 122L, 123L, 123L, 123L, 123L, 124L, 124L, 124L, 124L,
  125L, 125L, 125L, 125L, 126L, 126L, 126L, 126L, 127L, 127L, 127L,
  127L, 128L, 128L, 128L, 128L, 129L, 129L, 129L, 129L, 130L, 130L,
  130L, 130L, 131L, 131L, 131L, 131L, 132L, 132L, 132L, 132L, 133L,
  133L, 133L, 133L, 134L, 134L, 134L, 134L, 135L, 135L, 135L, 135L,
  136L, 136L, 136L, 136L, 137L, 137L, 137L, 137L, 138L, 138L, 138L,
  138L, 139L, 139L, 139L, 139L, 140L, 140L, 140L, 140L, 141L, 141L,
  141L, 141L, 142L, 142L, 142L, 142L, 143L, 143L, 143L, 143L, 144L,
  144L, 144L, 144L, 145L, 145L, 145L, 145L, 146L, 146L, 146L, 146L,
  147L, 147L, 147L, 147L, 148L, 148L, 148L, 148L, 149L, 149L, 149L,
  149L, 150L, 150L, 150L, 150L, 151L, 151L, 151L, 151L, 152L, 152L,
  152L, 152L, 153L, 153L, 153L, 153L, 154L, 154L, 154L, 154L, 155L,
  155L, 155L, 155L, 156L, 156L, 156L, 156L, 157L, 157L, 157L, 157L,
  158L, 158L, 158L, 158L, 159L, 159L, 159L, 159L, 160L, 160L, 160L,
  160L, 161L, 161L, 161L, 161L, 162L, 162L, 162L, 162L, 163L, 163L,
  163L, 163L, 164L, 164L, 164L, 164L, 165L, 165L, 165L, 165L, 166L,
  166L, 166L, 166L, 167L, 167L, 167L, 167L, 168L, 168L, 168L, 168L,
  169L, 169L, 169L, 169L, 170L, 170L, 170L, 170L, 171L, 171L, 171L,
  171L, 172L, 172L, 172L, 172L, 173L, 173L, 173L, 173L, 174L, 174L,
  174L, 174L, 175L, 175L, 175L, 175L, 176L, 176L, 176L, 176L, 177L,
  177L, 177L, 177L, 178L, 178L, 178L, 178L, 179L, 179L, 179L, 179L,
  180L, 180L, 180L, 180L, 181L, 181L, 181L, 181L, 182L, 182L, 182L,
  182L, 183L, 183L, 183L, 183L, 184L, 184L, 184L, 184L, 185L, 185L,
  185L, 185L, 186L, 186L, 186L, 186L, 187L, 187L, 187L, 187L, 188L,
  188L, 188L, 188L, 189L, 189L, 189L, 189L, 190L, 190L, 190L, 190L,
  191L, 191L, 191L, 191L, 192L, 192L, 192L, 192L, 193L, 193L, 193L,
  193L, 194L, 194L, 194L, 194L, 195L, 195L, 195L, 195L, 196L, 196L,
  196L, 196L, 197L, 197L, 197L, 197L, 198L, 198L, 198L, 198L, 199L,
  199L, 199L, 199L, 200L, 200L, 200L, 200L
), waves = c(
  1L, 2L,
  3L, 4L, 1L, 2L, 3L, 4L, 1L,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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
)), row.names = c(
  NA,
  -800L
), class = c("tbl_df", "tbl", "data.frame"))

head(data)

model <- geeasy::geelm(
  formula = FEV1_BIN ~ ARMCD + RACE,
  id = id,
  waves = waves,
  data = data,
  family = binomial(),
  corstr = "unstructured",
  control = geeasy::geelm.control(scale.fix = TRUE)
)

# proc genmod data=ana.dat descending;
# class RACE(ref = 'Asian') USUBJID ARMCD(ref = 'PBO') AVISIT;
# model FEV1_BIN = ARMCD RACE / dist=bin link=logit ;
# repeated subject=USUBJID / within=AVISIT type=UN CORRW;
# run;

# Working Correlation Matrix
#
#            Col1         Col2         Col3         Col4
#
# Row1       1.0000      -0.0868      -0.1859      -0.1480
# Row2      -0.0868       1.0000       0.0788       0.0077
# Row3      -0.1859       0.0788       1.0000       0.0698
# Row4      -0.1480       0.0077       0.0698       1.0000

# We obtain different correlation parameter estimates:
model$geese$alpha
# [1] -0.056458907 -0.125737003  0.067815234 -0.083599271 -0.057773977  0.009216794

# GEE Fit Criteria
#
# QIC          303.9454
# QICu         303.6369

# We obtain different QIC values:
QIC(model)
#        QIC        QICu   Quasi Lik         CIC      params        QICC
# 302.767472  303.226407 -147.613203    3.770533    4.000000  303.950268

# Analysis Of GEE Parameter Estimates
# Empirical Standard Error Estimates
#
# Standard   95% Confidence
# Parameter                           Estimate    Error       Limits            Z Pr > |Z|
#
# Intercept                             1.7193   0.2775   1.1755   2.2632    6.20   <.0001
# ARMCD     TRT                         0.6781   0.3299   0.0315   1.3247    2.06   0.0398
# ARMCD     PBO                         0.0000   0.0000   0.0000   0.0000     .      .
# RACE      Black or African American   0.1492   0.3246  -0.4869   0.7853    0.46   0.6457
# RACE      White                       1.3111   0.5543   0.2246   2.3975    2.37   0.0180
# RACE      Asian                       0.0000   0.0000   0.0000   0.0000     .      .

# We obtain different estimates:
coef(model)
# (Intercept)     ARMCDTRT   RACEBlack or African American     RACEWhite
# 1.7582943      0.6784657                       0.1705619     1.3864354

# And this fails, not sure why?
summary(model)
# seems the wts vector is too long (original size of the data instead of na omitted)
# Passing in na.omit(data) above works.
ekstroem commented 2 years ago

Thanks for the report. Will give it a look.

In the mean time: have you updated geepack to the latest version? I fixed some errors there that might address some of these problems (although I doubt it).

danielinteractive commented 2 years ago

Awesome, thanks @ekstroem ! Yes, I have used geepack 1.3.9 here, so that is the latest CRAN release.

danielinteractive commented 2 years ago

@ekstroem Do you have any ideas already?

ekstroem commented 2 years ago

Not yet. Still trying to get the data into SAS so I can tinker with it.

Need a few hours free to look at it

danielinteractive commented 2 years ago

If it helps, you could try out our new interface https://github.com/insightsengineering/sasr - after quick setup you can upload any data frame from R to SAS with a simple df2sd() call and then run SAS from R.

danielinteractive commented 2 years ago

@ekstroem anything we can help from our side? Or maybe we can have a quick call together to look at it?