我正在尝试使用lme()函数进行重复测量回归(结果是一个连续变量" asdate_regdate")。首先,我发布了这个问题,因为我在f1行之后收到了错误。问题解决了,我在lme行后面临一个新的错误。
我有30个变量和66872行数据。我有分类和数字预测器。我每个病人都有多行数据。 " IKN"是每个患者的ID变量。我替换了数据集中的缺失值,我在两个变量中只有少量缺失数据,这就是我使用na.action = na.omit的原因。当我运行代码时,我在lme函数后收到以下错误。
错误:C堆栈使用率7969204太接近极限。
我的代码如下:
vars1 <- colnames(d.train)[-c(1,30)]
f1 <- as.formula(paste("asdate_regdate~", paste(vars1, collapse= "*")))
f2 <- as.formula(paste("~1|ikn"))
library(nlme)
model <- lme(f1, random=f2, data=d.train, method="ML", na.action=na.omit)
请找到colnames(d.train)如下:
[1] "ikn"
[2] "charlson"
[3] "sex"
[4] "age"
[5] "incquint"
[6] "rural"
[7] "death"
[8] "Tired"
[9] "Nausea"
[10] "Depression"
[11] "Anxious"
[12] "Drowsy"
[13] "Appetite"
[14] "Wellbeing"
[15] "ShortBreath"
[16] "Pain"
[17] "triage"
[18] "daysInpatient_cihi"
[19] "hcd_count_in30days"
[20] "hcd_count_before30days"
[21] "hcd_nursing"
[22] "hcd_personal"
[23] "hcd_else"
[24] "ohip_count_in30days"
[25] "palliative.care.codes_count_in30days"
[26] "house.calls.codes_count_in30days"
[27] "Acodes_count_in30days"
[28] "Wcodes_count_in30days"
[29] "cancertype"
[30] "asdate_regdate"