Skip to contents

This function calculate the expectation of the residuals by the use of the Frisch–Waugh–Lovell theorem.

Arguments

dat

Dataframe/List. List contains variable x and z.

Value

A vector of numeric expectations.

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)