1. Download the entire S&P CoreLogic Case-Shiller U.S. National Home Price Index (CSUSHPINSA) series from https://fred.stlouisfed.org/series/CSUSHPINSA

Using ‘tq_get’ can only provide data from 2015. So, we will download the data directly from the webiste.
##   observation_date CSUSHPINSA
## 1       1987-01-01     63.733
## 2       1987-02-01     64.132
## 3       1987-03-01     64.468
## 4       1987-04-01     64.972
## 5       1987-05-01     65.546
## 6       1987-06-01     66.218

2. Download the entire 30-Year Fixed Rate Mortgage Average in the United States (MORTGAGE30US) from https://fred.stlouisfed.org/series/MORTGAGE30US

## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
##   observation_date MORTGAGE30US
## 1       1987-01-02         9.37
## 2       1987-01-09         9.32
## 3       1987-01-16         9.21
## 4       1987-01-23         9.04
## 5       1987-01-30         9.08
## 6       1987-02-06         9.06

3. Plot the Home Prices and Average Monthly Mortgage Rate (beginning Jan-1-1987).

a.Home Prices = HPI Index Value*$1,000

b.Calculate average monthly values for the 30-year mortgage rates. The print is weekly.

## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
## # A tibble: 6 × 2
##   month      avg_rate
##   <date>        <dbl>
## 1 1987-01-01     9.20
## 2 1987-02-01     9.08
## 3 1987-03-01     9.04
## 4 1987-04-01     9.83
## 5 1987-05-01    10.6 
## 6 1987-06-01    10.5

4.Calculate the assumed monthly rent for the corresponding monthly home price. The assumed monthly rent has a gross rental yield of 8.00%. (Gross Rental Yield = Annual Rent/Home Price)

##   observation_date CSUSHPINSA Annual_Rent Monthly_Rent
## 1       1987-01-01     63.733     5098.64     424.8867
## 2       1987-02-01     64.132     5130.56     427.5467
## 3       1987-03-01     64.468     5157.44     429.7867
## 4       1987-04-01     64.972     5197.76     433.1467
## 5       1987-05-01     65.546     5243.68     436.9733
## 6       1987-06-01     66.218     5297.44     441.4533

5. Calculate the monthly mortgage payment amounts (P&I) assuming a 30 year mortgage on 90% of the value of the home for every period.

Dataset: csushpinsa_data for Home Price
##   observation_date CSUSHPINSA Annual_Rent Monthly_Rent
## 1       1987-01-01     63.733     5098.64     424.8867
## 2       1987-02-01     64.132     5130.56     427.5467
## 3       1987-03-01     64.468     5157.44     429.7867
## 4       1987-04-01     64.972     5197.76     433.1467
## 5       1987-05-01     65.546     5243.68     436.9733
## 6       1987-06-01     66.218     5297.44     441.4533
Dataset: average monthly mortgage rate
## # A tibble: 6 × 2
##   month      avg_rate
##   <date>        <dbl>
## 1 1987-01-01     9.20
## 2 1987-02-01     9.08
## 3 1987-03-01     9.04
## 4 1987-04-01     9.83
## 5 1987-05-01    10.6 
## 6 1987-06-01    10.5
Merge the two datasets for analysis:
##   observation_date CSUSHPINSA Annual_Rent Monthly_Rent avg_rate
## 1       1987-01-01     63.733     5098.64     424.8867   9.2040
## 2       1987-02-01     64.132     5130.56     427.5467   9.0825
## 3       1987-03-01     64.468     5157.44     429.7867   9.0350
## 4       1987-04-01     64.972     5197.76     433.1467   9.8325
## 5       1987-05-01     65.546     5243.68     436.9733  10.5960
## 6       1987-06-01     66.218     5297.44     441.4533  10.5375
Get the monthly mortgage payment amounts (monthly payments):
##   observation_date Home_Price avg_rate monthly_payment Monthly_Rent
## 1       1987-01-01      63733   9.2040        469.9733     424.8867
## 2       1987-02-01      64132   9.0825        467.8489     427.5467
## 3       1987-03-01      64468   9.0350        468.3136     429.7867
## 4       1987-04-01      64972   9.8325        505.9353     433.1467
## 5       1987-05-01      65546  10.5960        543.8560     436.9733
## 6       1987-06-01      66218  10.5375        546.8214     441.4533

6.Home ownership also includes certain fixed expenses such as taxes, insurance and HOA fees (if applicable). The fixed expense equates to about 1.7% of the value of the home.

a. Calculate the monthly additional fixed expense burden on home owner.

##   observation_date Home_Price Fixed_Expense
## 1       1987-01-01      63733      90.28842
## 2       1987-02-01      64132      90.85367
## 3       1987-03-01      64468      91.32967
## 4       1987-04-01      64972      92.04367
## 5       1987-05-01      65546      92.85683
## 6       1987-06-01      66218      93.80883

b. Calculate the total cost of owning a home.

##   observation_date Home_Price Fixed_Expense monthly_payment Buy_Total_Cost
## 1       1987-01-01      63733      90.28842        469.9733       560.2617
## 2       1987-02-01      64132      90.85367        467.8489       558.7025
## 3       1987-03-01      64468      91.32967        468.3136       559.6433
## 4       1987-04-01      64972      92.04367        505.9353       597.9790
## 5       1987-05-01      65546      92.85683        543.8560       636.7128
## 6       1987-06-01      66218      93.80883        546.8214       640.6302

7. Compare in which periods it is cheaper to own a home vs renting a home?

Restructure the data and only keep the total costs for buying the home and monthly payment for renting the home.
##   observation_date Buy_Total_Cost Monthly_Rent
## 1       1987-01-01       560.2617     424.8867
## 2       1987-02-01       558.7025     427.5467
## 3       1987-03-01       559.6433     429.7867
## 4       1987-04-01       597.9790     433.1467
## 5       1987-05-01       636.7128     436.9733
## 6       1987-06-01       640.6302     441.4533
Visualize the costs for renting and buying the home.
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Next, we will take a look at specific time for the comparison. In the last column, we can tell if it is cheaper to own a home than to rent a home.
##     observation_date Buy_Total_Cost Monthly_Rent Cheaper_to_Buy
## 1         1987-01-01       560.2617     424.8867          FALSE
## 2         1987-02-01       558.7025     427.5467          FALSE
## 3         1987-03-01       559.6433     429.7867          FALSE
## 4         1987-04-01       597.9790     433.1467          FALSE
## 5         1987-05-01       636.7128     436.9733          FALSE
## 6         1987-06-01       640.6302     441.4533          FALSE
## 7         1987-07-01       634.4882     445.2400          FALSE
## 8         1987-08-01       641.4296     448.4667          FALSE
## 9         1987-09-01       670.2222     450.8200          FALSE
## 10        1987-10-01       690.2038     452.6733          FALSE
## 11        1987-11-01       663.9157     453.9400          FALSE
## 12        1987-12-01       665.9017     455.6133          FALSE
## 13        1988-01-01       656.3355     457.2000          FALSE
## 14        1988-02-01       636.9911     459.4200          FALSE
## 15        1988-03-01       642.4968     462.1467          FALSE
## 16        1988-04-01       659.4510     465.2467          FALSE
## 17        1988-05-01       677.2585     469.3867          FALSE
## 18        1988-06-01       683.8364     473.7800          FALSE
## 19        1988-07-01       688.4341     477.9000          FALSE
## 20        1988-08-01       701.2770     481.2333          FALSE
## 21        1988-09-01       699.3133     483.8267          FALSE
## 22        1988-10-01       693.0269     485.4800          FALSE
## 23        1988-11-01       693.4954     487.0933          FALSE
## 24        1988-12-01       712.6023     488.5133          FALSE
## 25        1989-01-01       721.7757     490.7800          FALSE
## 26        1989-02-01       720.9692     493.1200          FALSE
## 27        1989-03-01       744.7855     496.0600          FALSE
## 28        1989-04-01       750.2870     499.1133          FALSE
## 29        1989-05-01       740.3927     501.9667          FALSE
## 30        1989-06-01       714.9751     504.6333          FALSE
## 31        1989-07-01       702.3646     506.9333          FALSE
## 32        1989-08-01       709.6892     508.4733          FALSE
## 33        1989-09-01       718.2515     509.4667          FALSE
## 34        1989-10-01       709.7930     509.9133          FALSE
## 35        1989-11-01       700.9802     510.1400          FALSE
## 36        1989-12-01       699.5720     509.9800          FALSE
## 37        1990-01-01       707.4973     510.1800          FALSE
## 38        1990-02-01       723.4772     510.5800          FALSE
## 39        1990-03-01       729.0154     511.9333          FALSE
## 40        1990-04-01       736.6354     513.5867          FALSE
## 41        1990-05-01       744.6839     515.3067          FALSE
## 42        1990-06-01       730.4053     516.6933          FALSE
## 43        1990-07-01       724.2629     517.0667          FALSE
## 44        1990-08-01       726.8520     516.5200          FALSE
## 45        1990-09-01       728.3716     514.8533          FALSE
## 46        1990-10-01       725.5196     512.7467          FALSE
## 47        1990-11-01       712.1859     509.2067          FALSE
## 48        1990-12-01       691.1845     506.4800          FALSE
## 49        1991-01-01       685.4475     503.5533          FALSE
## 50        1991-02-01       669.3962     501.6533          FALSE
## 51        1991-03-01       675.0485     500.9067          FALSE
## 52        1991-04-01       676.2858     502.1000          FALSE
## 53        1991-05-01       679.3250     505.1133          FALSE
## 54        1991-06-01       690.8328     508.3400          FALSE
## 55        1991-07-01       691.2189     510.1067          FALSE
## 56        1991-08-01       675.3077     510.6200          FALSE
## 57        1991-09-01       663.3703     510.4933          FALSE
## 58        1991-10-01       653.3911     508.6000          FALSE
## 59        1991-11-01       644.1686     506.8667          FALSE
## 60        1991-12-01       632.1737     505.6200          FALSE
## 61        1992-01-01       627.8226     504.6667          FALSE
## 62        1992-02-01       643.4463     504.3667          FALSE
## 63        1992-03-01       653.2299     505.4267          FALSE
## 64        1992-04-01       651.4699     507.2000          FALSE
## 65        1992-05-01       645.3172     509.3133          FALSE
## 66        1992-06-01       639.1110     510.6800          FALSE
## 67        1992-07-01       621.4382     511.4067          FALSE
## 68        1992-08-01       614.2216     511.5400          FALSE
## 69        1992-09-01       610.8775     510.8533          FALSE
## 70        1992-10-01       618.5853     510.6467          FALSE
## 71        1992-11-01       628.9354     510.5267          FALSE
## 72        1992-12-01       623.2005     509.7600          FALSE
## 73        1993-01-01       612.3703     509.3000          FALSE
## 74        1993-02-01       597.0718     508.8533          FALSE
## 75        1993-03-01       588.6468     509.2200          FALSE
## 76        1993-04-01       589.6956     511.0667          FALSE
## 77        1993-05-01       592.2098     513.5333          FALSE
## 78        1993-06-01       593.6821     516.7733          FALSE
## 79        1993-07-01       586.4286     519.2333          FALSE
## 80        1993-08-01       583.8372     520.8733          FALSE
## 81        1993-09-01       574.9977     521.3200          FALSE
## 82        1993-10-01       570.9915     521.1400          FALSE
## 83        1993-11-01       586.1474     521.1333          FALSE
## 84        1993-12-01       586.5279     520.7533          FALSE
## 85        1994-01-01       581.8478     521.3200          FALSE
## 86        1994-02-01       586.2910     521.3667          FALSE
## 87        1994-03-01       612.5164     522.3267          FALSE
## 88        1994-04-01       646.9038     524.6667          FALSE
## 89        1994-05-01       665.2733     528.0467          FALSE
## 90        1994-06-01       659.2478     531.3333          FALSE
## 91        1994-07-01       673.2999     533.7467          FALSE
## 92        1994-08-01       670.2260     535.4400          FALSE
## 93        1994-09-01       676.9755     535.6000          FALSE
## 94        1994-10-01       691.3978     535.3600          FALSE
## 95        1994-11-01       702.9809     534.4667          FALSE
## 96        1994-12-01       703.6338     533.8533          FALSE
## 97        1995-01-01       700.5469     533.5067          FALSE
## 98        1995-02-01       683.6707     533.2733          FALSE
## 99        1995-03-01       665.6533     533.8467          FALSE
## 100       1995-04-01       660.8184     535.7867          FALSE
## 101       1995-05-01       644.9016     537.9333          FALSE
## 102       1995-06-01       628.3031     540.4533          FALSE
## 103       1995-07-01       633.0580     542.7467          FALSE
## 104       1995-08-01       647.7549     544.3600          FALSE
## 105       1995-09-01       637.0351     544.9200          FALSE
## 106       1995-10-01       628.8237     544.8467          FALSE
## 107       1995-11-01       623.1860     544.2000          FALSE
## 108       1995-12-01       613.4473     543.4200          FALSE
## 109       1996-01-01       604.3946     542.8467          FALSE
## 110       1996-02-01       606.4055     542.6600          FALSE
## 111       1996-03-01       635.8593     544.4333          FALSE
## 112       1996-04-01       654.8201     547.4933          FALSE
## 113       1996-05-01       666.1373     550.6733          FALSE
## 114       1996-06-01       682.8544     553.6533          FALSE
## 115       1996-07-01       681.9340     556.1200          FALSE
## 116       1996-08-01       670.9837     557.6333          FALSE
## 117       1996-09-01       683.4535     558.0067          FALSE
## 118       1996-10-01       666.2891     557.5200          FALSE
## 119       1996-11-01       650.2727     557.0400          FALSE
## 120       1996-12-01       648.7000     556.6000          FALSE
## 121       1997-01-01       660.7608     556.8667          FALSE
## 122       1997-02-01       652.2407     557.3067          FALSE
## 123       1997-03-01       667.6255     559.4067          FALSE
## 124       1997-04-01       683.8577     562.1400          FALSE
## 125       1997-05-01       677.6770     565.7600          FALSE
## 126       1997-06-01       668.4188     569.3200          FALSE
## 127       1997-07-01       661.6673     572.2733          FALSE
## 128       1997-08-01       663.1204     574.3333          FALSE
## 129       1997-09-01       661.6968     575.4000          FALSE
## 130       1997-10-01       655.2436     576.0533          FALSE
## 131       1997-11-01       652.2356     577.5467          FALSE
## 132       1997-12-01       648.0529     578.9867          FALSE
## 133       1998-01-01       645.0727     581.0867          FALSE
## 134       1998-02-01       649.1901     582.4867          FALSE
## 135       1998-03-01       657.4651     585.8467          FALSE
## 136       1998-04-01       663.2253     590.3800          FALSE
## 137       1998-05-01       669.5614     595.8267          FALSE
## 138       1998-06-01       667.6952     601.2933          FALSE
## 139       1998-07-01       670.1219     605.7267          FALSE
## 140       1998-08-01       672.5379     609.3800          FALSE
## 141       1998-09-01       664.0649     611.6800          FALSE
## 142       1998-10-01       665.1656     613.3267          FALSE
## 143       1998-11-01       675.1599     614.6467          FALSE
## 144       1998-12-01       669.9226     616.2867          FALSE
## 145       1999-01-01       674.4947     618.0933          FALSE
## 146       1999-02-01       677.6911     619.8733          FALSE
## 147       1999-03-01       695.3974     624.0733          FALSE
## 148       1999-04-01       694.4469     629.5667          FALSE
## 149       1999-05-01       714.4645     635.7333          FALSE
## 150       1999-06-01       745.8920     642.4200          FALSE
## 151       1999-07-01       757.2369     647.9467          FALSE
## 152       1999-08-01       781.6593     652.6467          FALSE
## 153       1999-09-01       778.2894     655.9933          FALSE
## 154       1999-10-01       783.5331     658.8800          FALSE
## 155       1999-11-01       778.9666     660.9867          FALSE
## 156       1999-12-01       792.8938     663.6133          FALSE
## 157       2000-01-01       815.2774     666.6667          FALSE
## 158       2000-02-01       827.2546     670.4733          FALSE
## 159       2000-03-01       829.1538     676.4400          FALSE
## 160       2000-04-01       832.2716     683.6067          FALSE
## 161       2000-05-01       865.5444     691.3467          FALSE
## 162       2000-06-01       860.0337     699.0333          FALSE
## 163       2000-07-01       857.7568     704.8133          FALSE
## 164       2000-08-01       856.2036     710.1467          FALSE
## 165       2000-09-01       853.3832     714.2400          FALSE
## 166       2000-10-01       850.2389     718.1933          FALSE
## 167       2000-11-01       851.3124     721.9467          FALSE
## 168       2000-12-01       830.8486     725.2800          FALSE
## 169       2001-01-01       810.8172     728.1000          FALSE
## 170       2001-02-01       815.1564     730.9533          FALSE
## 171       2001-03-01       814.2078     735.9667          FALSE
## 172       2001-04-01       828.9429     741.6533          FALSE
## 173       2001-05-01       840.6571     748.0200          FALSE
## 174       2001-06-01       849.7071     755.1533          FALSE
## 175       2001-07-01       854.6067     761.5133          FALSE
## 176       2001-08-01       847.9516     766.5933          FALSE
## 177       2001-09-01       842.2581     769.7667          FALSE
## 178       2001-10-01       830.0115     771.2067          FALSE
## 179       2001-11-01       833.9313     772.2533          FALSE
## 180       2001-12-01       863.8820     773.7000          FALSE
## 181       2002-01-01       861.9615     776.2400          FALSE
## 182       2002-02-01       858.1113     779.4400          FALSE
## 183       2002-03-01       874.1904     786.1933          FALSE
## 184       2002-04-01       881.5893     794.7267          FALSE
## 185       2002-05-01       880.2535     805.2533          FALSE
## 186       2002-06-01       880.1065     815.5533          FALSE
## 187       2002-07-01       877.7400     824.5867          FALSE
## 188       2002-08-01       870.8095     831.5333          FALSE
## 189       2002-09-01       861.6814     836.6333          FALSE
## 190       2002-10-01       867.5562     840.9133          FALSE
## 191       2002-11-01       867.7617     844.2867          FALSE
## 192       2002-12-01       869.7302     847.6733          FALSE
## 193       2003-01-01       863.4526     851.0133          FALSE
## 194       2003-02-01       862.5852     855.5067          FALSE
## 195       2003-03-01       861.9625     862.0533           TRUE
## 196       2003-04-01       874.8779     869.9267          FALSE
## 197       2003-05-01       859.2984     878.9333           TRUE
## 198       2003-06-01       849.3569     888.1667           TRUE
## 199       2003-07-01       888.9175     897.6467           TRUE
## 200       2003-08-01       947.1755     906.4333          FALSE
## 201       2003-09-01       945.5933     913.8467          FALSE
## 202       2003-10-01       936.1572     919.8467          FALSE
## 203       2003-11-01       939.9490     925.1067          FALSE
## 204       2003-12-01       941.2505     930.8600          FALSE
## 205       2004-01-01       935.3293     938.0400           TRUE
## 206       2004-02-01       937.8475     946.8533           TRUE
## 207       2004-03-01       935.9017     960.5267           TRUE
## 208       2004-04-01       981.5476     974.5333          FALSE
## 209       2004-05-01      1033.8772     988.9067          FALSE
## 210       2004-06-01      1050.6432    1003.4667          FALSE
## 211       2004-07-01      1042.7707    1015.5933          FALSE
## 212       2004-08-01      1036.1276    1025.4333          FALSE
## 213       2004-09-01      1034.7558    1034.0667          FALSE
## 214       2004-10-01      1039.8811    1042.0000           TRUE
## 215       2004-11-01      1048.5261    1049.9867           TRUE
## 216       2004-12-01      1058.3368    1057.8133          FALSE
## 217       2005-01-01      1064.2267    1067.5400           TRUE
## 218       2005-02-01      1068.5423    1079.5000           TRUE
## 219       2005-03-01      1114.3560    1097.1800          FALSE
## 220       2005-04-01      1123.7511    1113.3400          FALSE
## 221       2005-05-01      1127.7662    1130.3067           TRUE
## 222       2005-06-01      1130.6964    1146.7800           TRUE
## 223       2005-07-01      1155.5680    1160.6600           TRUE
## 224       2005-08-01      1180.2587    1172.8267          FALSE
## 225       2005-09-01      1186.8948    1184.0733          FALSE
## 226       2005-10-01      1224.5098    1191.6867          FALSE
## 227       2005-11-01      1258.6294    1197.8333          FALSE
## 228       2005-12-01      1255.5339    1200.7200          FALSE
## 229       2006-01-01      1247.1358    1205.5200          FALSE
## 230       2006-02-01      1263.1647    1210.0000          FALSE
## 231       2006-03-01      1279.5188    1218.3267          FALSE
## 232       2006-04-01      1305.6856    1224.3200          FALSE
## 233       2006-05-01      1320.7342    1229.2000          FALSE
## 234       2006-06-01      1331.2163    1230.3133          FALSE
## 235       2006-07-01      1340.5292    1230.7133          FALSE
## 236       2006-08-01      1312.8627    1229.3600          FALSE
## 237       2006-09-01      1298.1710    1227.9867          FALSE
## 238       2006-10-01      1292.2797    1227.0267          FALSE
## 239       2006-11-01      1276.6522    1224.2067          FALSE
## 240       2006-12-01      1262.6279    1221.5267          FALSE
## 241       2007-01-01      1267.9006    1218.1200          FALSE
## 242       2007-02-01      1273.3966    1216.4733          FALSE
## 243       2007-03-01      1257.7247    1214.6267          FALSE
## 244       2007-04-01      1259.8457    1214.2133          FALSE
## 245       2007-05-01      1266.8559    1212.5667          FALSE
## 246       2007-06-01      1306.8736    1210.2667          FALSE
## 247       2007-07-01      1306.9837    1206.6200          FALSE
## 248       2007-08-01      1288.3057    1201.5600          FALSE
## 249       2007-09-01      1260.2865    1194.1467          FALSE
## 250       2007-10-01      1248.2944    1183.5267          FALSE
## 251       2007-11-01      1214.4894    1167.7400          FALSE
## 252       2007-12-01      1190.4220    1155.5733          FALSE
## 253       2008-01-01      1141.6581    1140.5067          FALSE
## 254       2008-02-01      1144.5598    1127.9267          FALSE
## 255       2008-03-01      1140.9402    1119.3467          FALSE
## 256       2008-04-01      1131.9296    1115.4800          FALSE
## 257       2008-05-01      1141.3261    1113.4667          FALSE
## 258       2008-06-01      1165.6192    1110.2467          FALSE
## 259       2008-07-01      1170.1907    1104.7533          FALSE
## 260       2008-08-01      1165.0543    1095.1867          FALSE
## 261       2008-09-01      1106.5615    1079.4133          FALSE
## 262       2008-10-01      1102.8225    1061.0867          FALSE
## 263       2008-11-01      1071.1776    1040.4800          FALSE
## 264       2008-12-01       977.2864    1016.9600           TRUE
## 265       2009-01-01       937.1303     995.7467           TRUE
## 266       2009-02-01       932.9127     984.1133           TRUE
## 267       2009-03-01       915.6299     976.7600           TRUE
## 268       2009-04-01       902.8258     979.6133           TRUE
## 269       2009-05-01       914.2067     987.8000           TRUE
## 270       2009-06-01       970.9371     998.6467           TRUE
## 271       2009-07-01       960.4073    1004.9933           TRUE
## 272       2009-08-01       957.4191    1004.4533           TRUE
## 273       2009-09-01       939.6246     997.5200           TRUE
## 274       2009-10-01       924.4504     990.5667           TRUE
## 275       2009-11-01       914.2012     986.2667           TRUE
## 276       2009-12-01       910.7357     977.7667           TRUE
## 277       2010-01-01       908.3823     966.6867           TRUE
## 278       2010-02-01       893.0235     953.6933           TRUE
## 279       2010-03-01       894.6319     957.3067           TRUE
## 280       2010-04-01       916.3392     969.3467           TRUE
## 281       2010-05-01       909.6255     980.2467           TRUE
## 282       2010-06-01       901.6846     984.6867           TRUE
## 283       2010-07-01       887.0133     983.7467           TRUE
## 284       2010-08-01       869.4990     976.1733           TRUE
## 285       2010-09-01       852.4370     964.0467           TRUE
## 286       2010-10-01       834.5683     954.1800           TRUE
## 287       2010-11-01       832.5381     945.4467           TRUE
## 288       2010-12-01       856.6912     937.5067           TRUE
## 289       2011-01-01       850.0824     926.8933           TRUE
## 290       2011-02-01       856.9454     918.1933           TRUE
## 291       2011-03-01       848.5034     918.5533           TRUE
## 292       2011-04-01       857.2683     927.7133           TRUE
## 293       2011-05-01       851.2791     937.9467           TRUE
## 294       2011-06-01       849.1351     946.2933           TRUE
## 295       2011-07-01       854.1784     948.9400           TRUE
## 296       2011-08-01       830.0985     945.2267           TRUE
## 297       2011-09-01       808.5537     934.4333           TRUE
## 298       2011-10-01       795.6213     922.7000           TRUE
## 299       2011-11-01       780.2622     911.0667           TRUE
## 300       2011-12-01       769.2935     901.0800           TRUE
## 301       2012-01-01       760.6205     894.4133           TRUE
## 302       2012-02-01       757.9236     893.2733           TRUE
## 303       2012-03-01       772.9794     905.7267           TRUE
## 304       2012-04-01       784.6644     923.1067           TRUE
## 305       2012-05-01       791.1466     940.2867           TRUE
## 306       2012-06-01       794.0754     954.4467           TRUE
## 307       2012-07-01       791.1314     961.8800           TRUE
## 308       2012-08-01       797.2502     964.7000           TRUE
## 309       2012-09-01       787.7182     962.3667           TRUE
## 310       2012-10-01       777.2951     959.7533           TRUE
## 311       2012-11-01       775.0603     959.6933           TRUE
## 312       2012-12-01       774.0588     959.0733           TRUE
## 313       2013-01-01       781.4152     962.0400           TRUE
## 314       2013-02-01       794.6550     967.7200           TRUE
## 315       2013-03-01       812.4125     986.3933           TRUE
## 316       2013-04-01       819.8299    1006.4533           TRUE
## 317       2013-05-01       842.5536    1025.7200           TRUE
## 318       2013-06-01       899.4073    1042.8267           TRUE
## 319       2013-07-01       935.0636    1055.2133           TRUE
## 320       2013-08-01       948.8962    1062.5933           TRUE
## 321       2013-09-01       953.4616    1064.4600           TRUE
## 322       2013-10-01       927.5863    1063.6933           TRUE
## 323       2013-11-01       931.7631    1062.4267           TRUE
## 324       2013-12-01       948.3806    1061.8733           TRUE
## 325       2014-01-01       946.7325    1062.4533           TRUE
## 326       2014-02-01       938.7237    1065.7933           TRUE
## 327       2014-03-01       949.8629    1074.5667           TRUE
## 328       2014-04-01       959.9090    1086.4200           TRUE
## 329       2014-05-01       957.3753    1097.8533           TRUE
## 330       2014-06-01       963.6923    1108.0467           TRUE
## 331       2014-07-01       966.2059    1114.2067           TRUE
## 332       2014-08-01       966.7138    1116.3067           TRUE
## 333       2014-09-01       969.6644    1114.9133           TRUE
## 334       2014-10-01       956.7169    1112.7000           TRUE
## 335       2014-11-01       951.9398    1111.0200           TRUE
## 336       2014-12-01       939.3232    1109.6933           TRUE
## 337       2015-01-01       921.6385    1108.2800           TRUE
## 338       2015-02-01       927.1413    1110.8200           TRUE
## 339       2015-03-01       940.4066    1120.5467           TRUE
## 340       2015-04-01       942.4458    1133.0933           TRUE
## 341       2015-05-01       967.6309    1145.6400           TRUE
## 342       2015-06-01       989.3988    1156.3133           TRUE
## 343       2015-07-01      1001.1140    1163.2800           TRUE
## 344       2015-08-01       990.8602    1166.2133           TRUE
## 345       2015-09-01       990.0957    1166.9067           TRUE
## 346       2015-10-01       981.6652    1166.9333           TRUE
## 347       2015-11-01       995.3673    1167.5267           TRUE
## 348       2015-12-01       997.1558    1167.3400           TRUE
## 349       2016-01-01       988.4391    1166.8133           TRUE
## 350       2016-02-01       970.7881    1168.4533           TRUE
## 351       2016-03-01       981.1734    1177.2800           TRUE
## 352       2016-04-01       983.6591    1189.9333           TRUE
## 353       2016-05-01       993.3928    1202.2600           TRUE
## 354       2016-06-01       999.0949    1212.7200           TRUE
## 355       2016-07-01       993.3648    1220.0533           TRUE
## 356       2016-08-01       996.3577    1224.2933           TRUE
## 357       2016-09-01      1000.2277    1226.2200           TRUE
## 358       2016-10-01      1001.5524    1226.7133           TRUE
## 359       2016-11-01      1030.6919    1228.1267           TRUE
## 360       2016-12-01      1072.5602    1229.2733           TRUE
## 361       2017-01-01      1069.3836    1230.9600           TRUE
## 362       2017-02-01      1073.2055    1233.4067           TRUE
## 363       2017-03-01      1084.7482    1243.4667           TRUE
## 364       2017-04-01      1081.5734    1256.8867           TRUE
## 365       2017-05-01      1089.5581    1270.1933           TRUE
## 366       2017-06-01      1088.8773    1281.6933           TRUE
## 367       2017-07-01      1102.2727    1289.9867           TRUE
## 368       2017-08-01      1098.2486    1295.5533           TRUE
## 369       2017-09-01      1093.4046    1298.6933           TRUE
## 370       2017-10-01      1103.9325    1300.4800           TRUE
## 371       2017-11-01      1108.7317    1302.9267           TRUE
## 372       2017-12-01      1113.8176    1305.5733           TRUE
## 373       2018-01-01      1123.7317    1307.3600           TRUE
## 374       2018-02-01      1158.9866    1312.6200           TRUE
## 375       2018-03-01      1180.8238    1323.7333           TRUE
## 376       2018-04-01      1195.4699    1337.3333           TRUE
## 377       2018-05-01      1219.2597    1349.5733           TRUE
## 378       2018-06-01      1227.0946    1360.1867           TRUE
## 379       2018-07-01      1227.8907    1366.2467           TRUE
## 380       2018-08-01      1232.6255    1368.7600           TRUE
## 381       2018-09-01      1241.4625    1369.0733           TRUE
## 382       2018-10-01      1263.9577    1369.0333           TRUE
## 383       2018-11-01      1266.3724    1367.2867           TRUE
## 384       2018-12-01      1238.4668    1364.5533           TRUE
## 385       2019-01-01      1216.4532    1361.2333           TRUE
## 386       2019-02-01      1207.5685    1362.7333           TRUE
## 387       2019-03-01      1204.1084    1371.7267           TRUE
## 388       2019-04-01      1201.9543    1384.5000           TRUE
## 389       2019-05-01      1203.8764    1395.5933           TRUE
## 390       2019-06-01      1181.6382    1403.8133           TRUE
## 391       2019-07-01      1181.7910    1408.8133           TRUE
## 392       2019-08-01      1167.7477    1411.2000           TRUE
## 393       2019-09-01      1167.5558    1412.3933           TRUE
## 394       2019-10-01      1176.9978    1413.0200           TRUE
## 395       2019-11-01      1178.5305    1413.9533           TRUE
## 396       2019-12-01      1181.9717    1414.8400           TRUE
## 397       2020-01-01      1172.5138    1415.9200           TRUE
## 398       2020-02-01      1159.9594    1421.3867           TRUE
## 399       2020-03-01      1169.0765    1434.5400           TRUE
## 400       2020-04-01      1164.5789    1448.1467           TRUE
## 401       2020-05-01      1163.3169    1456.4533           TRUE
## 402       2020-06-01      1162.8107    1465.3000           TRUE
## 403       2020-07-01      1156.2676    1477.0333           TRUE
## 404       2020-08-01      1160.4329    1493.5867           TRUE
## 405       2020-09-01      1169.7644    1511.9333           TRUE
## 406       2020-10-01      1179.1151    1532.0133           TRUE
## 407       2020-11-01      1184.2941    1548.7067           TRUE
## 408       2020-12-01      1185.7024    1562.3600           TRUE
## 409       2021-01-01      1201.9115    1576.1667           TRUE
## 410       2021-02-01      1224.6005    1594.6867           TRUE
## 411       2021-03-01      1282.3432    1627.9800           TRUE
## 412       2021-04-01      1309.0398    1665.3533           TRUE
## 413       2021-05-01      1326.4133    1702.8467           TRUE
## 414       2021-06-01      1357.7238    1741.0133           TRUE
## 415       2021-07-01      1366.5653    1769.9333           TRUE
## 416       2021-08-01      1380.1356    1791.7733           TRUE
## 417       2021-09-01      1401.2544    1809.4467           TRUE
## 418       2021-10-01      1434.8693    1824.1600           TRUE
## 419       2021-11-01      1447.2870    1839.9467           TRUE
## 420       2021-12-01      1464.9226    1857.0933           TRUE
## 421       2022-01-01      1531.0610    1879.5867           TRUE
## 422       2022-02-01      1605.5216    1914.3800           TRUE
## 423       2022-03-01      1711.6899    1966.4000           TRUE
## 424       2022-04-01      1881.4636    2010.6133           TRUE
## 425       2022-05-01      1953.1671    2042.4133           TRUE
## 426       2022-06-01      2015.1125    2054.3933           TRUE
## 427       2022-07-01      1988.5764    2046.6600           TRUE
## 428       2022-08-01      1934.1633    2023.8667           TRUE
## 429       2022-09-01      2066.1404    2002.7733          FALSE
## 430       2022-10-01      2193.1737    1990.8800          FALSE
## 431       2022-11-01      2162.9029    1978.7800          FALSE
## 432       2022-12-01      2067.5132    1962.0467          FALSE
## 433       2023-01-01      2041.2171    1952.0200          FALSE
## 434       2023-02-01      2044.0195    1957.1667          FALSE
## 435       2023-03-01      2121.6826    1983.4333          FALSE
## 436       2023-04-01      2115.2631    2010.9800          FALSE
## 437       2023-05-01      2157.2646    2036.8000          FALSE
## 438       2023-06-01      2231.0254    2056.4733          FALSE
## 439       2023-07-01      2268.2842    2069.2267          FALSE
## 440       2023-08-01      2321.9052    2078.3333          FALSE
## 441       2023-09-01      2352.5527    2084.0000          FALSE
## 442       2023-10-01      2435.9837    2086.3933          FALSE
## 443       2023-11-01      2395.7814    2081.3267          FALSE
## 444       2023-12-01      2268.2508    2073.4533          FALSE
## 445       2024-01-01      2234.9968    2072.3533          FALSE
## 446       2024-02-01      2273.7385    2085.1533          FALSE
## 447       2024-03-01      2312.5948    2113.1200          FALSE
## 448       2024-04-01      2374.7028    2139.4133          FALSE
## 449       2024-05-01      2409.5588    2158.9000          FALSE
## 450       2024-06-01      2393.1374    2169.2867          FALSE
## 451       2024-07-01      2381.7244    2171.3733          FALSE
## 452       2024-08-01      2310.2672    2167.6533          FALSE
## 453       2024-09-01      2246.6276    2165.2533          FALSE
## 454       2024-10-01      2289.6524    2161.2533          FALSE
## 455       2024-11-01      2360.3439    2159.4133          FALSE
This visualization represents periods when buying a home is cheaper than renting (in blue) versus when renting is the more affordable option (in red):
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_segment()`).

8. Write down your conclusions and observations.

(1) From the line chart, the overall trend of living cost (for both buying and renting) is increasing, and the cost rises sharply after 2020. Besides, there are noticeable fluctuations, particularly around the 2008 financial crisis, where buying costs spiked and then dropped significantly.
Also, before 2003, the cost of buying was higher than the cost of renting. After that, the difference between buying and renting costs became subtle, as the two lines converged. Around 2008 and beyond, the cost of renting became higher than the cost of buying until 2022, when buying costs surged past renting costs.
(2) From the table, we can have a closer look at the comparison of whether it’s cheaper to buy by month. Before 2003-03-01, renting a home is cheaper than buying one. During 2003-03-01 to 2005-07-31, there were alternating short periods where buying became more favorable, but these periods were relatively brief. Between December 2008 and August 2022, buying was consistently the better option. Since September 2022, renting has again become the cheaper option.
(3) From the horizontal bar, an extended period dominated by red, indicating that renting was the cheaper option for much of the time. During 2003 to 2006, there’s a transition zone where blue segments begin to appear, showing a shift toward buying becoming more affordable. After 2009, buying the home is a cheaper choice for most of the time.
(4) To conclude: the fluctuations in costs show that economic events (e.g., financial crises, interest rate changes) have a significant impact on the relative affordability of renting vs. buying.
In the long run, homeownership was more expensive than renting before 2003, but from 2008–2022, buying was the better financial decision. However, for short-term considerations, renting is now the more cost-effective option, likely due to rising mortgage rates and housing prices.