Find the multiple regression equation for the data given below.
x1 = -2 -2, -1, 2, 2
x2= -3, 1, 0, -2 , 2
y= -6 -11 -4 10 5
The equation is y^=y^= ++ x1+x1+ x2.
Sol;
use lm function in R to fit a multiple regression
Rcode:
x1 <- c(-2, -2, -1, 2, 2)
x2 <- c(-3, 1, 0, -2 , 2)
y <- c(-6 ,-11, -4 ,10, 5)
model1 <- lm(y~x1+x2)
summary(model1)
Call:
lm(formula = y ~ x1 + x2)
Residuals:
1 2 3 4 5
-0.30000 -0.50000 1.06667 -0.03333 -0.23333
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.8333 0.4014 -2.076 0.17353
x1 4.2333 0.2186 19.367 0.00266 **
x2 -1.2000 0.2160 -5.555 0.03091 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.8756 on 2 degrees of freedom
Multiple R-squared: 0.9947, Adjusted R-squared:
0.9895
F-statistic: 188.7 on 2 and 2 DF, p-value: 0.005273
From output:
Regression equation
y= -0.8333+ 4.2333x1 -1.2000x2
Get Answers For Free
Most questions answered within 1 hours.