In: Statistics and Probability
Y |
X |
72 |
45 |
73 |
38 |
75 |
41 |
76 |
35 |
77 |
31 |
1.
> data
Y X
1 72 45
2 73 38
3 75 41
4 76 35
5 77 31
> cor(data$Y,data$X,method = "pearson")
[1] -0.8507273
Correlation between X and Y = -0.8507
2. > plot(data$X, data$Y,type = "p",main = "Scatterplot",xlab = "x", ylab = "Y")
It represents a strong linear (but negative) relationship.
3.
> model = lm(Y~X,data=data)
> summary(model)
Call:
lm(formula = Y ~ X, data = data)
Residuals:
1 2 3 4 5
-0.3069 -1.6000 1.3828 0.4172 0.1069
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 87.0483 4.4759 19.448 0.000297 ***
X -0.3276 0.1169 -2.803 0.067660 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.259 on 3 degrees of freedom
Multiple R-squared: 0.7237, Adjusted R-squared:
0.6316
F-statistic: 7.859 on 1 and 3 DF, p-value: 0.06766
Equation : Y = 87.05 - 0.33 X
R-squared = 0.7237
Interpretation :
X explains 72.37% variability in Y
Please rate my answer and comment for doubt.