I don't see it documented, but it appears that the gee() function assumes the id variable can be coerced to a number. Your ids are in PID, and are strings like "HIPS004", etc. Change that to "004" or a numeric 4 and the error goes away.

Duncan Murdoch

On 25/10/2023 3:23 p.m., Sorkin, John wrote:
Colleagues,

I am receiving several error messages from the gee function. I don't understand 
the ides the error messages are trying to impart, and I don't know how to debug 
or correct the error. The error messages follow:


fitgee <- gee(HipFlex ~ 
StepHeight,data=datashort,id=PID,corstr="exchangeable",na.action=na.omit)

Beginning Cgee S-function, @(#) geeformula.q 4.13 98/01/27

running glm to get initial regression estimate

(Intercept)  StepHeight

    1.400319   58.570236

Error in gee(HipFlex ~ StepHeight, data = datashort, id = PID, corstr = 
"exchangeable",  :

   NA/NaN/Inf in foreign function call (arg 3)

In addition: Warning message:

In gee(HipFlex ~ StepHeight, data = datashort, id = PID, corstr = 
"exchangeable",  :

   NAs introduced by coercion

Of note, when the analysis is run using lm, there is no problem. My fully data 
and code follow:
Thank you,
John


CODE:

if (!require(gee)) {install.packages("gee")}
library(gee)

datashort <- structure(list(HipFlex =   c(1.95, 2.07,  1.55,  0.44,  0.23, 0.41,
  0.22, 4.61, 10.02,  1.08, 1.43, 1.82,  0.34,  0.77,  0.22, 1.06,
  0.13, 0.36,  2.84,  5.2, 12.27, 1.37,  2.33,  3.48,  4.76, 1.92,  2.09,
  4.67, 2.94,  0.75,  0.11, 3.56, 1.63,  0.8,   1.54,  5.06, NA,    5.41,
  6.18, 3.75,  3.12, 17.43, 3.18, 0.85, 14.54, 14.34, 21.92, 4.91,
  1.52, 0.38,  0.43,  0.47, 0.56, 6.4,  12.4,   3.98,  0.57, 1.84, 12.06,
  0.45, 8.16,  0.02,  0,    0.05, 0.52,  0.11,  0.48,  1.5,  3.29,  2.58,
  2.07, 6.06,  1.46,  1.06, 3.82, 1.09,  2.86,  3.47,  2.22, 1.89, NA,
  3.48, 6.38,  3.58,  1.83, 2.8,  8.28,  7.15,  4.77,  4.93, 0,     0.11,
  1.99, 2.01,  2.3,   1.24, 1.33, 2, 1.01), PID = c("HIPS004", "HIPS004",
  "HIPS005", "HIPS005", "HIPS005", "HIPS006", "HIPS006", "HIPS008",
  "HIPS010", "HIPS024", "HIPS024", "HIPS024", "HIPS025", "HIPS028",
  "HIPS028", "HIPS030", "HIPS030", "HIPS030", "HIPS035", "HIPS035",
  "HIPS035", "HIPS036", "HIPS036", "HIPS037", "HIPS044", "HIPS047",
  "HIPS047", "HIPS056", "HIPS056", "HIPS057", "HIPS057", "HIPS057",
  "HIPS058", "HIPS059", "HIPS059", "HIPS061", "HIPS062", "HIPS062",
  "HIPS062", "HIPS064", "HIPS074", "HIPS079", "HIPS084", "HIPS089",
  "HIPS090", "HIPS090", "HIPS090", "HIPS091", "HIPS091", "HIPS092",
  "HIPS092", "HIPS092", "HIPS001", "HIPS001", "HIPS001", "HIPS004",
  "HIPS004", "HIPS004", "HIPS005", "HIPS005", "HIPS005", "HIPS006",
  "HIPS006", "HIPS008", "HIPS022", "HIPS024", "HIPS028", "HIPS030",
  "HIPS035", "HIPS036", "HIPS036", "HIPS039", "HIPS044", "HIPS047",
  "HIPS051", "HIPS056", "HIPS058", "HIPS058", "HIPS059", "HIPS059",
  "HIPS062", "HIPS062", "HIPS062", "HIPS069", "HIPS069", "HIPS071",
  "HIPS074", "HIPS079", "HIPS084", "HIPS084", "HIPS085", "HIPS089",
  "HIPS090", "HIPS091", "HIPS091", "HIPS091", "HIPS092", "HIPS092",
  "HIPS093"), StepHeight =  c(0.005, 0.008, 0.072, 0.003, 0.014,
  0.01,  0.027, 0.074, 0.128, 0.048, 0.036, 0.024, 0.021, 0.026,
  0.03,  0.004, 0.006, 0.006, 0.011, 0.006, 0.053, 0.028, 0.073,
  0.041, 0.005, 0.007, 0.013, 0.012, 0.021, 0.053, 0.013, 0.071,
  0.012, 0.016, 0.023, 0.024, 0.011, 0.019, 0.014, 0.022, 0.011,
  0.129, 0.03,  0.012, 0.062, 0.145, 0.077, 0.028, 0.006, 0.019,
  0.008, 0.006, 0.034, 0.109, 0.09,  0.005, 0.016, 0.005, 0.257,
  0.011, 0.205, 0.01,  0.017, 0.039, 0.01,  0.016, 0.043, 0.004,
  0.008, 0.04,  0.068, 0.006, 0.008, 0.005, 0.097, 0.015, 0.016,
  0.01,  0.021, 0.008, 0.01,  0.006, 0.016, 0.021, 0.012, 0.009,
  0.032, 0.055, 0.006, 0.066, 0.018, 0.01,  0.018, 0.017, 0.015,
  0.01,  0.017, 0.02,  0.022)), class = "data.frame", row.names = c(4L,
   5L,   6L,    7L,   8L,  10L,  12L,  14L,  19L,  29L,  30L,  31L, 33L, 41L,
   43L,  44L,  45L,  46L,  47L,  48L,  51L,  52L,  53L,  58L,  62L, 65L, 67L,
   70L,  72L,  74L,  75L,  77L,  79L,  82L,  83L,  86L,  88L,  89L, 90L, 93L,
  109L, 114L, 117L, 129L, 131L, 132L, 133L, 134L, 135L, 136L, 137L,
  138L, 142L, 143L, 144L, 145L, 146L, 147L, 148L, 149L, 150L, 151L,
  152L, 155L, 165L, 167L, 172L, 173L, 174L, 176L, 178L, 179L, 185L,
  186L, 188L, 192L, 193L, 195L, 197L, 199L, 202L, 203L, 204L, 214L,
  216L, 221L, 225L, 234L, 236L, 237L, 238L, 250L, 252L, 255L, 256L,
  257L, 258L, 260L, 261L))

datashort

# This does not work:
fitgee <- gee(HipFlex ~ 
StepHeight,data=datashort,id=PID,corstr="exchangeable",na.action=na.omit)
summary(fitgee)

# This works.
fitlm <- lm(HipFlex ~ StepHeight,data=datashort)
summary(fitlm)


John David Sorkin M.D., Ph.D.
Professor of Medicine, University of Maryland School of Medicine;

Associate Director for Biostatistics and Informatics, Baltimore VA Medical 
Center Geriatrics Research, Education, and Clinical Center;

PI Biostatistics and Informatics Core, University of Maryland School of 
Medicine Claude D. Pepper Older Americans Independence Center;

Senior Statistician University of Maryland Center for Vascular Research;

Division of Gerontology and Paliative Care,
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
Cell phone 443-418-5382


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to