1. Load your chosen dataset into Rmarkdown
pavements<-read.csv("pavements_3192083553624189959.csv")
  1. Select the dependent variable you are interested in, along with independent variables which you believe are causing the dependent variable

Dependent variable is Pavement Condition Index (PCI). This is the numerical rating of the street surface condition from 0, non-existent, to 100, pristine.

The independent variables are RoadFunction, OneWay, and MaintenanceResponsibility. The road function is the classification of the roadway based on the amount of traffic anticipated.The Oneway is a yes/no response of the roadway being one way or two way traffic. The maintenance responsibility is who is designated to perform routine maintenance on that particular road segment.

  1. create a linear model using the “lm()” command, save it to some object
pavements_model<-lm(PCI~RoadFunction+OneWay+MaintenanceResponsibility,data=pavements)
  1. call a “summary()” on your new model
summary(pavements_model)
## 
## Call:
## lm(formula = PCI ~ RoadFunction + OneWay + MaintenanceResponsibility, 
##     data = pavements)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -87.671   0.000   1.719   6.903  62.054 
## 
## Coefficients:
##                                                          Estimate Std. Error
## (Intercept)                                              52.18637   10.21218
## RoadFunctionAccess Road                                  36.54569   10.18998
## RoadFunctionAlley                                        22.79735   10.19052
## RoadFunctionCollector                                    31.95531   10.18575
## RoadFunctionInterstate                                   35.95471   10.19574
## RoadFunctionLocal                                        30.93012   10.18161
## RoadFunctionMinor                                        30.70638   10.18419
## RoadFunctionOther Freeway and Expressway                 37.25830   10.29283
## RoadFunctionPaper Street                                  3.86661   11.07698
## RoadFunctionPedestrian                                   20.15588   12.46888
## RoadFunctionPrincipal                                    32.62333   10.18670
## RoadFunctionROW                                          33.92146   10.37668
## RoadFunctionTBD                                          32.46676   10.18807
## OneWayYes                                                -3.12969    0.39527
## MaintenanceResponsibilityBalcones Heights               -22.95215    2.03948
## MaintenanceResponsibilityBexar County                     0.89217    0.80595
## MaintenanceResponsibilityBrooks City Base               -49.12254    1.58042
## MaintenanceResponsibilityBulverde                         3.36818    3.76189
## MaintenanceResponsibilityCamp Bullis                      2.80666    1.38544
## MaintenanceResponsibilityCamp Stanley                     3.88448    1.40796
## MaintenanceResponsibilityCastle Hills                     3.66431    1.40957
## MaintenanceResponsibilityChina Grove                      3.88350    2.66504
## MaintenanceResponsibilityCibolo                           3.88350   10.21126
## MaintenanceResponsibilityComal County                     4.68776    1.68221
## MaintenanceResponsibilityConverse                        -0.09519    0.96811
## MaintenanceResponsibilityCOSA - Public Works Dept        -9.59330    0.79370
## MaintenanceResponsibilityElmendorf                        3.88350    1.61014
## MaintenanceResponsibilityFair Oaks Ranch                  3.88350    1.22494
## MaintenanceResponsibilityFt Sam Houston                   3.52975    1.00056
## MaintenanceResponsibilityGarden Ridge                     3.88350   12.49370
## MaintenanceResponsibilityGrey Forest                      3.88350    2.61598
## MaintenanceResponsibilityHelotes                          3.69077    1.29645
## MaintenanceResponsibilityHill Country Village             3.75900    2.27977
## MaintenanceResponsibilityHollywood Park                   3.22575    1.58378
## MaintenanceResponsibilityKendall County                   3.88350   17.65107
## MaintenanceResponsibilityKirby                           -2.27378    1.28428
## MaintenanceResponsibilityLackland AFB                     3.61436    1.13779
## MaintenanceResponsibilityLackland AFB Annex               3.88350    1.66850
## MaintenanceResponsibilityLeon Valley                      3.02312    1.13983
## MaintenanceResponsibilityLive Oak                         2.32454    1.04487
## MaintenanceResponsibilityLytle                            3.88350   12.49370
## MaintenanceResponsibilityOlmos Park                      -6.20231    1.55935
## MaintenanceResponsibilityPort Authority of San Antonio  -50.03728    1.25338
## MaintenanceResponsibilityPrivate                          0.02984    0.86756
## MaintenanceResponsibilityPrivate - Gated Community        2.16433    0.81421
## MaintenanceResponsibilityProperty Owners                 11.44261    0.97289
## MaintenanceResponsibilityRandolph AFB                     3.87135    1.13913
## MaintenanceResponsibilitySandy Oaks                       3.88350    1.48424
## MaintenanceResponsibilitySchertz                          3.02452    1.65517
## MaintenanceResponsibilitySelma                            3.86344    1.30503
## MaintenanceResponsibilityShavano Park                     2.61344    1.64665
## MaintenanceResponsibilitySomerset                         3.93392    1.67753
## MaintenanceResponsibilitySt. Hedwig                       3.88350    2.20998
## MaintenanceResponsibilityTBD                              2.34687    1.08111
## MaintenanceResponsibilityTerrell Hills                    3.91628    1.33088
## MaintenanceResponsibilityTXDOT                           -1.79265    0.85314
## MaintenanceResponsibilityTXDOT_COSA - Public Works Dept -22.42373   17.65726
## MaintenanceResponsibilityUniversal City                   3.65770    1.04443
## MaintenanceResponsibilityVon Ormy                         3.88350    3.21580
## MaintenanceResponsibilityWindcrest                       -0.67112    1.19526
##                                                         t value Pr(>|t|)    
## (Intercept)                                               5.110 3.22e-07 ***
## RoadFunctionAccess Road                                   3.586 0.000335 ***
## RoadFunctionAlley                                         2.237 0.025281 *  
## RoadFunctionCollector                                     3.137 0.001706 ** 
## RoadFunctionInterstate                                    3.526 0.000421 ***
## RoadFunctionLocal                                         3.038 0.002383 ** 
## RoadFunctionMinor                                         3.015 0.002570 ** 
## RoadFunctionOther Freeway and Expressway                  3.620 0.000295 ***
## RoadFunctionPaper Street                                  0.349 0.727039    
## RoadFunctionPedestrian                                    1.616 0.105991    
## RoadFunctionPrincipal                                     3.203 0.001363 ** 
## RoadFunctionROW                                           3.269 0.001080 ** 
## RoadFunctionTBD                                           3.187 0.001439 ** 
## OneWayYes                                                -7.918 2.44e-15 ***
## MaintenanceResponsibilityBalcones Heights               -11.254  < 2e-16 ***
## MaintenanceResponsibilityBexar County                     1.107 0.268308    
## MaintenanceResponsibilityBrooks City Base               -31.082  < 2e-16 ***
## MaintenanceResponsibilityBulverde                         0.895 0.370606    
## MaintenanceResponsibilityCamp Bullis                      2.026 0.042785 *  
## MaintenanceResponsibilityCamp Stanley                     2.759 0.005800 ** 
## MaintenanceResponsibilityCastle Hills                     2.600 0.009335 ** 
## MaintenanceResponsibilityChina Grove                      1.457 0.145064    
## MaintenanceResponsibilityCibolo                           0.380 0.703712    
## MaintenanceResponsibilityComal County                     2.787 0.005326 ** 
## MaintenanceResponsibilityConverse                        -0.098 0.921670    
## MaintenanceResponsibilityCOSA - Public Works Dept       -12.087  < 2e-16 ***
## MaintenanceResponsibilityElmendorf                        2.412 0.015871 *  
## MaintenanceResponsibilityFair Oaks Ranch                  3.170 0.001523 ** 
## MaintenanceResponsibilityFt Sam Houston                   3.528 0.000419 ***
## MaintenanceResponsibilityGarden Ridge                     0.311 0.755925    
## MaintenanceResponsibilityGrey Forest                      1.485 0.137671    
## MaintenanceResponsibilityHelotes                          2.847 0.004417 ** 
## MaintenanceResponsibilityHill Country Village             1.649 0.099181 .  
## MaintenanceResponsibilityHollywood Park                   2.037 0.041678 *  
## MaintenanceResponsibilityKendall County                   0.220 0.825860    
## MaintenanceResponsibilityKirby                           -1.770 0.076651 .  
## MaintenanceResponsibilityLackland AFB                     3.177 0.001490 ** 
## MaintenanceResponsibilityLackland AFB Annex               2.328 0.019938 *  
## MaintenanceResponsibilityLeon Valley                      2.652 0.007997 ** 
## MaintenanceResponsibilityLive Oak                         2.225 0.026102 *  
## MaintenanceResponsibilityLytle                            0.311 0.755925    
## MaintenanceResponsibilityOlmos Park                      -3.977 6.97e-05 ***
## MaintenanceResponsibilityPort Authority of San Antonio  -39.922  < 2e-16 ***
## MaintenanceResponsibilityPrivate                          0.034 0.972558    
## MaintenanceResponsibilityPrivate - Gated Community        2.658 0.007858 ** 
## MaintenanceResponsibilityProperty Owners                 11.762  < 2e-16 ***
## MaintenanceResponsibilityRandolph AFB                     3.399 0.000678 ***
## MaintenanceResponsibilitySandy Oaks                       2.616 0.008885 ** 
## MaintenanceResponsibilitySchertz                          1.827 0.067656 .  
## MaintenanceResponsibilitySelma                            2.960 0.003073 ** 
## MaintenanceResponsibilityShavano Park                     1.587 0.112487    
## MaintenanceResponsibilitySomerset                         2.345 0.019026 *  
## MaintenanceResponsibilitySt. Hedwig                       1.757 0.078877 .  
## MaintenanceResponsibilityTBD                              2.171 0.029949 *  
## MaintenanceResponsibilityTerrell Hills                    2.943 0.003255 ** 
## MaintenanceResponsibilityTXDOT                           -2.101 0.035623 *  
## MaintenanceResponsibilityTXDOT_COSA - Public Works Dept  -1.270 0.204108    
## MaintenanceResponsibilityUniversal City                   3.502 0.000462 ***
## MaintenanceResponsibilityVon Ormy                         1.208 0.227191    
## MaintenanceResponsibilityWindcrest                       -0.561 0.574472    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 17.63 on 97912 degrees of freedom
## Multiple R-squared:  0.1324, Adjusted R-squared:  0.1319 
## F-statistic: 253.2 on 59 and 97912 DF,  p-value: < 2.2e-16
  1. interpret the model’s r-squared and p-values. How much of the dependent variable does the overall model explain? What are the significant variables? What are the insignificant variables?

The r-square of the model is 13%. That means the model only explains 13% of the relationship between the PCI and other variables in the data. The p-value is really small, 0.00000000000000022 (thats 15 0) so the model is significant and the data is not likely by chance. This means something in the relationship is causing the results. Evaluating the variables would allow for the researcher to identify the cause.

  1. Choose some significant independent variables. Interpret its Estimates (or Beta Coefficients). How do the independent variables individually affect the dependent variable?

Focusing in on the Maintenance Responsibility variable, there are many entities that have a significant impact on the dependent variable, PCI. Some of the greater one area Balcones Heights, Brooks City Base, COSA Public Works, Port Authority, and Property Owners. Being in the know of public works, COSA is assisting both the Port and Brooks with street bond projects in their area. Additionally, COSA has an initiative to improve the PCI in all 10 council districts to a PCI of 70 or great. This would support the idea that the maintenance responsibility plays a significant role in PCI.

  1. Does the model you create meet or violate the assumption of linearity? Show your work with “plot(x,which=1)” THis model violates the linearity assumption. The plot shows the red line to not be straight. This is the residual vs fitted line. The model will be inaccurate.
plot(pavements_model, which=1)