0

I have a problem using geeglm form the geepack library. I don't understand what is wrong:

df <- structure(list(ID = c(3, 3, 10, 11, 11, 13), 
                     VO2max = c(3584.2, 2235.7, 4191.6, 2025.1, 3184.6, 2134.9), 
                     HRR120 = c(56, 34, 60, 57, 30, 67), 
                     Age = c(16, 24, 29, 11, 27, 34), 
                     Weight = c(63.8, 72, 81, 41, 108, 55),
                     Height = c(176, 167, 178, 150, 176, 156 )), 
                class = c("data.frame"))

library(geepack)
geeglm(formula = "VO2max ~ HRR120  ",family = "gaussian",corstr = "independence",id = ID,data = df)

Error in mcall$formula[3] <- switch(match(length(sformula), c(0, 2, 3)), : incompatible types (from language to character) in subassignment type fix

I tried

df$ID <- as.character(df$ID)
df$ID <- as.factor(df$ID)

without any luck. Does anyone have an explanation ?

Ryan M
  • 18,333
  • 31
  • 67
  • 74
denis
  • 5,580
  • 1
  • 13
  • 40

1 Answers1

3

Just unquote formula and everything works:

geeglm(formula = VO2max ~ HRR120, family = "gaussian",corstr = "independence",id = ID,data = df)

Call:
geeglm(formula = VO2max ~ HRR120, family = "gaussian", 
    data = df, id = ID, corstr = "independence")

Coefficients:
(Intercept)      HRR120 
2764.311798    2.533649 

Degrees of Freedom: 6 Total (i.e. Null);  4 Residual

Scale Link:                   identity
Estimated Scale Parameters:  [1] 666987

Correlation:  Structure = independence  
Number of clusters:   4   Maximum cluster size: 2 
Łukasz Deryło
  • 1,819
  • 1
  • 16
  • 32