In: Statistics and Probability
Which prediction equation will describe the below experimental data the best? Explain why.
Y=0.35+1.15x1+0.75x2
Y=0.35+1.15x1-0.75x2
Y=0.35+1.15x2+0.75x1
Y=0.35+1.15x2-0.75x1
Here is the data for question3
Which prediction equation will describe the below experimental data the best? Explain why.
Y=0.35+1.15x1+0.75x2
Y=0.35+1.15x1-0.75x2
Y=0.35+1.15x2+0.75x1
Y=0.35+1.15x2-0.75x1
y |
x1 |
x2 |
1 |
1 |
1 |
1 |
2 |
2 |
2 |
3 |
2 |
2 |
4 |
4 |
4 |
5 |
3 |
Sol:
In R studio fit a linear regression of y on x1 and x2 using lm function
linmod is a linear model fit of y on x1 and x2
coefficients to get the coefficients
Rcode:
df1 =read.table(header = TRUE, text ="
y x1 x2
1 1 1
1 2 2
2 3 2
2 4 4
4 5 3
"
)
df1
linmod <- lm(y~x1+x2,data=df1)
coefficients(linmod)
Output:
(Intercept) x1 x2
0.35 1.15 -0.75
Rscreenshot:
y^=0.35+1.15x1-0.75x2
The prediction equation that best fit the data is
Y=0.35+1.15x1-0.75x2
OPTION B