library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(data.table)
##
## Attaching package: 'data.table'
##
## The following objects are masked from 'package:lubridate':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
##
## The following objects are masked from 'package:dplyr':
##
## between, first, last
##
## The following object is masked from 'package:purrr':
##
## transpose
library(pastecs)
##
## Attaching package: 'pastecs'
##
## The following objects are masked from 'package:data.table':
##
## first, last
##
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## The following object is masked from 'package:tidyr':
##
## extract
PCI_Test<-read_excel("PCI_Test.xlsx")
Using the database of ArcGIS maps and their attribute tables, I have cross-referenced the map of Pavement Condition Index (PCI) scores with the Infrastructure Management Program (IMP) projects to create a filtered dataset displaying streets that were NOT scheduled for a maintenance project.
Projects=PCI_Test
stat.desc(Projects$PCI)
## nbr.val nbr.null nbr.na min max range
## 2.734000e+03 6.500000e+01 0.000000e+00 0.000000e+00 9.949000e+01 9.949000e+01
## sum median mean SE.mean CI.mean.0.95 var
## 1.549055e+05 5.668500e+01 5.665892e+01 4.993701e-01 9.791810e-01 6.817788e+02
## std.dev coef.var
## 2.611089e+01 4.608435e-01
According to this, median and mean PCI for the “left-out” projects is relatively-low at 56.68 and 56.65, respectively, meaning the median and mean values would receive a “D” rating from A to F in the grading system.
hist(Projects$PCI)
ks.test(Projects$PCI,pnorm)
## Warning in ks.test.default(Projects$PCI, pnorm): ties should not be present for
## the one-sample Kolmogorov-Smirnov test
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: Projects$PCI
## D = 0.97416, p-value < 2.2e-16
## alternative hypothesis: two-sided
The previous histogram did not give a clear enough picture for me to understand yet, so I will break it down in more detail.
hist(Projects$PCI,breaks=50)
hist(Projects$PCI,breaks=50,probability = T)
lines(density(Projects$PCI),col="red",lwd=3)
I will use the log function to see its effect.
LogPCI=log(Projects$PCI)
hist(LogPCI,breaks=50,probability = T)
lines(density(LogPCI),col="red",lwd=3)
ks.test(LogPCI,pnorm)
## Warning in ks.test.default(LogPCI, pnorm): ties should not be present for the
## one-sample Kolmogorov-Smirnov test
##
## Asymptotic one-sample Kolmogorov-Smirnov test
##
## data: LogPCI
## D = 0.94673, p-value < 2.2e-16
## alternative hypothesis: two-sided
shapiro.test(Projects$PCI)
##
## Shapiro-Wilk normality test
##
## data: Projects$PCI
## W = 0.96697, p-value < 2.2e-16
shapiro.test(LogPCI)
##
## Shapiro-Wilk normality test
##
## data: LogPCI
## W = NaN, p-value = NA