I want to estimate the following regression models:
y <- rnorm(1:100)
x1 <- 1:100
x2 <- 1:100
x3 <- 1:100
my_data <- data.frame(cbind(y, x1, x2, x3))
m1 <- lm(y ~ x1, data = my_data)
m2 <- lm(y ~ x2, data = my_data)
m3 <- lm(y ~ x3, data = my_data)
I want to run several models like this, using the same dataset and a different independent variable in each model. How can I use a loop to run each model?