R is a programming language for statistical computing and graphics. To install R, required installation files can be found in the following link:

Download RStudio

Clear memory

rm(list = ls())

Load data

tripdata = read.csv("D:/Projects/20-102/Project Task/Task 4/R code/HH trip data_NMO model.csv",header=TRUE)
summary(tripdata)
##    HTRIPS_nmo        worker         retired           hmaker      
##  Min.   : 0.00   Min.   :0.000   Min.   :0.0000   Min.   :0.0000  
##  1st Qu.: 4.50   1st Qu.:1.000   1st Qu.:0.0000   1st Qu.:0.0000  
##  Median : 8.50   Median :1.000   Median :0.0000   Median :0.0000  
##  Mean   :10.15   Mean   :1.298   Mean   :0.2816   Mean   :0.1138  
##  3rd Qu.:14.00   3rd Qu.:2.000   3rd Qu.:0.0000   3rd Qu.:0.0000  
##  Max.   :67.00   Max.   :5.000   Max.   :4.0000   Max.   :2.0000  
##     student          children          zero_veh         car_ls_drv    
##  Min.   :0.0000   Min.   : 0.0000   Min.   :0.00000   Min.   :0.0000  
##  1st Qu.:0.0000   1st Qu.: 0.0000   1st Qu.:0.00000   1st Qu.:0.0000  
##  Median :0.0000   Median : 0.0000   Median :0.00000   Median :0.0000  
##  Mean   :0.6813   Mean   : 0.6072   Mean   :0.04145   Mean   :0.1047  
##  3rd Qu.:1.0000   3rd Qu.: 1.0000   3rd Qu.:0.00000   3rd Qu.:0.0000  
##  Max.   :8.0000   Max.   :10.0000   Max.   :1.00000   Max.   :1.0000  
##   car_grt_wrk      inc_grt_100          nmo          nmo_zeroveh     
##  Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   Min.   :0.00000  
##  1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.00000  
##  Median :1.0000   Median :0.0000   Median :0.0000   Median :0.00000  
##  Mean   :0.5382   Mean   :0.1941   Mean   :0.1946   Mean   :0.01148  
##  3rd Qu.:1.0000   3rd Qu.:0.0000   3rd Qu.:0.0000   3rd Qu.:0.00000  
##  Max.   :1.0000   Max.   :1.0000   Max.   :1.0000   Max.   :1.00000  
##   nmo_carlsdrv    
##  Min.   :0.00000  
##  1st Qu.:0.00000  
##  Median :0.00000  
##  Mean   :0.02958  
##  3rd Qu.:0.00000  
##  Max.   :1.00000

Model estimation

hhtrip_nmo_model = lm(HTRIPS_nmo~worker+retired+hmaker+student+children+zero_veh+car_ls_drv+car_grt_wrk+inc_grt_100+nmo+nmo_zeroveh+nmo_carlsdrv, data = tripdata)

Model outputs

summary(hhtrip_nmo_model)
## 
## Call:
## lm(formula = HTRIPS_nmo ~ worker + retired + hmaker + student + 
##     children + zero_veh + car_ls_drv + car_grt_wrk + inc_grt_100 + 
##     nmo + nmo_zeroveh + nmo_carlsdrv, data = tripdata)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -23.946  -3.412  -0.761   2.796  56.165 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.26350    0.16916  13.381  < 2e-16 ***
## worker        2.90067    0.08419  34.456  < 2e-16 ***
## retired       1.00284    0.11941   8.399  < 2e-16 ***
## hmaker        1.72085    0.19017   9.049  < 2e-16 ***
## student       2.07068    0.10589  19.555  < 2e-16 ***
## children      2.17701    0.10766  20.222  < 2e-16 ***
## zero_veh      1.33238    0.35437   3.760 0.000171 ***
## car_ls_drv    0.89323    0.22300   4.006 6.23e-05 ***
## car_grt_wrk   0.89174    0.13330   6.690 2.35e-11 ***
## inc_grt_100   0.31676    0.14063   2.252 0.024321 *  
## nmo           0.84369    0.14383   5.866 4.60e-09 ***
## nmo_zeroveh   1.23288    0.62942   1.959 0.050168 .  
## nmo_carlsdrv  1.36828    0.40097   3.412 0.000646 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.568 on 10265 degrees of freedom
## Multiple R-squared:  0.4651, Adjusted R-squared:  0.4645 
## F-statistic: 743.7 on 12 and 10265 DF,  p-value: < 2.2e-16

Here, worker = Number of workers, retired = Number of retired persons, hmaker = Number of homemakers, student = Number of students, children = Number of children, zero_veh = Zero vehicle household, car_ls_drive = Household with cars < drivers, car_grt_wrk = Household with cars > workers, inc_grt_100 = Household income > $100,000, nmo = NMO availability indicator (urban household indicator), nmo_zeroveh = NMO availability * zero vehicle HH, nmo_carlsdrv = NMO availability * HH with cars < drivers