Reputation: 13802
When I try to use effects::effect
, it throws the following error:
Error in Effect.lm(predictors, mod, vcov. = vcov., ...) :
could not find function "vcov."
This error can be reproduced with this code:
lm_mtcars <- lm(mpg ~ wt, mtcars)
library(effects)
effect("wt", lm_mtcars, list(wt = seq(2, 3, 0.1)))
How can I fix this?
Upvotes: 2
Views: 2654
Reputation: 263352
The error arises because you did not name the xlevels
argument. Older versions of effects::effect
might have had a different third argument that could be positionally matched but the current version does not.
This will probably deliver what you were expecting:
lm_mtcars <- lm(mpg ~ wt, mtcars)
library(effects)
effect("wt", lm_mtcars, xlevels=list(wt = seq(2, 3, 0.1)))
Upvotes: 3