In: Statistics and Probability
An artical compared the thickness of a layer of material with the length of the material.The following data was obtained:
Length (x) Thickness (y)
45 3.20
58 3.40
71 3.47
71 3.55
85 3.60
98 3.70
108 3.80
a. Fit a straight line to the data and determine the line equation.
b. Calculate r2 and determine if the linear relationship between the data seems appropriate
I am doing this problem in R. So, here I am attaching my R-code:
> X=c(45,58,71,71,85,98,108)
> Y=c(3.20,3.40,3.47,3.55,3.60,3.70,3.80)
> # Fit a linear regression model between X & Y
> model<-lm(Y~X)
> summary(model)
Call:
lm(formula = Y ~ X)
Residuals:
1 2 3 4 5 6 7
-0.052917 0.032402 -0.012279 0.067721 -0.005782 -0.020464
-0.008680
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.8559437 0.0625981 45.62 9.55e-08 ***
X 0.0088216 0.0007899 11.17 1e-04 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.0427 on 5 degrees of freedom
Multiple R-squared: 0.9615, Adjusted R-squared: 0.9538
F-statistic: 124.7 on 1 and 5 DF, p-value: 0.0001004
Thus,
1) The fitted line of equation is
Y^=2.856 + 0.009*X
2) Here, r square is 0.9615. Since value of R square is nearly equal to 1. So, we can say there is good linear relationship between the data.