help page says that with newdata argument supplied, 3 columns are added to the dataset.
When newdata is supplied, augment.lm returns one row for each observation, with three columns added to the new data:
.fitted Fitted values of model
.se.fit Standard errors of fitted values
.resid Residuals of fitted values on the new data
However only 2 are there - no .resid column is calculated
library(dplyr)
library(broom)
train <- mtcars %>%
sample_frac(0.7)
test <- setdiff(mtcars, train)
model <- lm(mpg ~ cyl + disp, data= train)
augment(model, newdata = test) %>%
names()
#> [1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec"
#> [8] "vs" "am" "gear" "carb" ".fitted" ".se.fit"
So either, we could add a .resid column but it implies some calculation or at least the help page should be modified.
help page says that with newdata argument supplied, 3 columns are added to the dataset.
However only 2 are there - no
.residcolumn is calculatedSo either, we could add a
.residcolumn but it implies some calculation or at least the help page should be modified.