Question

Run ANOVA tests for the price and whether the house is new or not and how...

Run ANOVA tests for the price and whether the house is new or not and how many bathrooms it has (R or SAS)

Price New Baths
279900 0 2
146500 1 1
237700 1 2
200000 1 2
159900 0 3
499900 1 2
265500 0 2
289900 1 2
587000 0 4
70000 0 2
64500 0 2
167000 1 2
114600 0 2

1) alpha level 0.05, test hypothesis of no interaction

2) If no interaction, test that the mean of the price is the same for new and old houses, control for bathrooms.

Thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

I am using R to run the anova test.

Loaded the data into "house" dataframe.

> str(house)
'data.frame':   13 obs. of 3 variables:
$ Price: int 279900 146500 237700 200000 159900 499900 265500 289900 587000 70000 ...
$ New : int 0 1 1 1 0 1 0 1 0 0 ...
$ Baths: int 2 1 2 2 3 2 2 2 4 2 ...

Make the New variable as factor variable.

house$New = as.factor(house$New)

Run the linear regression with Price as response variable and New and Baths as predictor variables with their interactions.

m = lm(Price~New+Baths+New:Baths, data = house)

Run the anova test.

> anova(m)
Analysis of Variance Table

Response: Price
Df Sum Sq Mean Sq F value Pr(>F)
New 1 4.3357e+09 4.3357e+09 0.2617 0.62127
Baths 1 1.3503e+11 1.3503e+11 8.1507 0.01894 *
New:Baths 1 1.6257e+09 1.6257e+09 0.0981 0.76122
Residuals 9 1.4910e+11 1.6567e+10
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

We see that the p-value for interaction is 0.76122 which is greater than the significance level of 0.05. Hence there is no significant interaction between New and Baths variable.

2)

H0: The price of new and old houses are equal.

H1:The price of new and old houses are unequal.

Get the data for New and Old house in x and y and run t-test

> x = subset(house, New == 0, select = c(Price))

> y = subset(house, New == 1, select = c(Price))


> t.test(x,y)

   Welch Two Sample t-test

data: x and y
t = -0.4201, df = 10.68, p-value = 0.6827
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-229266.5 155999.8
sample estimates:
mean of x mean of y
220200.0 256833.3

As, p-value is 0.6827 which is greater than significance level of 0.05, we fail to reject the null hypothesis and conclude that there is no significant difference in the prices of new and old houses.

Add a comment
Know the answer?
Add Answer to:
Run ANOVA tests for the price and whether the house is new or not and how...
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