In this notebook, we’ll analyze data from the New York City metropolitan area from the NHGIS website that, by now, you know pretty well. One of the purposes of the analyses is to correlate house prices with census tract amenities. Another purpose of the analysis is to estimate gradients of price w.r.t. to the distance to the metro area central business district.

We start by loading the CSV data from the NHGIS website.

Parsed with column specification:
cols(
  .default = col_integer(),
  GISJOIN = col_character(),
  YEAR = col_character(),
  REGIONA = col_character(),
  DIVISIONA = col_character(),
  STATE = col_character(),
  STATEA = col_character(),
  COUNTY = col_character(),
  COUNTYA = col_character(),
  COUSUBA = col_character(),
  PLACEA = col_character(),
  TRACTA = col_character(),
  BLKGRPA = col_character(),
  CONCITA = col_character(),
  AIANHHA = col_character(),
  RES_ONLYA = col_character(),
  TRUSTA = col_character(),
  AITSCEA = col_character(),
  ANRCA = col_character(),
  CBSAA = col_character(),
  CSAA = col_character()
  # ... with 19 more columns
)
See spec(...) for full column specifications.

|==============                                                                 |  18%    4 MB
|==============                                                                 |  18%    4 MB
|==============                                                                 |  18%    4 MB
|==============                                                                 |  18%    4 MB
|===============                                                                |  18%    4 MB
|===============                                                                |  18%    4 MB
|===============                                                                |  19%    4 MB
|===============                                                                |  19%    4 MB
|===============                                                                |  19%    4 MB
|===============                                                                |  19%    4 MB
|===============                                                                |  19%    4 MB
|================                                                               |  20%    4 MB
|================                                                               |  20%    4 MB
|================                                                               |  20%    4 MB
|================                                                               |  20%    4 MB
|================                                                               |  20%    5 MB
|================                                                               |  20%    5 MB
|================                                                               |  21%    5 MB
|=================                                                              |  21%    5 MB
|=================                                                              |  21%    5 MB
|=================                                                              |  21%    5 MB
|=================                                                              |  21%    5 MB
|=================                                                              |  21%    5 MB
|=================                                                              |  22%    5 MB
|=================                                                              |  22%    5 MB
|==================                                                             |  22%    5 MB
|==================                                                             |  22%    5 MB
|==================                                                             |  22%    5 MB
|==================                                                             |  23%    5 MB
|==================                                                             |  23%    5 MB
|==================                                                             |  23%    5 MB
|==================                                                             |  23%    5 MB
|===================                                                            |  23%    5 MB
|===================                                                            |  23%    5 MB
|===================                                                            |  24%    5 MB
|===================                                                            |  24%    5 MB
|===================                                                            |  24%    5 MB
|===================                                                            |  24%    5 MB
|===================                                                            |  24%    6 MB
|===================                                                            |  24%    6 MB
|====================                                                           |  25%    6 MB
|====================                                                           |  25%    6 MB
|====================                                                           |  25%    6 MB
|====================                                                           |  25%    6 MB
|====================                                                           |  25%    6 MB
|====================                                                           |  26%    6 MB
|====================                                                           |  26%    6 MB
|=====================                                                          |  26%    6 MB
|=====================                                                          |  26%    6 MB
|=====================                                                          |  26%    6 MB
|=====================                                                          |  26%    6 MB
|=====================                                                          |  27%    6 MB
|=====================                                                          |  27%    6 MB
|=====================                                                          |  27%    6 MB
|======================                                                         |  27%    6 MB
|======================                                                         |  27%    6 MB
|======================                                                         |  27%    6 MB
|======================                                                         |  28%    6 MB
|======================                                                         |  28%    6 MB
|======================                                                         |  28%    6 MB
|======================                                                         |  28%    6 MB
|=======================                                                        |  28%    6 MB
|=======================                                                        |  28%    7 MB
|=======================                                                        |  29%    7 MB
|=======================                                                        |  29%    7 MB
|=======================                                                        |  29%    7 MB
|=======================                                                        |  29%    7 MB
|=======================                                                        |  29%    7 MB
|=======================                                                        |  29%    7 MB
|========================                                                       |  30%    7 MB
|========================                                                       |  30%    7 MB
|========================                                                       |  30%    7 MB
|========================                                                       |  30%    7 MB
|========================                                                       |  30%    7 MB
|========================                                                       |  30%    7 MB
|========================                                                       |  31%    7 MB
|=========================                                                      |  31%    7 MB
|=========================                                                      |  31%    7 MB
|=========================                                                      |  31%    7 MB
|=========================                                                      |  31%    7 MB
|=========================                                                      |  32%    7 MB
|=========================                                                      |  32%    7 MB
|=========================                                                      |  32%    7 MB
|==========================                                                     |  32%    7 MB
|==========================                                                     |  32%    7 MB
|==========================                                                     |  32%    7 MB
|==========================                                                     |  33%    8 MB
|==========================                                                     |  33%    8 MB
|==========================                                                     |  33%    8 MB
|==========================                                                     |  33%    8 MB
|===========================                                                    |  33%    8 MB
|===========================                                                    |  33%    8 MB
|===========================                                                    |  34%    8 MB
|===========================                                                    |  34%    8 MB
|===========================                                                    |  34%    8 MB
|===========================                                                    |  34%    8 MB
|===========================                                                    |  34%    8 MB
|===========================                                                    |  34%    8 MB
|============================                                                   |  35%    8 MB
|============================                                                   |  35%    8 MB
|============================                                                   |  35%    8 MB
|============================                                                   |  35%    8 MB
|============================                                                   |  35%    8 MB
|============================                                                   |  35%    8 MB
|============================                                                   |  36%    8 MB
|=============================                                                  |  36%    8 MB
|=============================                                                  |  36%    8 MB
|=============================                                                  |  36%    8 MB
|=============================                                                  |  36%    8 MB
|=============================                                                  |  36%    8 MB
|=============================                                                  |  37%    8 MB
|=============================                                                  |  37%    9 MB
|=============================                                                  |  37%    9 MB
|==============================                                                 |  37%    9 MB
|==============================                                                 |  37%    9 MB
|==============================                                                 |  37%    9 MB
|==============================                                                 |  38%    9 MB
|==============================                                                 |  38%    9 MB
|==============================                                                 |  38%    9 MB
|==============================                                                 |  38%    9 MB
|===============================                                                |  38%    9 MB
|===============================                                                |  39%    9 MB
|===============================                                                |  39%    9 MB
|===============================                                                |  39%    9 MB
|===============================                                                |  39%    9 MB
|===============================                                                |  39%    9 MB
|===============================                                                |  39%    9 MB
|================================                                               |  40%    9 MB
|================================                                               |  40%    9 MB
|================================                                               |  40%    9 MB
|================================                                               |  40%    9 MB
|================================                                               |  40%    9 MB
|================================                                               |  40%    9 MB
|================================                                               |  41%    9 MB
|=================================                                              |  41%   10 MB
|=================================                                              |  41%   10 MB
|=================================                                              |  41%   10 MB
|=================================                                              |  41%   10 MB
|=================================                                              |  42%   10 MB
|=================================                                              |  42%   10 MB
|=================================                                              |  42%   10 MB
|==================================                                             |  42%   10 MB
|==================================                                             |  42%   10 MB
|==================================                                             |  42%   10 MB
|==================================                                             |  43%   10 MB
|==================================                                             |  43%   10 MB
|==================================                                             |  43%   10 MB
|==================================                                             |  43%   10 MB
|===================================                                            |  43%   10 MB
|===================================                                            |  44%   10 MB
|===================================                                            |  44%   10 MB
|===================================                                            |  44%   10 MB
|===================================                                            |  44%   10 MB
|===================================                                            |  44%   10 MB
|===================================                                            |  44%   10 MB
|====================================                                           |  45%   10 MB
|====================================                                           |  45%   10 MB
|====================================                                           |  45%   11 MB
|====================================                                           |  45%   11 MB
|====================================                                           |  45%   11 MB
|====================================                                           |  45%   11 MB
|====================================                                           |  46%   11 MB
|=====================================                                          |  46%   11 MB
|=====================================                                          |  46%   11 MB
|=====================================                                          |  46%   11 MB
|=====================================                                          |  46%   11 MB
|=====================================                                          |  47%   11 MB
|=====================================                                          |  47%   11 MB
|=====================================                                          |  47%   11 MB
|======================================                                         |  47%   11 MB
|======================================                                         |  47%   11 MB
|======================================                                         |  47%   11 MB
|======================================                                         |  48%   11 MB
|======================================                                         |  48%   11 MB
|======================================                                         |  48%   11 MB
|======================================                                         |  48%   11 MB
|======================================                                         |  48%   11 MB
|=======================================                                        |  48%   11 MB
|=======================================                                        |  49%   11 MB
|=======================================                                        |  49%   11 MB
|=======================================                                        |  49%   11 MB
|=======================================                                        |  49%   12 MB
|=======================================                                        |  49%   12 MB
|=======================================                                        |  49%   12 MB
|========================================                                       |  50%   12 MB
|========================================                                       |  50%   12 MB
|========================================                                       |  50%   12 MB
|========================================                                       |  50%   12 MB
|========================================                                       |  50%   12 MB
|========================================                                       |  51%   12 MB
|========================================                                       |  51%   12 MB
|=========================================                                      |  51%   12 MB
|=========================================                                      |  51%   12 MB
|=========================================                                      |  51%   12 MB
|=========================================                                      |  51%   12 MB
|=========================================                                      |  52%   12 MB
|=========================================                                      |  52%   12 MB
|=========================================                                      |  52%   12 MB
|==========================================                                     |  52%   12 MB
|==========================================                                     |  52%   12 MB
|==========================================                                     |  52%   12 MB
|==========================================                                     |  53%   12 MB
|==========================================                                     |  53%   12 MB
|==========================================                                     |  53%   12 MB
|==========================================                                     |  53%   12 MB
|===========================================                                    |  53%   13 MB
|===========================================                                    |  53%   13 MB
|===========================================                                    |  54%   13 MB
|===========================================                                    |  54%   13 MB
|===========================================                                    |  54%   13 MB
|===========================================                                    |  54%   13 MB
|===========================================                                    |  54%   13 MB
|============================================                                   |  55%   13 MB
|============================================                                   |  55%   13 MB
|============================================                                   |  55%   13 MB
|============================================                                   |  55%   13 MB
|============================================                                   |  55%   13 MB
|============================================                                   |  55%   13 MB
|============================================                                   |  56%   13 MB
|=============================================                                  |  56%   13 MB
|=============================================                                  |  56%   13 MB
|=============================================                                  |  56%   13 MB
|=============================================                                  |  56%   13 MB
|=============================================                                  |  56%   13 MB
|=============================================                                  |  57%   13 MB
|=============================================                                  |  57%   13 MB
|=============================================                                  |  57%   13 MB
|==============================================                                 |  57%   13 MB
|==============================================                                 |  57%   14 MB
|==============================================                                 |  58%   14 MB
|==============================================                                 |  58%   14 MB
|==============================================                                 |  58%   14 MB
|==============================================                                 |  58%   14 MB
|==============================================                                 |  58%   14 MB
|===============================================                                |  58%   14 MB
|===============================================                                |  59%   14 MB
|===============================================                                |  59%   14 MB
|===============================================                                |  59%   14 MB
|===============================================                                |  59%   14 MB
|===============================================                                |  59%   14 MB
|===============================================                                |  59%   14 MB
|================================================                               |  60%   14 MB
|================================================                               |  60%   14 MB
|================================================                               |  60%   14 MB
|================================================                               |  60%   14 MB
|================================================                               |  60%   14 MB
|================================================                               |  60%   14 MB
|================================================                               |  61%   14 MB
|=================================================                              |  61%   14 MB
|=================================================                              |  61%   14 MB
|=================================================                              |  61%   14 MB
|=================================================                              |  61%   14 MB
|=================================================                              |  61%   15 MB
|=================================================                              |  62%   15 MB
|=================================================                              |  62%   15 MB
|==================================================                             |  62%   15 MB
|==================================================                             |  62%   15 MB
|==================================================                             |  62%   15 MB
|==================================================                             |  63%   15 MB
|==================================================                             |  63%   15 MB
|==================================================                             |  63%   15 MB
|==================================================                             |  63%   15 MB
|==================================================                             |  63%   15 MB
|===================================================                            |  63%   15 MB
|===================================================                            |  64%   15 MB
|===================================================                            |  64%   15 MB
|===================================================                            |  64%   15 MB
|===================================================                            |  64%   15 MB
|===================================================                            |  64%   15 MB
|===================================================                            |  64%   15 MB
|====================================================                           |  65%   15 MB
|====================================================                           |  65%   15 MB
|====================================================                           |  65%   15 MB
|====================================================                           |  65%   15 MB
|====================================================                           |  65%   15 MB
|====================================================                           |  66%   16 MB
|====================================================                           |  66%   16 MB
|=====================================================                          |  66%   16 MB
|=====================================================                          |  66%   16 MB
|=====================================================                          |  66%   16 MB
|=====================================================                          |  66%   16 MB
|=====================================================                          |  67%   16 MB
|=====================================================                          |  67%   16 MB
|======================================================                         |  67%   16 MB
|======================================================                         |  67%   16 MB
|======================================================                         |  67%   16 MB
|======================================================                         |  68%   16 MB
|======================================================                         |  68%   16 MB
|======================================================                         |  68%   16 MB
|======================================================                         |  68%   16 MB
|=======================================================                        |  68%   16 MB
|=======================================================                        |  68%   16 MB
|=======================================================                        |  69%   16 MB
|=======================================================                        |  69%   16 MB
|=======================================================                        |  69%   16 MB
|=======================================================                        |  69%   16 MB
|=======================================================                        |  69%   16 MB
|=======================================================                        |  69%   16 MB
|========================================================                       |  70%   16 MB
|========================================================                       |  70%   17 MB
|========================================================                       |  70%   17 MB
|========================================================                       |  70%   17 MB
|========================================================                       |  70%   17 MB
|========================================================                       |  70%   17 MB
|========================================================                       |  71%   17 MB
|=========================================================                      |  71%   17 MB
|=========================================================                      |  71%   17 MB
|=========================================================                      |  71%   17 MB
|=========================================================                      |  71%   17 MB
|=========================================================                      |  71%   17 MB
|=========================================================                      |  72%   17 MB
|=========================================================                      |  72%   17 MB
|=========================================================                      |  72%   17 MB
|==========================================================                     |  72%   17 MB
|==========================================================                     |  72%   17 MB
|==========================================================                     |  72%   17 MB
|==========================================================                     |  73%   17 MB
|==========================================================                     |  73%   17 MB
|==========================================================                     |  73%   17 MB
|==========================================================                     |  73%   17 MB
|===========================================================                    |  73%   17 MB
|===========================================================                    |  74%   17 MB
|===========================================================                    |  74%   17 MB
|===========================================================                    |  74%   18 MB
|===========================================================                    |  74%   18 MB
|===========================================================                    |  74%   18 MB
|===========================================================                    |  74%   18 MB
|============================================================                   |  75%   18 MB
|============================================================                   |  75%   18 MB
|============================================================                   |  75%   18 MB
|============================================================                   |  75%   18 MB
|============================================================                   |  75%   18 MB
|============================================================                   |  75%   18 MB
|============================================================                   |  76%   18 MB
|=============================================================                  |  76%   18 MB
|=============================================================                  |  76%   18 MB
|=============================================================                  |  76%   18 MB
|=============================================================                  |  76%   18 MB
|=============================================================                  |  77%   18 MB
|=============================================================                  |  77%   18 MB
|=============================================================                  |  77%   18 MB
|==============================================================                 |  77%   18 MB
|==============================================================                 |  77%   18 MB
|==============================================================                 |  77%   18 MB
|==============================================================                 |  78%   18 MB
|==============================================================                 |  78%   18 MB
|==============================================================                 |  78%   19 MB
|==============================================================                 |  78%   19 MB
|===============================================================                |  78%   19 MB
|===============================================================                |  79%   19 MB
|===============================================================                |  79%   19 MB
|===============================================================                |  79%   19 MB
|===============================================================                |  79%   19 MB
|===============================================================                |  79%   19 MB
|===============================================================                |  79%   19 MB
|================================================================               |  80%   19 MB
|================================================================               |  80%   19 MB
|================================================================               |  80%   19 MB
|================================================================               |  80%   19 MB
|================================================================               |  80%   19 MB
|================================================================               |  81%   19 MB
|=================================================================              |  81%   19 MB
|=================================================================              |  81%   19 MB
|=================================================================              |  81%   19 MB
|=================================================================              |  81%   19 MB
|=================================================================              |  82%   19 MB
|=================================================================              |  82%   19 MB
|=================================================================              |  82%   19 MB
|==================================================================             |  82%   19 MB
|==================================================================             |  82%   20 MB
|==================================================================             |  82%   20 MB
|==================================================================             |  83%   20 MB
|==================================================================             |  83%   20 MB
|==================================================================             |  83%   20 MB
|==================================================================             |  83%   20 MB
|==================================================================             |  83%   20 MB
|===================================================================            |  83%   20 MB
|===================================================================            |  84%   20 MB
|===================================================================            |  84%   20 MB
|===================================================================            |  84%   20 MB
|===================================================================            |  84%   20 MB
|===================================================================            |  84%   20 MB
|===================================================================            |  84%   20 MB
|====================================================================           |  85%   20 MB
|====================================================================           |  85%   20 MB
|====================================================================           |  85%   20 MB
|====================================================================           |  85%   20 MB
|====================================================================           |  85%   20 MB
|====================================================================           |  85%   20 MB
|====================================================================           |  86%   20 MB
|=====================================================================          |  86%   20 MB
|=====================================================================          |  86%   20 MB
|=====================================================================          |  86%   20 MB
|=====================================================================          |  86%   21 MB
|=====================================================================          |  86%   21 MB
|=====================================================================          |  87%   21 MB
|=====================================================================          |  87%   21 MB
|=====================================================================          |  87%   21 MB
|======================================================================         |  87%   21 MB
|======================================================================         |  87%   21 MB
|======================================================================         |  87%   21 MB
|======================================================================         |  88%   21 MB
|======================================================================         |  88%   21 MB
|======================================================================         |  88%   21 MB
|======================================================================         |  88%   21 MB
|=======================================================================        |  88%   21 MB
|=======================================================================        |  88%   21 MB
|=======================================================================        |  89%   21 MB
|=======================================================================        |  89%   21 MB
|=======================================================================        |  89%   21 MB
|=======================================================================        |  89%   21 MB
|=======================================================================        |  89%   21 MB
|========================================================================       |  90%   21 MB
|========================================================================       |  90%   21 MB
|========================================================================       |  90%   21 MB
|========================================================================       |  90%   21 MB
|========================================================================       |  90%   21 MB
|========================================================================       |  90%   22 MB
|========================================================================       |  91%   22 MB
|========================================================================       |  91%   22 MB
|=========================================================================      |  91%   22 MB
|=========================================================================      |  91%   22 MB
|=========================================================================      |  91%   22 MB
|=========================================================================      |  91%   22 MB
|=========================================================================      |  92%   22 MB
|=========================================================================      |  92%   22 MB
|=========================================================================      |  92%   22 MB
|==========================================================================     |  92%   22 MB
|==========================================================================     |  92%   22 MB
|==========================================================================     |  92%   22 MB
|==========================================================================     |  93%   22 MB
|==========================================================================     |  93%   22 MB
|==========================================================================     |  93%   22 MB
|==========================================================================     |  93%   22 MB
|===========================================================================    |  93%   22 MB
|===========================================================================    |  94%   22 MB
|===========================================================================    |  94%   22 MB
|===========================================================================    |  94%   22 MB
|===========================================================================    |  94%   22 MB
|===========================================================================    |  94%   22 MB
|===========================================================================    |  94%   22 MB
|============================================================================   |  95%   23 MB
|============================================================================   |  95%   23 MB
|============================================================================   |  95%   23 MB
|============================================================================   |  95%   23 MB
|============================================================================   |  95%   23 MB
|============================================================================   |  95%   23 MB
|============================================================================   |  96%   23 MB
|=============================================================================  |  96%   23 MB
|=============================================================================  |  96%   23 MB
|=============================================================================  |  96%   23 MB
|=============================================================================  |  96%   23 MB
|=============================================================================  |  97%   23 MB
|=============================================================================  |  97%   23 MB
|=============================================================================  |  97%   23 MB
|============================================================================== |  97%   23 MB
|============================================================================== |  97%   23 MB
|============================================================================== |  97%   23 MB
|============================================================================== |  98%   23 MB
|============================================================================== |  98%   23 MB
|============================================================================== |  98%   23 MB
|============================================================================== |  98%   23 MB
|============================================================================== |  98%   23 MB
|===============================================================================|  98%   23 MB
|===============================================================================|  99%   24 MB
|===============================================================================|  99%   24 MB
|===============================================================================|  99%   24 MB
|===============================================================================|  99%   24 MB
|===============================================================================|  99%   24 MB
|================================================================================| 100%   24 MB
[1] "GISJOIN"             "median_value"        "median_number_rooms" "log_median_value"   

Some basic statistics on house values. Note that house values are self-reported. Here is a good reference that discusses the accuracy of self-reported house values:

Goodman, John L., and John B. Ittner. “The accuracy of home owners’ estimates of house value.” Journal of Housing Economics 2.4 (1992): 339-357.

hist(tractdata$median_value, main = 'log(Median Value)',
     xlab = 'log(Median Value)', ylab = 'Number of Neighborhoods')

hist(tractdata$log_median_value, main = 'log(Median Value)',
     xlab = 'log(Median Value)', ylab = 'Number of Neighborhoods')

Note that homes with a larger number of bedrooms are also more expensive. Sounds obvious? Let’s then look at some interesting prediction of the monocentric model.

ggplot(data = filter(tractdata, !is.na(median_number_rooms) & !is.na(log_median_value))) +
  geom_point(mapping = aes(x= median_number_rooms, y=log_median_value))