Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The questions here involve the data set for Richmond townhouses obtained on 2014

ID: 3045150 • Letter: T

Question

The questions here involve the data set for Richmond townhouses obtained on 2014.11.03.
You are to apply the regsubsets() function in the leaps R package.
For your subset, the response variable is:
asking price divided by 10000:
askpr=c(44.8, 40.8, 33.7, 108.8, 51.68, 62.9, 50.8, 53.8, 62.8888, 79.99, 58.8, 50.5, 57.8, 68.8, 68.5, 73.8, 47.8, 65.99, 77.8, 57.8, 50.8, 58.39, 81.9, 56.88, 54.98, 49.9, 54.8, 48.8, 53.9, 40.8, 25.9, 52.4, 46.8, 41.99, 55.8, 65.8, 48.5, 59.8, 45.99, 86.8, 53.8, 26.99, 57.5, 58.68, 79.8, 56.8, 73.9, 40.9, 68.5, 54.8)
The explanatory variables are:
(i) finished floor area divided by 100
ffarea=c(9.4, 12.26, 12, 23.98, 15.1, 14, 12.27, 12.22, 15.77, 22, 17.37, 12.26, 12.01, 16.9, 15.76, 17.54, 13.34, 22.78, 16.5, 13.84, 16.6, 15.09, 20.95, 15.78, 13.06, 15.6, 11.26, 14.8, 11.84, 14, 6.1, 16.22, 16.2, 12.9, 13.06, 13.45, 14.8, 17.63, 16.01, 15.08, 10.95, 10.5, 13.46, 13.96, 15.25, 15.5, 15.15, 16.06, 13.59, 15.46)
(ii) age
age=c(14, 29, 28, 16, 20, 5, 17, 9, 6, 20, 26, 3, 0, 8, 4, 9, 32, 35, 3, 10, 23, 8, 19, 17, 1, 20, 0, 50, 15, 38, 11, 25, 30, 44, 0, 1, 24, 26, 25, 1, 18, 37, 10, 9, 3, 23, 0, 25, 2, 41)
(iii) monthly maintenance fee divided by 10
mfee=c(23.3, 19.8, 25.9, 36.9, 24.5, 19.6, 25.2, 18.5, 35.7, 26.7, 31, 18, 14.2, 19.4, 22.1, 18.2, 24.5, 57.4, 25.4, 16, 19.9, 20.3, 34.8, 17.3, 19.6, 27, 24.8, 25, 21, 23, 17.1, 36.4, 16, 23.2, 18.6, 18.2, 16.1, 32, 33.7, 48.8, 24.7, 28, 22.1, 22, 35, 17.4, 22.2, 24.4, 17, 31)
(iv) number of bedrooms
beds=c(2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 2, 4, 3, 4, 4, 1, 4, 3, 3, 2, 3, 2, 3, 1, 3, 4, 3, 3, 3, 3, 5, 3, 3, 2, 2, 3, 3, 2, 3, 4, 2, 3, 3)
(v) number of bathrooms
baths=c(2.5, 2.5, 2.5, 3.5, 2.5, 3.5, 2.5, 3.5, 3.5, 4.5, 3.5, 3.5, 3.5, 4.5, 3.5, 3.5, 3.5, 3.5, 4.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 2.5, 2.5, 2.5, 1.5, 2.5, 4.5, 2.5, 3.5, 3.5, 3.5, 2.5, 3.5, 3.5, 2.5, 1.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5)
After you have copied the above R vectors into your R session, you can get a dataframe with
richmondtownh=data.frame(askpr,ffarea,age,mfee,beds,baths)



Use regsubsets (with default method="exhaustive") in the leaps R package to find the best subsets with 1, 2, 3, 4, 5 explanatory variables, when askpr is the response variable.
Please use 3 decimal places for the answers below which are not integer-valued

Please use 3 decimal places for the answers below which are not integer-valued Part a) The values of adjusted R2 for the best models with 2, 3 and 4 explanatory variables are respectively 2 explanatory: 3 explanatory: 4 explanatory: Part b) The values of the Cp statistics for the best models with 2, 3 and 4 explanatory variables are respectively: 2 explanatory: 3 explanatory: 4 explanatory: Part c) For the best model based on adjusted R, the number of explanatory variables is Part d) For the best model based on Cp, the number of explanatory variables is

Explanation / Answer

# Below is the R code and output for mentioned problem.

askpr=c(44.8, 40.8, 33.7, 108.8, 51.68, 62.9, 50.8, 53.8, 62.8888, 79.99, 58.8, 50.5, 57.8, 68.8, 68.5, 73.8, 47.8, 65.99, 77.8, 57.8, 50.8, 58.39, 81.9, 56.88, 54.98, 49.9, 54.8, 48.8, 53.9, 40.8, 25.9, 52.4, 46.8, 41.99, 55.8, 65.8, 48.5, 59.8, 45.99, 86.8, 53.8, 26.99, 57.5, 58.68, 79.8, 56.8, 73.9, 40.9, 68.5, 54.8)
ffarea=c(9.4, 12.26, 12, 23.98, 15.1, 14, 12.27, 12.22, 15.77, 22, 17.37, 12.26, 12.01, 16.9, 15.76, 17.54, 13.34, 22.78, 16.5, 13.84, 16.6, 15.09, 20.95, 15.78, 13.06, 15.6, 11.26, 14.8, 11.84, 14, 6.1, 16.22, 16.2, 12.9, 13.06, 13.45, 14.8, 17.63, 16.01, 15.08, 10.95, 10.5, 13.46, 13.96, 15.25, 15.5, 15.15, 16.06, 13.59, 15.46)
age=c(14, 29, 28, 16, 20, 5, 17, 9, 6, 20, 26, 3, 0, 8, 4, 9, 32, 35, 3, 10, 23, 8, 19, 17, 1, 20, 0, 50, 15, 38, 11, 25, 30, 44, 0, 1, 24, 26, 25, 1, 18, 37, 10, 9, 3, 23, 0, 25, 2, 41)
mfee=c(23.3, 19.8, 25.9, 36.9, 24.5, 19.6, 25.2, 18.5, 35.7, 26.7, 31, 18, 14.2, 19.4, 22.1, 18.2, 24.5, 57.4, 25.4, 16, 19.9, 20.3, 34.8, 17.3, 19.6, 27, 24.8, 25, 21, 23, 17.1, 36.4, 16, 23.2, 18.6, 18.2, 16.1, 32, 33.7, 48.8, 24.7, 28, 22.1, 22, 35, 17.4, 22.2, 24.4, 17, 31)
beds=c(2, 3, 2, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 2, 4, 3, 4, 4, 1, 4, 3, 3, 2, 3, 2, 3, 1, 3, 4, 3, 3, 3, 3, 5, 3, 3, 2, 2, 3, 3, 2, 3, 4, 2, 3, 3)
baths=c(2.5, 2.5, 2.5, 3.5, 2.5, 3.5, 2.5, 3.5, 3.5, 4.5, 3.5, 3.5, 3.5, 4.5, 3.5, 3.5, 3.5, 3.5, 4.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 2.5, 2.5, 2.5, 1.5, 2.5, 4.5, 2.5, 3.5, 3.5, 3.5, 2.5, 3.5, 3.5, 2.5, 1.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5)
richmondtownh=data.frame(askpr,ffarea,age,mfee,beds,baths)

install.packages("leaps")
library(leaps)
fit<-regsubsets(askpr~.,data=richmondtownh,method="exhaustive")
summary(fit)

Output
Subset selection object
Call: regsubsets.formula(askpr ~ ., data = richmondtownh, method = "exhaustive")
5 Variables (and intercept)
Forced in Forced out
ffarea FALSE FALSE
age FALSE FALSE
mfee FALSE FALSE
beds FALSE FALSE
baths FALSE FALSE
1 subsets of each size up to 5
Selection Algorithm: exhaustive
ffarea age mfee beds baths
1 ( 1 ) "*" " " " " " " " "
2 ( 1 ) "*" "*" " " " " " "
3 ( 1 ) "*" "*" "*" " " " "
4 ( 1 ) "*" "*" "*" " " "*"
5 ( 1 ) "*" "*" "*" "*" "*"


part (a)
The values of adjusted R square for the best models with 2, 3, 4 explanatory variables are respectively

2 explanatory = 0.772
3 explanatory = 0.779
4 explanatory = 0.775

part (b)
The values of Cp statistics for the best models with 2, 3, 4 explanatory variables are respectively

2 explanatory = 200.400
3 explanatory = 199.731
4 explanatory = 201.539

part (c)
For the best model based on adjusted R square, the number of explanatory variables is 3

part (d)
For the best model based on Cp, the number of explanatory variables is 4

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote