This function calculate the expectation of the residuals by the use of the Frisch–Waugh–Lovell theorem.
Examples
mod <- poly_model(4, 0.5)
dat <- mod$gen(1000, fit_model = TRUE)
dat$exp <- mod$E(dat)
mod$plot(dat) + ggplot2::geom_point(ggplot2::aes(.fitted, exp),
col = "red",
alpha = 0.6)