REGRESION MULTIPLE

Con los siguiente datos realizar una regresion multiple, con el objetivo de obtener los distintos betas.

y x1 x2
2 2.5 2
3 3 4
4 5 6
10 8 9
##regresion multiple

##B=(XT*X)-1*XTY
dates<- matrix(c(2, 2.5, 2,3, 3, 4,4, 5, 6, 10, 8, 9), nrow = 4, byrow = TRUE)
x<- matrix(c(1, 2.5, 2,1, 3, 4,1, 5, 6, 1, 8, 9), nrow = 4, byrow = TRUE)
y<- matrix(c(2,3,4,10), nrow = 4, byrow = TRUE)
xt<- t(x)
xt.x<- t(x) %*% x
xt.xl<- solve(xt.x)
xty<- t(x) %*% y
betas<- xt.xl %*% xty