my answers in red boxes are wrong and could you give me the right answer in the
ID: 3045142 • Letter: M
Question
my answers in red boxes are wrong and could you give me the right answer in the red box?
The questions involve the data set for asking prices of Richmond townhouses obtained on 2014.11.03.
For your subset, the response variable is:
asking price divided by 10000:
askpr=c(44.8, 68.8, 46.8, 54.98, 49.9, 74.8, 48.8, 50.5, 55.2, 57.8, 50.8, 68.5, 57.5, 62.9, 57.8, 33.7, 68.8, 79.8, 40.9, 40.8, 65.99, 54.8, 59.8, 62.8888, 68.5, 56.8, 58.8, 25.9, 51.68, 56.88, 60.8, 79.99, 73.8, 47.9, 52.4, 51.99, 26.99, 50.8, 47.8, 40.8)
The explanatory variables are:
(i) finished floor area divided by 100
ffarea=c(9.4, 16.9, 16.2, 13.06, 15.6, 17.48, 14.8, 12.26, 15.3, 13.84, 16.6, 15.76, 13.46, 14, 12.01, 12, 15.95, 15.25, 16.06, 14, 22.78, 11.26, 17.63, 15.77, 13.59, 15.5, 17.37, 6.1, 15.1, 15.78, 13.2, 22, 17.54, 12.1, 16.22, 12.09, 10.5, 12.27, 13.34, 12.26)
(ii) age
age=c(14, 8, 30, 1, 20, 5, 50, 3, 9, 10, 23, 4, 10, 5, 0, 28, 18, 3, 25, 38, 35, 0, 26, 6, 2, 23, 26, 11, 20, 17, 3, 20, 9, 7, 25, 7, 37, 17, 32, 29)
You are to fit a multiple regression model with the response variable askpr and two explanatory variables ffarea, age
richmondtownh=data.frame(askpr,ffarea,age)
After fitting the regression model, get the vector of fitted or predicted values y iy^i.
Please use 3 significant digits for the answers below which are not integer-valued
Explanation / Answer
Using R studio:
> askpr=c(44.8, 68.8, 46.8, 54.98, 49.9, 74.8, 48.8, 50.5, 55.2, 57.8, 50.8, 68.5, 57.5, 62.9, 57.8, 33.7, 68.8, 79.8, 40.9, 40.8, 65.99, 54.8, 59.8, 62.8888, 68.5, 56.8, 58.8, 25.9, 51.68, 56.88, 60.8, 79.99, 73.8, 47.9, 52.4, 51.99, 26.99, 50.8, 47.8, 40.8)
> ffarea=c(9.4, 16.9, 16.2, 13.06, 15.6, 17.48, 14.8, 12.26, 15.3, 13.84, 16.6, 15.76, 13.46, 14, 12.01, 12, 15.95, 15.25, 16.06, 14, 22.78, 11.26, 17.63, 15.77, 13.59, 15.5, 17.37, 6.1, 15.1, 15.78, 13.2, 22, 17.54, 12.1, 16.22, 12.09, 10.5, 12.27, 13.34, 12.26)
> age=c(14, 8, 30, 1, 20, 5, 50, 3, 9, 10, 23, 4, 10, 5, 0, 28, 18, 3, 25, 38, 35, 0, 26, 6, 2, 23, 26, 11, 20, 17, 3, 20, 9, 7, 25, 7, 37, 17, 32, 29)
> richmondtownh=data.frame(askpr,ffarea,age)
> lz <- lm(richmondtownh$askpr~ richmondtownh$ffarea+richmondtownh$age)
> summary(lz)
Call:
lm(formula = richmondtownh$askpr ~ richmondtownh$ffarea + richmondtownh$age)
Residuals:
Min 1Q Median 3Q Max
-13.9049 -4.7301 0.4835 2.4310 13.8689
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.31375 4.52642 3.825 0.000486 ***
richmondtownh$ffarea 3.31150 0.31226 10.605 9.03e-13 ***
richmondtownh$age -0.62766 0.07609 -8.249 6.60e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5.772 on 37 degrees of freedom
Multiple R-squared: 0.8006, Adjusted R-squared: 0.7898
F-statistic: 74.26 on 2 and 37 DF, p-value: 1.113e-13
> ycap <- predict(lz)
> cor(richmondtownh$askpr, ycap)
[1] 0.8947429
Part d) correlation between Y_cap and Yi = 0.8947429 and R-squared= 0.800565
Part e) :
> intercept= 19.1379
> X1 <- 3.4115
> X2 <- -0.82766
> newpd <- intercept+(X1*richmondtownh$ffarea)+(X2*richmondtownh$age)
> newpd
[1] 39.61876 70.17097 49.57440 62.86443 55.80410 74.63262 28.24510 58.47991 63.88491
[10] 58.07646 56.73262 69.59250 56.78009 62.76060 60.11002 36.90142 58.65345 68.68030
[19] 53.23509 35.44782 67.88377 57.55139 57.76349 67.97129 63.84486 52.97997 56.87650
[28] 30.84379 54.09835 58.90115 61.68672 77.63770 71.52667 54.62343 53.78093 54.58932
[37] 24.33523 46.92679 38.16219 36.96075
> cor(richmondtownh$askpr, newpd)
[1] 0.8842519
The sample correlation between Wi and Yi = 0.8842519
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.