We will build three models here. We have a vector of regressand
y and two covariates:
y <- c(1, 5,3,8,5,3,10,7),
x1 = c(2,4,5,6,8,10,11,13), and
x2 <- c(1,2, 2,4,4,4,6,6).
par(mfrow=c(1,3)) plot(x1,y) plot(x2,y) plot(x1,x2)
summary(lm(y~x1)) summary(lm(y~x2)) summary(lm(y~x1+x2)) # Our first multiple regression model