【发布时间】:2020-09-08 07:30:22
【问题描述】:
在拟合 lme4 模型后,我想知道我们如何从 terms(fit)[[3]] 获得预测变量的类?
这是一个简单的例子,但我很欣赏lme4 中任何其他模型的功能性答案。
注意:一切都必须从模型中提取出来。
library(lme4)
h <- read.csv('https://raw.githubusercontent.com/hkil/m/master/h.csv')
h$year <- as.factor(h$year)
m <- lmer(scale~ year*group + (1|stid), data = h)
terms(m)[[3]] ## What are the `class`es of the variables in here (e.g., `integer`, `factor` etc.)
【问题讨论】: