Question: n this exam you will work with a simulated housing dataset to test whether rural house prices went up faster than non - rural house
n this exam you will work with a simulated housing dataset to test whether rural house prices went up faster than nonrural house prices after due to the pandemic. You will be using a diffindiff analysis while at the same time discovering how factors like square footage and number of bedrooms affect house price.
There are two datasets:
sales.csv: A dataset where each row is a house sale. The variables are:
saleid: A unique identifier for the sale
saleprice: The price at which the house was sold
saleyear: The year in which the house was sold
zipcode: The zipcode of the house
sqft: The square footage of the house
lotsqft: The square footage of the lot
numbedrooms: The number of bedrooms in the house
numbathrooms: The number of bathrooms in the house
builtbefore: Whether the house was built before
hasgarage: Whether the house has a garage
hasview: Whether the house has a nice view
zips.csv: A dataset where each row is a zipcode. The variables are:
zipcode: The zipcode
isrural: Whether or not the zipcode is rural
There are four tasks.
Task
Read both data files into R and merge them. Name the resulting dataframe df
Task
Create three new variables in df:
treated: A boolean variable which is True if the house is in a rural zipcode
post: A boolean variable which is True if the sale year is
treatedXpost: Equal to treatedpost
Task
Make a diffindiff plot showing the average log sale price by year for the treated rural and untreated nonrural groups.
The plot title should be "Average Log Sale Price by Year, Rural vs NonRural"
The X axis should be labeled "Year"
The Y axis should be labeled "Avg Log Sale Price"
Task
Run one regression with logsaleprice as the dependent variable. Include the following variables as covariates:
logsqft
loglotsqft
numbedrooms
numbathrooms
builtbefore
hasgarage
hasview
treatedXpost
Additionally, include saleyear and zipcode as dummy variables
Report the regression results using Stargazer. The table should only have one column
Interpret the results
In addition, you must answer a question asking you to interpret the results pts
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
