# NOT RUN {
#gen data
n <- 1000
X <- matrix(rnorm(n*3), ncol = 3)
colnames(X) <- c("x1", "x2", "x3")
beta <- c(1,2,3)
wage <- X %*% beta + rnorm(n)
dat <- as.data.frame(cbind(wage, X))
colnames(dat)[1] <- "wage"
res <- linear_projection("wage", X.list = list("x1", c("x2", "x3")), data = dat)
#each row is summed (up to a constant) to the standardized wage:
stand_wage <- (wage - mean(wage)) / sd(wage)
diff <- apply(res, 1, sum) - stand_wage
summary(diff)
# }
Run the code above in your browser using DataLab