Study the effect of recession on mean housing prices in university towns and non-university towns. Are the mean housing prices in university towns affected by recession? Are the mean housing prices in university towns and non-university towns affected the same way by recession?
Two hypothesis tests will be performed. First hypothesis test will test the effect of recession on mean housing prices in university towns. The effect will be studied by comparing mean housing prices of the quarter before recession started to the recession bottom. Second hypothesis test will test the effect of recession on university towns vs non-university towns in terms of price ratio. (price_ratio=quarter_before_recession/recession_bottom
)
To test the hypothesis, we have to assume a null hypothesis.
Hypothesis1 There is an effect of recession on mean housing prices in university towns.
Null Hypothesis There is no effect of recession on mean housing prices in university towns.
Hypothesis2 Effect of recession on university towns and non-university towns is different.
Null Hypothesis There is no difference between university towns and non-university towns in terms of effect of recession on mean housing prices.
-
From the Zillow research data site there is housing data for the United States. In particular the datafile for all homes at a city level,
City_Zhvi_AllHomes.csv
, has median home sale prices at a fine grained level. The data set consists of 10k+ rows. -
From the Wikipedia page on college towns is a list of university towns in the United States which has been copy and pasted into the file
university_towns.txt
. -
From Bureau of Economic Analysis, US Department of Commerce, the GDP over time of the United States in current dollars (use the chained value in 2009 dollars), in quarterly intervals, in the file
gdplev.xls
. For this project, only GDP data from the first quarter of 2000 onward is considered.
- A university town is a city which has a high percentage of university students compared to the total population of the city.
- A recession is defined as starting with two consecutive quarters of GDP decline, and ending with two consecutive quarters of GDP growth.
- A recession bottom is the quarter within a recession which had the lowest GDP.
Python, Pandas, Jupyter Notebooks
We are running hypothesis test to see the effect of recession on housing prices in university towns and non-university towns. To implement the hypothesis testing, following steps will be followed.
1. Preprocessing Raw Data
-
The prices of houses in housing data are given on yearly basis. This data needs to be converted to quarters because recession is measured on quartelry basis.
-
Next we need to find recession start and recession bottom. A recession starts with two consecutive quarters of GDP decline and ends with two consecutive quarters of GDP rise. A recession bottom is the quarter with lowest GDP during recession period. To find the recession period, GDP data from Bureau of Economic Analysis, US Department of Commerce is used.
-
The houses in the housing data need to be separated into two categories; university towns and non-university towns and to do this a list of university towns is used.
2. Hypothesis Testing
- Once the housing data is converted to quarters and we know the effect of recession on the housing prices in terms of price ratio we will divide the housing data into university towns and non-university towns to run hypothesis test on these two groups. The hypothesis test will show if the recession has affected the university towns and non-university towns in the same way.
Hypothesis 1: p>>>0.01 which means there is a strong evidence to not reject the NULL hypothesis. Hence, there is a great probability that recession has not affected mean housing prices in university towns.
Hypothesis 2: Since p is less than 0.01, there is a strong evidence to reject the NULL hypothesis. Hence, we can say that there is strong probabaility that our original hypothesis is true. Which means the recession has affected mean housing prices of university towns differently than non-university towns. If we compare the mean of price ratio for both town categories, we will see that prices of university towns are less affected than non-university towns.