我在使用geeglm
形成geepack
库时遇到问题。我不明白出了什么问题:
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)
mcall$formula[3] 中的错误 <- switch(match(length(sformula(, c(0, 2, 3((, : 子赋值类型修复中的不兼容类型(从语言到字符(
我试过了
df$ID <- as.character(df$ID)
df$ID <- as.factor(df$ID)
没有任何运气。有人有解释吗?
只需取消引用公式,一切正常:
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