function Effect.lm()
from R package effects
has a bug that can be resolved by adding 3 lines of code.
I have the solution below, but is there a way to implement this change to Effect.lm()
from R package effects
?
I intend to use Effect.lm()
indirectly (via another function), and the change must be replicable by other users.
ps. I think this answer may be relevant. Unfortunately, @Ben Bolker 's answer (his R code), as he mentions, doesn't achieve my goal above.
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