Aim: To find the regression of the given data
Problem: Find the regression of the following data
X 151 174 138 18 128 136 179 163 152 131
Y 63 81 56 91 47 57 76 72 62 48
R – Code:-
>X=c(151,174,138,186,128,136,179,163,152,131)
>Y=c(3,81,56,91,47,57,7,72,62,48)
lm(formula=Y~X)
print(summary (relateion))
> reg1=lm(X~Y)
> reg1
Call:
lm(formula = X ~ Y)
Coefficients:
(Intercept) Y
146.1282 0.1464
> reg1=lm(Y~X)
> reg1
Call:
lm(formula = Y ~ X)
Coefficients:
(Intercept) X
10.1555 0.2747
> summary(reg1)
Call:
lm(formula = X ~ Y)
Residuals:
1 2 3 4 5 6 7
0.8745 0.4184 -1.8563 0.3250 -0.3124 -0.5872 1.1380
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -6.42974 2.08251 -3.087 0.027237 *
Y 0.81870 0.07397 11.069 0.000105 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.116 on 5 degrees of freedom
Multiple R-squared: 0.9608, Adjusted R-squared: 0.9529
F-statistic: 122.5 on 1 and 5 DF, p-value: 0.00010.