我有一个大约300名患者的多级重复测量数据集,每个患者有多达10个预测肌钙蛋白升高的重复测量.数据集中还有其他变量,但我没有在此处包含它们.我试图用来nlme创建随机斜率,随机截距模型,其中患者之间的效果不同,并且不同患者的时间效果不同.当我尝试引入一阶协方差结构以允许由于时间的测量相关时,我得到以下错误消息.
Error in `coef<-.corARMA`(`*tmp*`, value = value[parMap[, i]]) : Coefficient matrix not invertible
Run Code Online (Sandbox Code Playgroud)
我已经包含了我的代码和数据集的样本,我将非常感谢任何智慧的话语.
#baseline model includes only the intercept. Random slopes - intercept varies across patients
randomintercept <- lme(troponin ~ 1,
data = df, random = ~1|record_id, method = "ML",
na.action = na.exclude,
control = list(opt="optim"))
#random intercept and time as fixed effect
timeri <- update(randomintercept,.~. + day)
#random slopes and intercept: effect of time is different in different people
timers <- update(timeri, random = ~ day|record_id) …Run Code Online (Sandbox Code Playgroud)