Ran across this when testing Yeo Johnson. Dug down into lm and as far as I can tell, x and y are the same vector, but for some reason lm fits a model with a large negative constant offset (when it should be 0) and a coefficient of 1 (which is correct). Didn't dig further, since I wanted to focus on YJ.
filtered_data <- epidatasets::grad_employ_subset
r <- epi_recipe(filtered_data) %>%
step_epi_lag(med_income_2y, lag = 0) %>%
step_epi_ahead(med_income_2y, ahead = 0, role = "outcome") %>%
step_epi_naomit()
f <- frosting() %>%
layer_predict()
wf <- epi_workflow(r, linear_reg()) %>%
fit(filtered_data) %>%
add_frosting(f)
# These should be the same (you can try this with another datsaset like JHU
out1 <- filtered_data %>% as_tibble()
out2 <- forecast(wf) %>% rename(med_income_2y = .pred)