Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个具有两种类型的许多不同固定效应的模型,我只对少数回归量感兴趣,而不是固定效应本身。我发现包含 as.factor 变量以具有固定效果(而不是使用内部估计器)更容易。但是,是否有可能抑制这些因子系数的输出?
我相信这应该可行...如果您的模型被命名,请m尝试以下操作:
m
coef(m)[!names(coef(m)) %in% paste0(rep(names(m$xlevels), times=sapply(m$xlevels, length)), unlist(sapply(names(m$xlevels), function(x) m$xlevels[[x]])))]
这很丑,但概念是使用对象的xlevels属性lm来识别作为因子的系数并将它们从系数列表中删除。其余的只是我能找到的正确格式化的最佳方法。
xlevels
lm