从R中的lme4模型获取预测变量的类

问题描述 投票:1回答:1

[拟合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.)
r dataframe class lm lme4
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.