【发布时间】:2023-04-10 06:08:01
【问题描述】:
来自 R 包 effects 的函数 Effect.lm() 有一个错误,可以通过添加 3 行代码来解决。
我有下面的解决方案,但是有没有办法从 R 包 effects 实现对 Effect.lm() 的更改?
我打算间接使用Effect.lm()(通过另一个函数),并且更改必须可以被其他用户复制。
ps。我认为this answer 可能是相关的。 不幸的是,正如他所提到的,@Ben Bolker 的答案(他的 R 代码)并没有达到我的上述目标。
library(effects)
# Delete line 164 in the following
View(effects::Effect.lm)
# Then, in its place, add the following 3 lines
use <- !is.na(mod$coefficients) # new
mmat <- mod.matrix[, use] # new
if (any(is.na(V))) V <- V[use, use] # new
【问题讨论】:
-
你联系维护者/提交问题了吗?我的回答解决了你的问题吗? (如果是,我们鼓励您接受它;如果不是,欢迎您评论/解释它为什么不起作用)