In: Statistics and Probability
What is the coefficient of determinaton and cofficient of correlation for this data set
home prices vs square footage.
369,000 | 1,372 |
569,000 | 2909 |
439000 | 1837 |
544000 | 2573 |
399000 | 1642 |
499000 | 2216 |
599000 | 1400 |
487000 | 2508 |
410000 | 1800 |
379950 | 1674 |
565000 | 2056 |
659000 | 4171 |
859000 | 4308 |
610000 | 2303 |
450000 | 1698 |
480000 | 1896 |
319900 | 1970 |
385000 | 2320 |
449000 | 2846 |
199000 | 1440 |
369000 | 2295 |
350000 | 1512 |
449000 | 1900 |
525000 | 2080 |
770000 | 3168 |
789000 | 3236 |
675000 | 2784 |
765000 | 2802 |
Import the data set into R and store it into a data frame named dat.
Home_Price | Sq_ft |
369,000 | 1,372 |
569,000 | 2909 |
439000 | 1837 |
544000 | 2573 |
399000 | 1642 |
499000 | 2216 |
599000 | 1400 |
487000 | 2508 |
410000 | 1800 |
379950 | 1674 |
565000 | 2056 |
659000 | 4171 |
859000 | 4308 |
610000 | 2303 |
450000 | 1698 |
480000 | 1896 |
319900 | 1970 |
385000 | 2320 |
449000 | 2846 |
199000 | 1440 |
369000 | 2295 |
350000 | 1512 |
449000 | 1900 |
525000 | 2080 |
770000 | 3168 |
789000 | 3236 |
675000 | 2784 |
765000 | 2802 |
R Code Output-
> cor(dat$Home_Price,dat$Sq_ft)
[1] 0.7610977
> summary(lm(dat$Home_Price~dat$Sq_ft))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 146970.69 64293.42 2.286 0.0307 *
dat$Sq_ft 158.35 26.47 5.983 2.57e-06 ***
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 104700 on 26 degrees of freedom
Multiple R-squared: 0.5793, Adjusted R-squared: 0.5631
F-statistic: 35.8 on 1 and 26 DF, p-value: 2.572e-06
Hence ,the correlation coefficient =0.7610977 and the coefficient of determination= 0.5793.