Question

Price Lot Size Waterfront Age Land.Value New.Construct Central.Air Living Area Bedrooms Fireplaces Bathrooms Rooms 132500 0.0
USE R SOFTWARE TO SOLVE THE PROBLEM and SHOW ALL YOUR WORK WITH CODE.
Build the model one a multiple regression model including the living area (), number of bedrooms (), and number of fireplaces () as predictor variables.
summary the statistic
Produce an ANOVA table. Report SST, SSR, and SSE , and their corresponding degrees of freedom.

Model #2: a multiple regression model including the living area, “Central Air” (an indicator variable coded as 1 if a house has central air conditioning, 0 otherwise), and their interaction term as predictor variables.
Convert Central Air to categorical variable. Also convert Waterfront and New Construct to categorical variables for later use.
Construct a scatterplot of the selling price against the living area for the two groups: Central Air = 1 and = 0


DUE TO THE WHOLE DATABASE IS TOO LARGE,It is ok just use part of them.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

> #Model Building:
> #Dependent Variable - 'Price'
> #Explanatory Variable - 'Living.Area','Number of Bedrooms', and 'Number of Fireplaces'
>
> lin.fit = lm(Price ~ Living.Area+Bedrooms+Fireplaces,data = mydata)
>
> #Summary
> summary(lin.fit)

Call:
lm(formula = Price ~ Living.Area + Bedrooms + Fireplaces, data = mydata)

Residuals:
Min 1Q Median 3Q Max
-62948 -44151 -11924 25181 159655

Coefficients:
Estimate Std. Error t value Pr(>|t|)   
(Intercept) -76113.22 55113.57 -1.381 0.186   
Living.Area 162.08 48.27 3.358 0.004 **
Bedrooms -11816.43 24453.88 -0.483 0.635   
Fireplaces 21851.10 24552.28 0.890 0.387   
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 59450 on 16 degrees of freedom
Multiple R-squared: 0.6347,   Adjusted R-squared: 0.5662
F-statistic: 9.266 on 3 and 16 DF, p-value: 0.0008698

>
> #ANOVA
> anova(lin.fit)
Analysis of Variance Table

Response: Price
Df Sum Sq Mean Sq F value Pr(>F)
Living.Area 1 9.3321e+10 9.3321e+10 26.4019 9.913e-05 ***
Bedrooms 1 2.1378e+09 2.1378e+09 0.6048 0.4481
Fireplaces 1 2.7997e+09 2.7997e+09 0.7921 0.3867
Residuals 16 5.6554e+10 3.5346e+09
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> #Model 2
> #Dependent Variable - 'Price'
> #Explanatory Variable - 'Living.Area','Central Air', and Interaction of the respective variables
>
> lin.fit2 = lm(Price ~ Living.Area+Central.Air+Central.Air*Living.Area,data = mydata)
>
> #Summary
> summary(lin.fit2)

Call:
lm(formula = Price ~ Living.Area + Central.Air + Central.Air *
Living.Area, data = mydata)

Residuals:
Min 1Q Median 3Q Max
-73167 -42646 -6390 22429 182885

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -55250.06 47665.26 -1.159 0.263412
Living.Area 133.83 26.86 4.983 0.000135 ***
Central.Air -917668.34 1128241.33 -0.813 0.427949
Living.Area:Central.Air 576.49 708.23 0.814 0.427597
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 60750 on 16 degrees of freedom
Multiple R-squared: 0.6186,   Adjusted R-squared: 0.5471
F-statistic: 8.65 on 3 and 16 DF, p-value: 0.001215

>
> #ANOVA
> anova(lin.fit2)
Analysis of Variance Table

Response: Price
Df Sum Sq Mean Sq F value Pr(>F)
Living.Area 1 9.3321e+10 9.3321e+10 25.2876 0.0001235 ***
Central.Air 1 9.0242e+04 9.0242e+04 0.0000 0.9961156
Living.Area:Central.Air 1 2.4452e+09 2.4452e+09 0.6626 0.4275974
Residuals 16 5.9046e+10 3.6904e+09
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
> # Scatter Plot
> library(ggplot2)
> mydata$central.air <- as.factor(mydata$Central.Air)
> ggplot(mydata, aes(x=Living.Area, y=Price, shape=central.air, color=central.air)) +
+ geom_point()

4e+05 3e+05 central.air 2e+05 1e+05 1500 1000 2000 2500 Living Area

Add a comment
Know the answer?
Add Answer to:
USE R SOFTWARE TO SOLVE THE PROBLEM and SHOW ALL YOUR WORK WITH CODE. Build the model one a multiple regression model including the living area (), number of bedrooms (), and number of fireplaces...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT