346006 (2) [Avatar] Offline
#1
A very important comma is missing in the example plot() statement for effect() at the bottom of page 193
of "R_in_Action_Second__v16_MEAP.pdf" :

> library(datasets)

> mtcars

<snipped out data>

> fit <- lm(mpg ~ hp + wt + hp:wt, data=mtcars)

> library(effects)

> plot(effect("hp:wt", fit, list(wt=c(2.2,3.2,4.2))), multiline=TRUE)

Error in Effect.lm(predictors, mod, vcov. = vcov., ...) :
could not find function "vcov."


> plot(effect("hp:wt", fit,, list(wt=c(2.2,3.2,4.2))), multiline=TRUE)


TWO commas after "fit."



robert.kabacoff (170) [Avatar] Offline
#2
Thanks for pointing this out. I have corrected it in the second edition.
511269 (1) [Avatar] Offline
#3
I' ve seen a correction in the 2nd edition.