Loading Data

library(data.table)
library(MASS)
library(randomForest)
## randomForest 4.6-14
## Type rfNews() to see new features/changes/bug fixes.
library(corrplot)
## corrplot 0.84 loaded
dat_yearly <- get(load(url('http://people.tamu.edu/~cma16/w3i4b3j1tam/TMC_Yearly.rData')))
table(dat_yearly$Facility_Type)
## 
##  0_RI 1_R2L 2_RMU 3_RMD 4_OTH 
##   699  1956   180   661   712
myDat <- subset(dat_yearly, myState=="WA")

RI <- subset(myDat, Facility_Type=="0_RI")
R2 <- subset(myDat, Facility_Type=="1_R2L")
RMU <- subset(myDat, Facility_Type=="2_RMU")
RMD <- subset(myDat, Facility_Type=="3_RMD")

Rural Interstate

RI_a <- RI[,c("Total", "DISTANCE", "AADT", "NO_LANES", "MEDWID",
              "SURF_WID", "OptSpd", "SpdVarr1", "SpdVarr2", "SpdVarr3",     
              "SpdVarr4", "SpdAvg", "SpdFF")]

library("PerformanceAnalytics")
## Warning: package 'PerformanceAnalytics' was built under R version 3.5.2
## Loading required package: xts
## Warning: package 'xts' was built under R version 3.5.2
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## 
## Attaching package: 'xts'
## The following objects are masked from 'package:data.table':
## 
##     first, last
## 
## Attaching package: 'PerformanceAnalytics'
## The following object is masked from 'package:graphics':
## 
##     legend
chart.Correlation(RI_a, histogram=TRUE, pch=19)

Rural Two-lane

R2_a <- R2[,c("Total", "DISTANCE", "AADT", 
              "SURF_WID", "OptSpd", "SpdVarr1", "SpdVarr2", "SpdVarr3",     
              "SpdVarr4", "SpdAvg", "SpdFF")]

R2_b <- subset(R2_a, OptSpd < 100)

library("PerformanceAnalytics")
chart.Correlation(R2_b, histogram=TRUE, pch=19)

Rural Multilane Divided

RMD_a <- RMD[,c("Total", "DISTANCE", "AADT", "NO_LANES", "MEDWID", 
              "SURF_WID", "OptSpd", "SpdVarr1", "SpdVarr2", "SpdVarr3",     
              "SpdVarr4", "SpdAvg", "SpdFF")]

library("PerformanceAnalytics")
chart.Correlation(RMD_a, histogram=TRUE, pch=19)

Rural Multilane Undivided

RMU_a <- RMU[,c("Total", "DISTANCE", "AADT", "NO_LANES", 
              "SURF_WID", "OptSpd", "SpdVarr1", "SpdVarr2", "SpdVarr3",     
              "SpdVarr4", "SpdAvg", "SpdFF")]

library("PerformanceAnalytics")
chart.Correlation(RMU_a, histogram=TRUE, pch=19)