Este proyecto se origina en una empresa con sede en Carolina del Norte, Estados Unidos, especializada en la gestión de reclamaciones de compensación laboral en nombre de diversos clientes (cuyos nombres y ubicaciones se mantienen confidenciales).
La empresa busca asesoramiento para emplear el análisis de datos e identificar los principales factores que influyen en los costos de las reclamaciones y los tiempos de procesamiento. Su objetivo es mejorar la eficiencia y la capacidad de respuesta hacia los reclamantes.
En el contexto de la compensación laboral, cuando un trabajador resulta herido en su labor, puede presentar un reclamo que cubre gastos médicos y pérdida de salario. Se crean identificadores únicos para estos reclamos, y se registran detalles que se actualizan a medida que se realizan los pagos.
Este proyecto se enfoca en brindar orientación sobre cómo aprovechar el análisis de datos para lograr estos objetivos de manera efectiva. Se lleva a cabo un filtrado específico de los datos, seleccionando únicamente aquellos registros donde se indica “BodyPartRegion: Neck”.
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
archivo1 <- read.csv("C:\\Users\\Deisy Lopez\\Documents\\7. Séptimo Semestre Ago-Dic 2023\\RStudio_AN\\4.6_ClaimsData2018.csv")
archivo2 <- read.csv("C:\\Users\\Deisy Lopez\\Documents\\7. Séptimo Semestre Ago-Dic 2023\\RStudio_AN\\4.6_TransactionsSummary2018.csv")
datos <- merge(archivo1, archivo2, by = "ClaimID", all=TRUE)## ClaimID TotalPaid TotalReserves TotalRecovery
## Min. : 777630 Min. : -270.3 Min. : 0 Min. : 0.0
## 1st Qu.: 816894 1st Qu.: 60.0 1st Qu.: 0 1st Qu.: 0.0
## Median : 853872 Median : 290.1 Median : 0 Median : 0.0
## Mean :15597643 Mean : 8841.4 Mean : 4345 Mean : 112.1
## 3rd Qu.:30222507 3rd Qu.: 1501.6 3rd Qu.: 0 3rd Qu.: 0.0
## Max. :62203888 Max. :919505.0 Max. :945450 Max. :21175.3
##
## IndemnityPaid OtherPaid ClaimStatus IncidentDate
## Min. : 0 Min. : -270.3 Length:4349 Length:4349
## 1st Qu.: 0 1st Qu.: 59.2 Class :character Class :character
## Median : 0 Median : 284.8 Mode :character Mode :character
## Mean : 3815 Mean : 5026.3
## 3rd Qu.: 0 3rd Qu.: 1376.5
## Max. :457207 Max. :498117.1
##
## IncidentDescription ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## Length:4349 Length:4349 Length:4349 Length:4349
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## ClaimantClosedDate EmployerNotificationDate ReceivedDate
## Length:4349 Length:4349 Length:4349
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
## IsDenied ClaimantAge_at_DOI Gender ClaimantType
## Min. :0.00000 Length:4349 Length:4349 Length:4349
## 1st Qu.:0.00000 Class :character Class :character Class :character
## Median :0.00000 Mode :character Mode :character Mode :character
## Mean :0.05266
## 3rd Qu.:0.00000
## Max. :1.00000
##
## InjuryNature BodyPartRegion BodyPart BillReviewALE
## Length:4349 Length:4349 Length:4349 Min. : 0.0
## Class :character Class :character Class :character 1st Qu.: 8.2
## Mode :character Mode :character Mode :character Median : 24.0
## Mean : 146.1
## 3rd Qu.: 56.0
## Max. :9226.0
## NA's :3670
## Hospital PhysicianOutpatient Rx
## Min. : 0.0 Min. : 0.0 Min. : 0.00
## 1st Qu.: 188.2 1st Qu.: 99.9 1st Qu.: 22.56
## Median : 509.2 Median : 216.4 Median : 56.10
## Mean : 3495.3 Mean : 1487.1 Mean : 1177.84
## 3rd Qu.: 1810.7 3rd Qu.: 686.0 3rd Qu.: 192.42
## Max. :282989.3 Max. :90551.6 Max. :100876.56
## NA's :3762 NA's :2926 NA's :3836
df$IncidentDate <- as.Date(df$IncidentDate, format = "%m/%d/%Y")
df$ReturnToWorkDate <- as.Date(df$ReturnToWorkDate, format = "%m/%d/%Y")
df$ClaimantOpenedDate <- as.Date(df$ClaimantOpenedDate, format = "%m/%d/%Y")
df$ClaimantClosedDate <- as.Date(df$ClaimantClosedDate, format = "%m/%d/%Y")
df$EmployerNotificationDate <- as.Date(df$EmployerNotificationDate, format = "%m/%d/%Y")
df$ReceivedDate <- as.Date(df$ReceivedDate, format = "%m/%d/%Y")
df$AverageWeeklyWage <- as.numeric(df$AverageWeeklyWage)## Warning: NAs introducidos por coerción
## Warning: NAs introducidos por coerción
## ClaimID TotalPaid TotalReserves TotalRecovery
## Min. : 777630 Min. : -270.3 Min. : 0 Min. : 0.0
## 1st Qu.: 816894 1st Qu.: 60.0 1st Qu.: 0 1st Qu.: 0.0
## Median : 853872 Median : 290.1 Median : 0 Median : 0.0
## Mean :15597643 Mean : 8841.4 Mean : 4345 Mean : 112.1
## 3rd Qu.:30222507 3rd Qu.: 1501.6 3rd Qu.: 0 3rd Qu.: 0.0
## Max. :62203888 Max. :919505.0 Max. :945450 Max. :21175.3
##
## IndemnityPaid OtherPaid ClaimStatus IncidentDate
## Min. : 0 Min. : -270.3 Length:4349 Min. :1983-02-11
## 1st Qu.: 0 1st Qu.: 59.2 Class :character 1st Qu.:2003-03-05
## Median : 0 Median : 284.8 Mode :character Median :2008-06-04
## Mean : 3815 Mean : 5026.3 Mean :2007-07-16
## 3rd Qu.: 0 3rd Qu.: 1376.5 3rd Qu.:2012-08-21
## Max. :457207 Max. :498117.1 Max. :2014-06-25
##
## IncidentDescription ReturnToWorkDate AverageWeeklyWage
## Length:4349 Min. :1990-04-16 Min. : 0.01
## Class :character 1st Qu.:2006-06-19 1st Qu.: 255.00
## Mode :character Median :2010-12-29 Median : 502.00
## Mean :2009-02-15 Mean : 598.37
## 3rd Qu.:2013-01-17 3rd Qu.: 713.00
## Max. :2014-06-30 Max. :102896.00
## NA's :1240 NA's :2166
## ClaimantOpenedDate ClaimantClosedDate EmployerNotificationDate
## Min. :1991-03-04 Min. :2000-07-10 Min. :1983-02-11
## 1st Qu.:2003-04-24 1st Qu.:2005-03-31 1st Qu.:2003-04-04
## Median :2008-07-31 Median :2009-02-24 Median :2008-07-18
## Mean :2007-08-27 Mean :2009-04-14 Mean :2007-08-16
## 3rd Qu.:2012-09-04 3rd Qu.:2012-10-16 3rd Qu.:2012-09-10
## Max. :2014-06-30 Max. :2014-06-30 Max. :2014-06-26
## NA's :482 NA's :122
## ReceivedDate IsDenied ClaimantAge_at_DOI Gender
## Min. :1991-03-04 Min. :0.00000 Min. :-7162.00 Length:4349
## 1st Qu.:2003-04-22 1st Qu.:0.00000 1st Qu.: 34.00 Class :character
## Median :2008-06-24 Median :0.00000 Median : 43.00 Mode :character
## Mean :2007-08-21 Mean :0.05266 Mean : 38.88
## 3rd Qu.:2012-09-04 3rd Qu.:0.00000 3rd Qu.: 51.00
## Max. :2014-06-30 Max. :1.00000 Max. : 85.00
## NA's :794
## ClaimantType InjuryNature BodyPartRegion BodyPart
## Length:4349 Length:4349 Length:4349 Length:4349
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## BillReviewALE Hospital PhysicianOutpatient Rx
## Min. : 0.0 Min. : 0.0 Min. : 0.0 Min. : 0.00
## 1st Qu.: 8.2 1st Qu.: 188.2 1st Qu.: 99.9 1st Qu.: 22.56
## Median : 24.0 Median : 509.2 Median : 216.4 Median : 56.10
## Mean : 146.1 Mean : 3495.3 Mean : 1487.1 Mean : 1177.84
## 3rd Qu.: 56.0 3rd Qu.: 1810.7 3rd Qu.: 686.0 3rd Qu.: 192.42
## Max. :9226.0 Max. :282989.3 Max. :90551.6 Max. :100876.56
## NA's :3670 NA's :3762 NA's :2926 NA's :3836
## ClaimID TotalPaid TotalReserves
## 0 0 0
## TotalRecovery IndemnityPaid OtherPaid
## 0 0 0
## ClaimStatus IncidentDate IncidentDescription
## 0 0 0
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## 1240 2166 0
## ClaimantClosedDate EmployerNotificationDate ReceivedDate
## 482 122 0
## IsDenied ClaimantAge_at_DOI Gender
## 0 794 0
## ClaimantType InjuryNature BodyPartRegion
## 0 0 0
## BodyPart BillReviewALE Hospital
## 0 3670 3762
## PhysicianOutpatient Rx
## 2926 3836
df <- df[complete.cases(df[, c("TotalReserves", "TotalPaid", "TotalRecovery", "ClaimantClosedDate", "ClaimantOpenedDate")]), ]
sapply(df, function(x) sum(is.na(x)))## ClaimID TotalPaid TotalReserves
## 0 0 0
## TotalRecovery IndemnityPaid OtherPaid
## 0 0 0
## ClaimStatus IncidentDate IncidentDescription
## 0 0 0
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## 1115 2058 0
## ClaimantClosedDate EmployerNotificationDate ReceivedDate
## 0 116 0
## IsDenied ClaimantAge_at_DOI Gender
## 0 793 0
## ClaimantType InjuryNature BodyPartRegion
## 0 0 0
## BodyPart BillReviewALE Hospital
## 0 3198 3295
## PhysicianOutpatient Rx
## 2482 3363
df$Total_Incurred_Cost <- df$TotalReserves+df$TotalPaid-df$TotalRecovery
df <- df[df$Total_Incurred_Cost >= 0, ]
df$Processing_Time <- difftime(df$ClaimantClosedDate,df$ClaimantOpenedDate,units = "days")
df$Processing_Time <- as.numeric(df$Processing_Time)
# Reconocer valores atípicos (outliers)
boxplot(df$Total_Incurred_Cost, horizontal = TRUE)## ClaimID TotalPaid TotalReserves TotalRecovery
## Min. : 777630 Min. : 0.0 Min. :0 Min. : 0.0
## 1st Qu.: 813288 1st Qu.: 44.2 1st Qu.:0 1st Qu.: 0.0
## Median : 843003 Median : 244.6 Median :0 Median : 0.0
## Mean :12783421 Mean : 3996.3 Mean :0 Mean : 111.2
## 3rd Qu.:29384157 3rd Qu.: 967.6 3rd Qu.:0 3rd Qu.: 0.0
## Max. :62032670 Max. :393552.7 Max. :0 Max. :21175.3
##
## IndemnityPaid OtherPaid ClaimStatus IncidentDate
## Min. : 0 Min. : 0.00 Length:3853 Min. :1990-03-30
## 1st Qu.: 0 1st Qu.: 40.52 Class :character 1st Qu.:2002-06-12
## Median : 0 Median : 238.38 Mode :character Median :2007-09-19
## Mean : 1792 Mean : 2204.50 Mean :2006-12-16
## 3rd Qu.: 0 3rd Qu.: 913.68 3rd Qu.:2012-04-09
## Max. :301444 Max. :204734.97 Max. :2014-06-23
##
## IncidentDescription ReturnToWorkDate AverageWeeklyWage
## Length:3853 Min. :1990-04-16 Min. : 0.01
## Class :character 1st Qu.:2005-12-16 1st Qu.: 76.16
## Mode :character Median :2009-09-12 Median : 500.00
## Mean :2008-08-24 Mean : 592.86
## 3rd Qu.:2012-10-01 3rd Qu.: 705.04
## Max. :2014-06-23 Max. :102896.00
## NA's :1111 NA's :2056
## ClaimantOpenedDate ClaimantClosedDate EmployerNotificationDate
## Min. :1991-03-04 Min. :2000-07-10 Min. :1990-03-30
## 1st Qu.:2002-07-15 1st Qu.:2005-03-31 1st Qu.:2002-06-12
## Median :2007-10-19 Median :2009-02-24 Median :2007-10-20
## Mean :2007-01-23 Mean :2009-04-17 Mean :2007-01-10
## 3rd Qu.:2012-04-24 3rd Qu.:2012-10-19 3rd Qu.:2012-05-01
## Max. :2014-06-24 Max. :2014-06-30 Max. :2014-06-23
## NA's :116
## ReceivedDate IsDenied ClaimantAge_at_DOI Gender
## Min. :1991-03-04 Min. :0.00000 Min. :-7162.0 Length:3853
## 1st Qu.:2002-07-17 1st Qu.:0.00000 1st Qu.: 33.0 Class :character
## Median :2007-10-11 Median :0.00000 Median : 43.0 Mode :character
## Mean :2007-01-21 Mean :0.05502 Mean : 37.8
## 3rd Qu.:2012-04-24 3rd Qu.:0.00000 3rd Qu.: 51.0
## Max. :2014-06-24 Max. :1.00000 Max. : 85.0
## NA's :785
## ClaimantType InjuryNature BodyPartRegion BodyPart
## Length:3853 Length:3853 Length:3853 Length:3853
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## BillReviewALE Hospital PhysicianOutpatient Rx
## Min. : 0.0 Min. : 0.0 Min. : 0.0 Min. : 0.00
## 1st Qu.: 8.2 1st Qu.: 188.7 1st Qu.: 100.0 1st Qu.: 22.56
## Median : 24.0 Median : 504.3 Median : 217.6 Median : 55.60
## Mean : 134.6 Mean : 3319.4 Mean : 1436.6 Mean : 1035.65
## 3rd Qu.: 56.0 3rd Qu.: 1805.8 3rd Qu.: 687.5 3rd Qu.: 193.65
## Max. :9226.0 Max. :282989.3 Max. :90551.6 Max. :100876.56
## NA's :3187 NA's :3284 NA's :2477 NA's :3352
## Total_Incurred_Cost Processing_Time
## Min. : 0.0 Min. : 0.0
## 1st Qu.: 17.5 1st Qu.: 98.0
## Median : 217.4 Median : 278.0
## Mean : 3885.0 Mean : 815.3
## 3rd Qu.: 849.2 3rd Qu.:1400.0
## Max. :388552.7 Max. :7516.0
##
Observaciones:
1. La variable “ClaimantAge_at_DOI” tiene números negativos.
2. La variable “TotalReserves” no es relevante porque contiene
únicamente 0.
3. Hay presencia de datos fuera de lo normal (outliers).
# Eliminar negativos en la variable ClaimantAge_at_DOI
df <- df[df$ClaimantAge_at_DOI >= 0, ]
# Eliminar variable TotalReserves
df <- df[, !names(df) %in% "TotalReserves"]
# Eliminar datos atípicos
df <- df[df$Total_Incurred_Cost <= 10000, ]
df<- df[df$Processing_Time <= 2000, ]Observaciones:
1. No se realiza una eliminación de datos atípicos tan exhaustiva pues
se eliminarían muchas observaciones.
## ClaimID TotalPaid TotalRecovery IndemnityPaid
## Min. : 779710 Min. : 0.00 Min. : 0.00 Min. : 0.00
## 1st Qu.: 820250 1st Qu.: 51.16 1st Qu.: 0.00 1st Qu.: 0.00
## Median : 8307538 Median : 249.34 Median : 0.00 Median : 0.00
## Mean :16745391 Mean : 848.09 Mean : 66.24 Mean : 78.65
## 3rd Qu.:31330636 3rd Qu.: 863.62 3rd Qu.: 0.00 3rd Qu.: 0.00
## Max. :62032670 Max. :12682.98 Max. :8017.28 Max. :6700.00
## NA's :785 NA's :785 NA's :785 NA's :785
## OtherPaid ClaimStatus IncidentDate IncidentDescription
## Min. : 0.00 Length:3527 Min. :1998-07-21 Length:3527
## 1st Qu.: 43.78 Class :character 1st Qu.:2006-05-03 Class :character
## Median : 245.01 Mode :character Median :2009-08-12 Mode :character
## Mean : 769.43 Mean :2009-04-14
## 3rd Qu.: 825.61 3rd Qu.:2012-09-21
## Max. :12682.98 Max. :2014-06-16
## NA's :785 NA's :785
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## Min. :1998-12-10 Min. : 0.02 Min. :1999-02-09
## 1st Qu.:2007-10-12 1st Qu.: 40.00 1st Qu.:2006-05-25
## Median :2011-08-29 Median : 500.00 Median :2009-09-08
## Mean :2010-04-08 Mean : 617.82 Mean :2009-05-11
## 3rd Qu.:2012-12-11 3rd Qu.: 713.86 3rd Qu.:2012-10-09
## Max. :2014-06-17 Max. :102896.00 Max. :2014-06-24
## NA's :1329 NA's :2195 NA's :785
## ClaimantClosedDate EmployerNotificationDate ReceivedDate
## Min. :2000-07-10 Min. :1998-07-21 Min. :1999-02-09
## 1st Qu.:2008-01-31 1st Qu.:2006-06-27 1st Qu.:2006-05-27
## Median :2010-05-26 Median :2009-12-16 Median :2009-09-08
## Mean :2010-05-04 Mean :2009-06-12 Mean :2009-05-11
## 3rd Qu.:2013-03-11 3rd Qu.:2012-10-11 3rd Qu.:2012-10-09
## Max. :2014-06-30 Max. :2014-06-17 Max. :2014-06-24
## NA's :785 NA's :887 NA's :785
## IsDenied ClaimantAge_at_DOI Gender ClaimantType
## Min. :0.0000 Min. : 1.0 Length:3527 Length:3527
## 1st Qu.:0.0000 1st Qu.:33.0 Class :character Class :character
## Median :0.0000 Median :43.0 Mode :character Mode :character
## Mean :0.0609 Mean :42.3
## 3rd Qu.:0.0000 3rd Qu.:51.0
## Max. :1.0000 Max. :85.0
## NA's :785 NA's :785
## InjuryNature BodyPartRegion BodyPart BillReviewALE
## Length:3527 Length:3527 Length:3527 Min. : 8.0
## Class :character Class :character Class :character 1st Qu.: 8.2
## Mode :character Mode :character Mode :character Median : 24.0
## Mean : 149.4
## 3rd Qu.: 56.0
## Max. :9226.0
## NA's :3071
## Hospital PhysicianOutpatient Rx Total_Incurred_Cost
## Min. : 0.0 Min. : 0.0 Min. : 0.00 Min. : 0.00
## 1st Qu.: 188.6 1st Qu.: 102.0 1st Qu.: 22.18 1st Qu.: 24.45
## Median : 570.2 Median : 209.4 Median : 53.69 Median : 225.76
## Mean : 3574.4 Mean : 1479.3 Mean : 1370.01 Mean : 781.84
## 3rd Qu.: 1825.5 3rd Qu.: 605.2 3rd Qu.: 190.25 3rd Qu.: 747.38
## Max. :282989.3 Max. :90551.6 Max. :100876.56 Max. :9992.38
## NA's :3172 NA's :2667 NA's :3213 NA's :785
## Processing_Time
## Min. : 0.0
## 1st Qu.: 80.0
## Median : 146.0
## Mean : 358.7
## 3rd Qu.: 443.5
## Max. :1999.0
## NA's :785
## ClaimStatus n
## 1 C 2742
## 2 <NA> 785
## Gender n
## 1 Female 1375
## 2 Male 1347
## 3 <NA> 785
## 4 Not Available 20
## ClaimantType n
## 1 Medical Only 2088
## 2 <NA> 785
## 3 Indemnity 452
## 4 Report Only 202
## InjuryNature n
## 1 Strain 1386
## 2 <NA> 785
## 3 Contusion 424
## 4 Sprain 195
## 5 Laceration 180
## 6 All Other Specific Injuries, Noc 72
## 7 Puncture 71
## 8 Dermatitis 61
## 9 Multiple Physical Injuries Only 60
## 10 Burn 45
## 11 No Physical Injury 42
## 12 Foreign Body 41
## 13 Non-Standard Code 37
## 14 Inflammation 33
## 15 Respiratory Disorders 19
## 16 Concussion 12
## 17 Infection 12
## 18 Not Available 11
## 19 Asbestosis 5
## 20 Fracture 5
## 21 Poisoning?Chemical (Other Than Metals) 5
## 22 All Other Cumulative Injury, NOC 4
## 23 Contagious Disease 4
## 24 Radiation 3
## 25 Asphyxiation 2
## 26 Dislocation 2
## 27 Mental Stress 2
## 28 AIDS 1
## 29 All Other Occupational Disease Injury, NOC 1
## 30 Angina Pectoris 1
## 31 Cancer 1
## 32 Electric Shock 1
## 33 Freezing 1
## 34 Heat Prostration 1
## 35 Multiple Injuries Including Both Physical and Psychological 1
## 36 Poisoning?General (NOT OD or Cumulative Injury) 1
## BodyPartRegion n
## 1 Neck 2742
## 2 <NA> 785
## BodyPart n
## 1 Soft Tissue-Neck 1743
## 2 Multiple Neck Injury 961
## 3 <NA> 785
## 4 Vertebrae 16
## 5 Larynx 11
## 6 Trachea 11
## ClaimID TotalPaid TotalRecovery
## 785 785 785
## IndemnityPaid OtherPaid ClaimStatus
## 785 785 785
## IncidentDate IncidentDescription ReturnToWorkDate
## 785 785 1329
## AverageWeeklyWage ClaimantOpenedDate ClaimantClosedDate
## 2195 785 785
## EmployerNotificationDate ReceivedDate IsDenied
## 887 785 785
## ClaimantAge_at_DOI Gender ClaimantType
## 785 785 785
## InjuryNature BodyPartRegion BodyPart
## 785 785 785
## BillReviewALE Hospital PhysicianOutpatient
## 3071 3172 2667
## Rx Total_Incurred_Cost Processing_Time
## 3213 785 785
Observaciones:
1. Todas las variables contienen NA´s, pero representan un gran
porcentaje de los datos, por lo que no pueden ser borrados
completamente.
2. Hay cierta presencia de datos fuera de lo normal (outliers).
df1_tabla <- subset(df1, select = c("ClaimID", "Total_Incurred_Cost", "Processing_Time"))
#df1_tabla
sapply(df1_tabla, function(x) sum (is.na(x)))## ClaimID Total_Incurred_Cost Processing_Time
## 785 785 785
df1_tabla <- na.omit(df1_tabla)
rownames(df1_tabla) <- df1_tabla$ClaimID
df1_tabla <- subset(df1_tabla, select = -c(ClaimID))## Total_Incurred_Cost Processing_Time
## Min. : 0.00 Min. : 0.0
## 1st Qu.: 24.45 1st Qu.: 80.0
## Median : 225.76 Median : 146.0
## Mean : 781.84 Mean : 358.7
## 3rd Qu.: 747.38 3rd Qu.: 443.5
## Max. :9992.38 Max. :1999.0
## [1] 722.9275
## [1] -1059.941
## [1] 1831.771
df1_tabla <- df1_tabla[df1_tabla$Total_Incurred_Cost <= 1831.771, ]
# Columna de Processing_Time
IQR_PT <- IQR(df1_tabla$Processing_Time)
IQR_PT## [1] 327
## [1] -410.5
## [1] 934
## Total_Incurred_Cost Processing_Time
## Min. : 0.0 Min. : 0.0
## 1st Qu.: 0.0 1st Qu.: 68.0
## Median : 169.9 Median :111.0
## Mean : 325.2 Mean :186.8
## 3rd Qu.: 426.4 3rd Qu.:216.0
## Max. :1826.8 Max. :932.0
# 1. Crear base de datos
df1_base <- df1_tabla
# 2. Determinar número de grupos
grupos <- 5
# 3. Realizar la clasificación
segmentos <- kmeans(df1_base,grupos)
#segmentos
# 4. Revisar la asignación de grupos
asignación <- cbind(df1_base, cluster=segmentos$cluster)
#asignación
# 5. Graficar resultados
library(ggplot2)
library(factoextra)## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
fviz_cluster(segmentos, data = df1_base, palette = c("red","blue","green","yellow","black"), ellipse.type = "euclid", star.plot = T, repel = T, ggtheme = theme())##
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
##
## between, first, last
set.seed(123)
optimización <- clusGap(df1_base, FUN = kmeans, nstart = 1, K.max = 10)
plot(optimización, xlab = "Número de clusters K")Interpretación:
La cantidad de grupos óptimos son 5 grupos.
## ClaimID TotalPaid TotalRecovery IndemnityPaid
## Min. : 779710 Min. : 0.00 Min. : 0.00 Min. : 0.00
## 1st Qu.: 820250 1st Qu.: 51.16 1st Qu.: 0.00 1st Qu.: 0.00
## Median : 8307538 Median : 249.34 Median : 0.00 Median : 0.00
## Mean :16745391 Mean : 848.09 Mean : 66.24 Mean : 78.65
## 3rd Qu.:31330636 3rd Qu.: 863.62 3rd Qu.: 0.00 3rd Qu.: 0.00
## Max. :62032670 Max. :12682.98 Max. :8017.28 Max. :6700.00
## NA's :785 NA's :785 NA's :785 NA's :785
## OtherPaid ClaimStatus IncidentDate IncidentDescription
## Min. : 0.00 Length:3527 Min. :1998-07-21 Length:3527
## 1st Qu.: 43.78 Class :character 1st Qu.:2006-05-03 Class :character
## Median : 245.01 Mode :character Median :2009-08-12 Mode :character
## Mean : 769.43 Mean :2009-04-14
## 3rd Qu.: 825.61 3rd Qu.:2012-09-21
## Max. :12682.98 Max. :2014-06-16
## NA's :785 NA's :785
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## Min. :1998-12-10 Min. : 0.02 Min. :1999-02-09
## 1st Qu.:2007-10-12 1st Qu.: 40.00 1st Qu.:2006-05-25
## Median :2011-08-29 Median : 500.00 Median :2009-09-08
## Mean :2010-04-08 Mean : 617.82 Mean :2009-05-11
## 3rd Qu.:2012-12-11 3rd Qu.: 713.86 3rd Qu.:2012-10-09
## Max. :2014-06-17 Max. :102896.00 Max. :2014-06-24
## NA's :1329 NA's :2195 NA's :785
## ClaimantClosedDate EmployerNotificationDate ReceivedDate
## Min. :2000-07-10 Min. :1998-07-21 Min. :1999-02-09
## 1st Qu.:2008-01-31 1st Qu.:2006-06-27 1st Qu.:2006-05-27
## Median :2010-05-26 Median :2009-12-16 Median :2009-09-08
## Mean :2010-05-04 Mean :2009-06-12 Mean :2009-05-11
## 3rd Qu.:2013-03-11 3rd Qu.:2012-10-11 3rd Qu.:2012-10-09
## Max. :2014-06-30 Max. :2014-06-17 Max. :2014-06-24
## NA's :785 NA's :887 NA's :785
## IsDenied ClaimantAge_at_DOI Gender ClaimantType
## Min. :0.0000 Min. : 1.0 Length:3527 Length:3527
## 1st Qu.:0.0000 1st Qu.:33.0 Class :character Class :character
## Median :0.0000 Median :43.0 Mode :character Mode :character
## Mean :0.0609 Mean :42.3
## 3rd Qu.:0.0000 3rd Qu.:51.0
## Max. :1.0000 Max. :85.0
## NA's :785 NA's :785
## InjuryNature BodyPartRegion BodyPart BillReviewALE
## Length:3527 Length:3527 Length:3527 Min. : 8.0
## Class :character Class :character Class :character 1st Qu.: 8.2
## Mode :character Mode :character Mode :character Median : 24.0
## Mean : 149.4
## 3rd Qu.: 56.0
## Max. :9226.0
## NA's :3071
## Hospital PhysicianOutpatient Rx Total_Incurred_Cost
## Min. : 0.0 Min. : 0.0 Min. : 0.00 Min. : 0.00
## 1st Qu.: 188.6 1st Qu.: 102.0 1st Qu.: 22.18 1st Qu.: 24.45
## Median : 570.2 Median : 209.4 Median : 53.69 Median : 225.76
## Mean : 3574.4 Mean : 1479.3 Mean : 1370.01 Mean : 781.84
## 3rd Qu.: 1825.5 3rd Qu.: 605.2 3rd Qu.: 190.25 3rd Qu.: 747.38
## Max. :282989.3 Max. :90551.6 Max. :100876.56 Max. :9992.38
## NA's :3172 NA's :2667 NA's :3213 NA's :785
## Processing_Time
## Min. : 0.0
## 1st Qu.: 80.0
## Median : 146.0
## Mean : 358.7
## 3rd Qu.: 443.5
## Max. :1999.0
## NA's :785
## ClaimStatus n
## 1 C 2742
## 2 <NA> 785
## Gender n
## 1 Female 1375
## 2 Male 1347
## 3 <NA> 785
## 4 Not Available 20
## ClaimantType n
## 1 Medical Only 2088
## 2 <NA> 785
## 3 Indemnity 452
## 4 Report Only 202
## InjuryNature n
## 1 Strain 1386
## 2 <NA> 785
## 3 Contusion 424
## 4 Sprain 195
## 5 Laceration 180
## 6 All Other Specific Injuries, Noc 72
## 7 Puncture 71
## 8 Dermatitis 61
## 9 Multiple Physical Injuries Only 60
## 10 Burn 45
## 11 No Physical Injury 42
## 12 Foreign Body 41
## 13 Non-Standard Code 37
## 14 Inflammation 33
## 15 Respiratory Disorders 19
## 16 Concussion 12
## 17 Infection 12
## 18 Not Available 11
## 19 Asbestosis 5
## 20 Fracture 5
## 21 Poisoning?Chemical (Other Than Metals) 5
## 22 All Other Cumulative Injury, NOC 4
## 23 Contagious Disease 4
## 24 Radiation 3
## 25 Asphyxiation 2
## 26 Dislocation 2
## 27 Mental Stress 2
## 28 AIDS 1
## 29 All Other Occupational Disease Injury, NOC 1
## 30 Angina Pectoris 1
## 31 Cancer 1
## 32 Electric Shock 1
## 33 Freezing 1
## 34 Heat Prostration 1
## 35 Multiple Injuries Including Both Physical and Psychological 1
## 36 Poisoning?General (NOT OD or Cumulative Injury) 1
## BodyPartRegion n
## 1 Neck 2742
## 2 <NA> 785
## BodyPart n
## 1 Soft Tissue-Neck 1743
## 2 Multiple Neck Injury 961
## 3 <NA> 785
## 4 Vertebrae 16
## 5 Larynx 11
## 6 Trachea 11
## ClaimID TotalPaid TotalRecovery
## 785 785 785
## IndemnityPaid OtherPaid ClaimStatus
## 785 785 785
## IncidentDate IncidentDescription ReturnToWorkDate
## 785 785 1329
## AverageWeeklyWage ClaimantOpenedDate ClaimantClosedDate
## 2195 785 785
## EmployerNotificationDate ReceivedDate IsDenied
## 887 785 785
## ClaimantAge_at_DOI Gender ClaimantType
## 785 785 785
## InjuryNature BodyPartRegion BodyPart
## 785 785 785
## BillReviewALE Hospital PhysicianOutpatient
## 3071 3172 2667
## Rx Total_Incurred_Cost Processing_Time
## 3213 785 785
Observaciones:
1. Todas las variables contienen NA´s, pero representan un gran
porcentaje de los datos, por lo que no pueden ser borrados
completamente.
# Variables de interés Total_Incurred_Cost
df2_TIC <- df2[, c("Gender", "ClaimantAge_at_DOI", "AverageWeeklyWage", "ClaimantType", "Total_Incurred_Cost")]
df2_TIC$Gender <- as.factor(df2_TIC$Gender)
df2_TIC$ClaimantType <- as.factor(df2_TIC$ClaimantType)
df2_TIC <- na.omit(df2_TIC)
str(df2_TIC)## 'data.frame': 1332 obs. of 5 variables:
## $ Gender : Factor w/ 3 levels "Female","Male",..: 2 1 2 2 1 1 1 2 2 1 ...
## $ ClaimantAge_at_DOI : num 35 36 48 41 42 24 27 52 40 46 ...
## $ AverageWeeklyWage : num 637 1 1 1 426 ...
## $ ClaimantType : Factor w/ 3 levels "Indemnity","Medical Only",..: 1 1 2 2 1 1 1 2 1 1 ...
## $ Total_Incurred_Cost: num 1046.4 43.4 1534.1 0 162.1 ...
## - attr(*, "na.action")= 'omit' Named int [1:2195] 1 2 3 4 5 6 7 8 9 10 ...
## ..- attr(*, "names")= chr [1:2195] "NA" "NA.1" "NA.2" "NA.3" ...
# Variables de interés Processing_Time
df2_PT <- df2[, c("Gender", "ClaimantAge_at_DOI", "AverageWeeklyWage", "ClaimantType", "Processing_Time")]
df2_PT$Gender <- as.factor(df2_PT$Gender)
df2_PT$ClaimantType <- as.factor(df2_PT$ClaimantType)
df2_PT <- na.omit(df2_PT)
str(df2_PT)## 'data.frame': 1332 obs. of 5 variables:
## $ Gender : Factor w/ 3 levels "Female","Male",..: 2 1 2 2 1 1 1 2 2 1 ...
## $ ClaimantAge_at_DOI: num 35 36 48 41 42 24 27 52 40 46 ...
## $ AverageWeeklyWage : num 637 1 1 1 426 ...
## $ ClaimantType : Factor w/ 3 levels "Indemnity","Medical Only",..: 1 1 2 2 1 1 1 2 1 1 ...
## $ Processing_Time : num 1961 1823 1855 1836 1786 ...
## - attr(*, "na.action")= 'omit' Named int [1:2195] 1 2 3 4 5 6 7 8 9 10 ...
## ..- attr(*, "names")= chr [1:2195] "NA" "NA.1" "NA.2" "NA.3" ...
library(rpart)
library(rpart.plot)
# Árbol Total_Incurred_Cost
arbol <- rpart(formula = Total_Incurred_Cost ~ ., data = df2_TIC)
arbol## n= 1332
##
## node), split, n, deviance, yval
## * denotes terminal node
##
## 1) root 1332 4371442000 1125.4440
## 2) ClaimantType=Medical Only,Report Only 910 1070765000 597.4389 *
## 3) ClaimantType=Indemnity 422 2499903000 2264.0340
## 6) AverageWeeklyWage< 7.5 71 208866900 1403.9420 *
## 7) AverageWeeklyWage>=7.5 351 2227889000 2438.0130 *
## n= 1332
##
## node), split, n, deviance, yval
## * denotes terminal node
##
## 1) root 1332 162376900 271.2853
## 2) ClaimantType=Medical Only,Report Only 910 59107120 199.8648 *
## 3) ClaimantType=Indemnity 422 88618430 425.2962
## 6) AverageWeeklyWage>=20 350 63201870 398.9486
## 12) AverageWeeklyWage< 346.205 72 7717565 283.0694 *
## 13) AverageWeeklyWage>=346.205 278 54267090 428.9604
## 26) AverageWeeklyWage>=427.27 258 43672320 396.7868 *
## 27) AverageWeeklyWage< 427.27 20 6882550 844.0000 *
## 7) AverageWeeklyWage< 20 72 23992490 553.3750 *
Interpretación:
Árbol Total_Incurred_Cost
Un 26% de los datos caen en la condición de un costo alto, y mucho
tiempo.
Árbol Processing_Time
Un 5% de los datos caen en la condición de un costo alto, y mucho
tiempo.
## ClaimID TotalPaid TotalRecovery IndemnityPaid
## Min. : 779710 Min. : 0.00 Min. : 0.00 Min. : 0.00
## 1st Qu.: 820250 1st Qu.: 51.16 1st Qu.: 0.00 1st Qu.: 0.00
## Median : 8307538 Median : 249.34 Median : 0.00 Median : 0.00
## Mean :16745391 Mean : 848.09 Mean : 66.24 Mean : 78.65
## 3rd Qu.:31330636 3rd Qu.: 863.62 3rd Qu.: 0.00 3rd Qu.: 0.00
## Max. :62032670 Max. :12682.98 Max. :8017.28 Max. :6700.00
## NA's :785 NA's :785 NA's :785 NA's :785
## OtherPaid ClaimStatus IncidentDate IncidentDescription
## Min. : 0.00 Length:3527 Min. :1998-07-21 Length:3527
## 1st Qu.: 43.78 Class :character 1st Qu.:2006-05-03 Class :character
## Median : 245.01 Mode :character Median :2009-08-12 Mode :character
## Mean : 769.43 Mean :2009-04-14
## 3rd Qu.: 825.61 3rd Qu.:2012-09-21
## Max. :12682.98 Max. :2014-06-16
## NA's :785 NA's :785
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## Min. :1998-12-10 Min. : 0.02 Min. :1999-02-09
## 1st Qu.:2007-10-12 1st Qu.: 40.00 1st Qu.:2006-05-25
## Median :2011-08-29 Median : 500.00 Median :2009-09-08
## Mean :2010-04-08 Mean : 617.82 Mean :2009-05-11
## 3rd Qu.:2012-12-11 3rd Qu.: 713.86 3rd Qu.:2012-10-09
## Max. :2014-06-17 Max. :102896.00 Max. :2014-06-24
## NA's :1329 NA's :2195 NA's :785
## ClaimantClosedDate EmployerNotificationDate ReceivedDate
## Min. :2000-07-10 Min. :1998-07-21 Min. :1999-02-09
## 1st Qu.:2008-01-31 1st Qu.:2006-06-27 1st Qu.:2006-05-27
## Median :2010-05-26 Median :2009-12-16 Median :2009-09-08
## Mean :2010-05-04 Mean :2009-06-12 Mean :2009-05-11
## 3rd Qu.:2013-03-11 3rd Qu.:2012-10-11 3rd Qu.:2012-10-09
## Max. :2014-06-30 Max. :2014-06-17 Max. :2014-06-24
## NA's :785 NA's :887 NA's :785
## IsDenied ClaimantAge_at_DOI Gender ClaimantType
## Min. :0.0000 Min. : 1.0 Length:3527 Length:3527
## 1st Qu.:0.0000 1st Qu.:33.0 Class :character Class :character
## Median :0.0000 Median :43.0 Mode :character Mode :character
## Mean :0.0609 Mean :42.3
## 3rd Qu.:0.0000 3rd Qu.:51.0
## Max. :1.0000 Max. :85.0
## NA's :785 NA's :785
## InjuryNature BodyPartRegion BodyPart BillReviewALE
## Length:3527 Length:3527 Length:3527 Min. : 8.0
## Class :character Class :character Class :character 1st Qu.: 8.2
## Mode :character Mode :character Mode :character Median : 24.0
## Mean : 149.4
## 3rd Qu.: 56.0
## Max. :9226.0
## NA's :3071
## Hospital PhysicianOutpatient Rx Total_Incurred_Cost
## Min. : 0.0 Min. : 0.0 Min. : 0.00 Min. : 0.00
## 1st Qu.: 188.6 1st Qu.: 102.0 1st Qu.: 22.18 1st Qu.: 24.45
## Median : 570.2 Median : 209.4 Median : 53.69 Median : 225.76
## Mean : 3574.4 Mean : 1479.3 Mean : 1370.01 Mean : 781.84
## 3rd Qu.: 1825.5 3rd Qu.: 605.2 3rd Qu.: 190.25 3rd Qu.: 747.38
## Max. :282989.3 Max. :90551.6 Max. :100876.56 Max. :9992.38
## NA's :3172 NA's :2667 NA's :3213 NA's :785
## Processing_Time
## Min. : 0.0
## 1st Qu.: 80.0
## Median : 146.0
## Mean : 358.7
## 3rd Qu.: 443.5
## Max. :1999.0
## NA's :785
## ClaimStatus n
## 1 C 2742
## 2 <NA> 785
## Gender n
## 1 Female 1375
## 2 Male 1347
## 3 <NA> 785
## 4 Not Available 20
## ClaimantType n
## 1 Medical Only 2088
## 2 <NA> 785
## 3 Indemnity 452
## 4 Report Only 202
## InjuryNature n
## 1 Strain 1386
## 2 <NA> 785
## 3 Contusion 424
## 4 Sprain 195
## 5 Laceration 180
## 6 All Other Specific Injuries, Noc 72
## 7 Puncture 71
## 8 Dermatitis 61
## 9 Multiple Physical Injuries Only 60
## 10 Burn 45
## 11 No Physical Injury 42
## 12 Foreign Body 41
## 13 Non-Standard Code 37
## 14 Inflammation 33
## 15 Respiratory Disorders 19
## 16 Concussion 12
## 17 Infection 12
## 18 Not Available 11
## 19 Asbestosis 5
## 20 Fracture 5
## 21 Poisoning?Chemical (Other Than Metals) 5
## 22 All Other Cumulative Injury, NOC 4
## 23 Contagious Disease 4
## 24 Radiation 3
## 25 Asphyxiation 2
## 26 Dislocation 2
## 27 Mental Stress 2
## 28 AIDS 1
## 29 All Other Occupational Disease Injury, NOC 1
## 30 Angina Pectoris 1
## 31 Cancer 1
## 32 Electric Shock 1
## 33 Freezing 1
## 34 Heat Prostration 1
## 35 Multiple Injuries Including Both Physical and Psychological 1
## 36 Poisoning?General (NOT OD or Cumulative Injury) 1
## BodyPartRegion n
## 1 Neck 2742
## 2 <NA> 785
## BodyPart n
## 1 Soft Tissue-Neck 1743
## 2 Multiple Neck Injury 961
## 3 <NA> 785
## 4 Vertebrae 16
## 5 Larynx 11
## 6 Trachea 11
## ClaimID TotalPaid TotalRecovery
## 785 785 785
## IndemnityPaid OtherPaid ClaimStatus
## 785 785 785
## IncidentDate IncidentDescription ReturnToWorkDate
## 785 785 1329
## AverageWeeklyWage ClaimantOpenedDate ClaimantClosedDate
## 2195 785 785
## EmployerNotificationDate ReceivedDate IsDenied
## 887 785 785
## ClaimantAge_at_DOI Gender ClaimantType
## 785 785 785
## InjuryNature BodyPartRegion BodyPart
## 785 785 785
## BillReviewALE Hospital PhysicianOutpatient
## 3071 3172 2667
## Rx Total_Incurred_Cost Processing_Time
## 3213 785 785
Observaciones:
1. Todas las variables contienen NA´s, pero representan un gran
porcentaje de los datos, por lo que no pueden ser borrados
completamente.
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:data.table':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
asignar_estacion <- function(fecha) {
if (is.na(fecha)) {
return(NA)
}
mes <- month(fecha)
if (mes %in% c(12, 1, 2)) {
return("Invierno")
} else if (mes %in% c(3, 4, 5)) {
return("Primavera")
} else if (mes %in% c(6, 7, 8)) {
return("Verano")
} else {
return("Otoño")
}
}
df3$Season <- sapply(df3$ClaimantOpenedDate, asignar_estacion)## ClaimID TotalPaid TotalRecovery
## 785 785 785
## IndemnityPaid OtherPaid ClaimStatus
## 785 785 785
## IncidentDate IncidentDescription ReturnToWorkDate
## 785 785 1329
## AverageWeeklyWage ClaimantOpenedDate ClaimantClosedDate
## 2195 785 785
## EmployerNotificationDate ReceivedDate IsDenied
## 887 785 785
## ClaimantAge_at_DOI Gender ClaimantType
## 785 785 785
## InjuryNature BodyPartRegion BodyPart
## 785 785 785
## BillReviewALE Hospital PhysicianOutpatient
## 3071 3172 2667
## Rx Total_Incurred_Cost Processing_Time
## 3213 785 785
## Season
## 785
df3 <- df3[complete.cases(df3[, c("Total_Incurred_Cost", "Processing_Time", "Gender", "Season", "ClaimantAge_at_DOI","AverageWeeklyWage", "ClaimantType", "InjuryNature", "TotalPaid", "IndemnityPaid", "OtherPaid")]), ]
sapply(df3, function(x) sum (is.na(x)))## ClaimID TotalPaid TotalRecovery
## 0 0 0
## IndemnityPaid OtherPaid ClaimStatus
## 0 0 0
## IncidentDate IncidentDescription ReturnToWorkDate
## 0 0 131
## AverageWeeklyWage ClaimantOpenedDate ClaimantClosedDate
## 0 0 0
## EmployerNotificationDate ReceivedDate IsDenied
## 3 0 0
## ClaimantAge_at_DOI Gender ClaimantType
## 0 0 0
## InjuryNature BodyPartRegion BodyPart
## 0 0 0
## BillReviewALE Hospital PhysicianOutpatient
## 1182 1177 945
## Rx Total_Incurred_Cost Processing_Time
## 1193 0 0
## Season
## 0
#Regresión Total_Incurred_Cost
regresion_TIC <- lm(Total_Incurred_Cost ~ Gender + Season + ClaimantAge_at_DOI + AverageWeeklyWage + ClaimantType + InjuryNature, data = df3)
summary(regresion_TIC)##
## Call:
## lm(formula = Total_Incurred_Cost ~ Gender + Season + ClaimantAge_at_DOI +
## AverageWeeklyWage + ClaimantType + InjuryNature, data = df3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3476.6 -708.1 -346.2 340.0 9044.6
##
## Coefficients:
## Estimate
## (Intercept) -2.901e+01
## GenderMale -7.650e+01
## GenderNot Available 8.482e+02
## SeasonOtoño 7.249e+01
## SeasonPrimavera -7.455e+01
## SeasonVerano 1.589e+02
## ClaimantAge_at_DOI 5.287e+00
## AverageWeeklyWage -4.965e-03
## ClaimantTypeMedical Only -1.605e+03
## ClaimantTypeReport Only -2.250e+03
## InjuryNatureAll Other Specific Injuries, Noc 2.090e+03
## InjuryNatureAngina Pectoris 1.919e+03
## InjuryNatureAsbestosis 1.545e+03
## InjuryNatureAsphyxiation 1.224e+03
## InjuryNatureBurn 1.782e+03
## InjuryNatureConcussion 2.302e+03
## InjuryNatureContagious Disease 1.601e+03
## InjuryNatureContusion 2.242e+03
## InjuryNatureDermatitis 1.510e+03
## InjuryNatureForeign Body 1.420e+03
## InjuryNatureFracture 6.341e+03
## InjuryNatureHeat Prostration 5.553e+03
## InjuryNatureInfection 6.969e+02
## InjuryNatureInflammation 1.908e+03
## InjuryNatureLaceration 2.317e+03
## InjuryNatureMental Stress 5.965e+02
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 5.333e+03
## InjuryNatureMultiple Physical Injuries Only 1.903e+03
## InjuryNatureNo Physical Injury 1.467e+03
## InjuryNatureNon-Standard Code 1.173e+03
## InjuryNatureNot Available 2.077e+03
## InjuryNaturePoisoning?Chemical (Other Than Metals) 1.489e+03
## InjuryNaturePuncture 2.501e+03
## InjuryNatureRadiation 1.278e+03
## InjuryNatureRespiratory Disorders 2.290e+03
## InjuryNatureSprain 1.871e+03
## InjuryNatureStrain 2.047e+03
## Std. Error
## (Intercept) 1.159e+03
## GenderMale 9.052e+01
## GenderNot Available 4.411e+02
## SeasonOtoño 1.319e+02
## SeasonPrimavera 1.275e+02
## SeasonVerano 1.317e+02
## ClaimantAge_at_DOI 3.791e+00
## AverageWeeklyWage 1.256e-02
## ClaimantTypeMedical Only 9.852e+01
## ClaimantTypeReport Only 2.566e+02
## InjuryNatureAll Other Specific Injuries, Noc 1.191e+03
## InjuryNatureAngina Pectoris 1.998e+03
## InjuryNatureAsbestosis 1.360e+03
## InjuryNatureAsphyxiation 1.980e+03
## InjuryNatureBurn 1.231e+03
## InjuryNatureConcussion 1.354e+03
## InjuryNatureContagious Disease 1.622e+03
## InjuryNatureContusion 1.152e+03
## InjuryNatureDermatitis 1.185e+03
## InjuryNatureForeign Body 1.239e+03
## InjuryNatureFracture 1.476e+03
## InjuryNatureHeat Prostration 1.980e+03
## InjuryNatureInfection 1.319e+03
## InjuryNatureInflammation 1.197e+03
## InjuryNatureLaceration 1.164e+03
## InjuryNatureMental Stress 1.619e+03
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 1.981e+03
## InjuryNatureMultiple Physical Injuries Only 1.177e+03
## InjuryNatureNo Physical Injury 1.205e+03
## InjuryNatureNon-Standard Code 1.281e+03
## InjuryNatureNot Available 1.417e+03
## InjuryNaturePoisoning?Chemical (Other Than Metals) 1.985e+03
## InjuryNaturePuncture 1.210e+03
## InjuryNatureRadiation 1.980e+03
## InjuryNatureRespiratory Disorders 1.254e+03
## InjuryNatureSprain 1.156e+03
## InjuryNatureStrain 1.147e+03
## t value
## (Intercept) -0.025
## GenderMale -0.845
## GenderNot Available 1.923
## SeasonOtoño 0.550
## SeasonPrimavera -0.585
## SeasonVerano 1.206
## ClaimantAge_at_DOI 1.394
## AverageWeeklyWage -0.395
## ClaimantTypeMedical Only -16.296
## ClaimantTypeReport Only -8.768
## InjuryNatureAll Other Specific Injuries, Noc 1.755
## InjuryNatureAngina Pectoris 0.960
## InjuryNatureAsbestosis 1.135
## InjuryNatureAsphyxiation 0.618
## InjuryNatureBurn 1.447
## InjuryNatureConcussion 1.700
## InjuryNatureContagious Disease 0.987
## InjuryNatureContusion 1.946
## InjuryNatureDermatitis 1.274
## InjuryNatureForeign Body 1.145
## InjuryNatureFracture 4.296
## InjuryNatureHeat Prostration 2.804
## InjuryNatureInfection 0.528
## InjuryNatureInflammation 1.594
## InjuryNatureLaceration 1.990
## InjuryNatureMental Stress 0.368
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 2.692
## InjuryNatureMultiple Physical Injuries Only 1.617
## InjuryNatureNo Physical Injury 1.217
## InjuryNatureNon-Standard Code 0.916
## InjuryNatureNot Available 1.466
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.751
## InjuryNaturePuncture 2.066
## InjuryNatureRadiation 0.645
## InjuryNatureRespiratory Disorders 1.826
## InjuryNatureSprain 1.619
## InjuryNatureStrain 1.784
## Pr(>|t|)
## (Intercept) 0.98003
## GenderMale 0.39823
## GenderNot Available 0.05471
## SeasonOtoño 0.58270
## SeasonPrimavera 0.55882
## SeasonVerano 0.22814
## ClaimantAge_at_DOI 0.16343
## AverageWeeklyWage 0.69264
## ClaimantTypeMedical Only < 2e-16
## ClaimantTypeReport Only < 2e-16
## InjuryNatureAll Other Specific Injuries, Noc 0.07957
## InjuryNatureAngina Pectoris 0.33706
## InjuryNatureAsbestosis 0.25641
## InjuryNatureAsphyxiation 0.53650
## InjuryNatureBurn 0.14806
## InjuryNatureConcussion 0.08931
## InjuryNatureContagious Disease 0.32392
## InjuryNatureContusion 0.05191
## InjuryNatureDermatitis 0.20286
## InjuryNatureForeign Body 0.25224
## InjuryNatureFracture 1.87e-05
## InjuryNatureHeat Prostration 0.00512
## InjuryNatureInfection 0.59735
## InjuryNatureInflammation 0.11109
## InjuryNatureLaceration 0.04683
## InjuryNatureMental Stress 0.71260
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.00720
## InjuryNatureMultiple Physical Injuries Only 0.10618
## InjuryNatureNo Physical Injury 0.22371
## InjuryNatureNon-Standard Code 0.35969
## InjuryNatureNot Available 0.14280
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.45307
## InjuryNaturePuncture 0.03900
## InjuryNatureRadiation 0.51879
## InjuryNatureRespiratory Disorders 0.06811
## InjuryNatureSprain 0.10568
## InjuryNatureStrain 0.07461
##
## (Intercept)
## GenderMale
## GenderNot Available .
## SeasonOtoño
## SeasonPrimavera
## SeasonVerano
## ClaimantAge_at_DOI
## AverageWeeklyWage
## ClaimantTypeMedical Only ***
## ClaimantTypeReport Only ***
## InjuryNatureAll Other Specific Injuries, Noc .
## InjuryNatureAngina Pectoris
## InjuryNatureAsbestosis
## InjuryNatureAsphyxiation
## InjuryNatureBurn
## InjuryNatureConcussion .
## InjuryNatureContagious Disease
## InjuryNatureContusion .
## InjuryNatureDermatitis
## InjuryNatureForeign Body
## InjuryNatureFracture ***
## InjuryNatureHeat Prostration **
## InjuryNatureInfection
## InjuryNatureInflammation
## InjuryNatureLaceration *
## InjuryNatureMental Stress
## InjuryNatureMultiple Injuries Including Both Physical and Psychological **
## InjuryNatureMultiple Physical Injuries Only
## InjuryNatureNo Physical Injury
## InjuryNatureNon-Standard Code
## InjuryNatureNot Available
## InjuryNaturePoisoning?Chemical (Other Than Metals)
## InjuryNaturePuncture *
## InjuryNatureRadiation
## InjuryNatureRespiratory Disorders .
## InjuryNatureSprain
## InjuryNatureStrain .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1614 on 1295 degrees of freedom
## Multiple R-squared: 0.2284, Adjusted R-squared: 0.2069
## F-statistic: 10.65 on 36 and 1295 DF, p-value: < 2.2e-16
#Regresión Processing_Time
df3$OtherPaid <- as.integer(df3$OtherPaid)
regresion_PT <- lm(Processing_Time ~ Gender + Season + ClaimantAge_at_DOI + AverageWeeklyWage + ClaimantType + InjuryNature + TotalPaid + IndemnityPaid + OtherPaid, data = df3)
summary(regresion_PT)##
## Call:
## lm(formula = Processing_Time ~ Gender + Season + ClaimantAge_at_DOI +
## AverageWeeklyWage + ClaimantType + InjuryNature + TotalPaid +
## IndemnityPaid + OtherPaid, data = df3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -594.91 -152.81 -74.23 27.67 1693.43
##
## Coefficients:
## Estimate
## (Intercept) 1.446e+02
## GenderMale 1.114e+01
## GenderNot Available 1.449e+02
## SeasonOtoño -1.362e+00
## SeasonPrimavera 7.675e+00
## SeasonVerano -1.690e+01
## ClaimantAge_at_DOI -1.622e+00
## AverageWeeklyWage 2.534e-03
## ClaimantTypeMedical Only -1.556e+02
## ClaimantTypeReport Only -2.560e+02
## InjuryNatureAll Other Specific Injuries, Noc 2.964e+02
## InjuryNatureAngina Pectoris 2.001e+02
## InjuryNatureAsbestosis 1.667e+02
## InjuryNatureAsphyxiation 1.826e+02
## InjuryNatureBurn 3.230e+02
## InjuryNatureConcussion 3.831e+02
## InjuryNatureContagious Disease 1.649e+02
## InjuryNatureContusion 2.865e+02
## InjuryNatureDermatitis 1.984e+02
## InjuryNatureForeign Body 2.134e+02
## InjuryNatureFracture 1.488e+01
## InjuryNatureHeat Prostration 4.224e+02
## InjuryNatureInfection 2.497e+02
## InjuryNatureInflammation 2.878e+02
## InjuryNatureLaceration 2.850e+02
## InjuryNatureMental Stress 2.162e+02
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 4.427e+01
## InjuryNatureMultiple Physical Injuries Only 1.674e+02
## InjuryNatureNo Physical Injury 1.645e+02
## InjuryNatureNon-Standard Code 1.734e+02
## InjuryNatureNot Available 1.720e+02
## InjuryNaturePoisoning?Chemical (Other Than Metals) 1.355e+02
## InjuryNaturePuncture 2.873e+02
## InjuryNatureRadiation 1.580e+02
## InjuryNatureRespiratory Disorders 4.895e+02
## InjuryNatureSprain 2.157e+02
## InjuryNatureStrain 2.463e+02
## TotalPaid -6.312e+00
## IndemnityPaid 6.307e+00
## OtherPaid 6.362e+00
## Std. Error
## (Intercept) 2.323e+02
## GenderMale 1.816e+01
## GenderNot Available 8.865e+01
## SeasonOtoño 2.649e+01
## SeasonPrimavera 2.557e+01
## SeasonVerano 2.644e+01
## ClaimantAge_at_DOI 7.604e-01
## AverageWeeklyWage 2.518e-03
## ClaimantTypeMedical Only 2.229e+01
## ClaimantTypeReport Only 5.401e+01
## InjuryNatureAll Other Specific Injuries, Noc 2.392e+02
## InjuryNatureAngina Pectoris 4.009e+02
## InjuryNatureAsbestosis 2.729e+02
## InjuryNatureAsphyxiation 3.971e+02
## InjuryNatureBurn 2.473e+02
## InjuryNatureConcussion 2.718e+02
## InjuryNatureContagious Disease 3.254e+02
## InjuryNatureContusion 2.315e+02
## InjuryNatureDermatitis 2.379e+02
## InjuryNatureForeign Body 2.488e+02
## InjuryNatureFracture 2.982e+02
## InjuryNatureHeat Prostration 3.986e+02
## InjuryNatureInfection 2.646e+02
## InjuryNatureInflammation 2.404e+02
## InjuryNatureLaceration 2.340e+02
## InjuryNatureMental Stress 3.246e+02
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 3.984e+02
## InjuryNatureMultiple Physical Injuries Only 2.364e+02
## InjuryNatureNo Physical Injury 2.421e+02
## InjuryNatureNon-Standard Code 2.569e+02
## InjuryNatureNot Available 2.844e+02
## InjuryNaturePoisoning?Chemical (Other Than Metals) 3.985e+02
## InjuryNaturePuncture 2.432e+02
## InjuryNatureRadiation 3.970e+02
## InjuryNatureRespiratory Disorders 2.518e+02
## InjuryNatureSprain 2.322e+02
## InjuryNatureStrain 2.305e+02
## TotalPaid 2.855e+01
## IndemnityPaid 2.855e+01
## OtherPaid 2.855e+01
## t value
## (Intercept) 0.622
## GenderMale 0.613
## GenderNot Available 1.635
## SeasonOtoño -0.051
## SeasonPrimavera 0.300
## SeasonVerano -0.639
## ClaimantAge_at_DOI -2.133
## AverageWeeklyWage 1.006
## ClaimantTypeMedical Only -6.981
## ClaimantTypeReport Only -4.740
## InjuryNatureAll Other Specific Injuries, Noc 1.239
## InjuryNatureAngina Pectoris 0.499
## InjuryNatureAsbestosis 0.611
## InjuryNatureAsphyxiation 0.460
## InjuryNatureBurn 1.306
## InjuryNatureConcussion 1.410
## InjuryNatureContagious Disease 0.507
## InjuryNatureContusion 1.238
## InjuryNatureDermatitis 0.834
## InjuryNatureForeign Body 0.858
## InjuryNatureFracture 0.050
## InjuryNatureHeat Prostration 1.060
## InjuryNatureInfection 0.944
## InjuryNatureInflammation 1.197
## InjuryNatureLaceration 1.218
## InjuryNatureMental Stress 0.666
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.111
## InjuryNatureMultiple Physical Injuries Only 0.708
## InjuryNatureNo Physical Injury 0.680
## InjuryNatureNon-Standard Code 0.675
## InjuryNatureNot Available 0.605
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.340
## InjuryNaturePuncture 1.181
## InjuryNatureRadiation 0.398
## InjuryNatureRespiratory Disorders 1.944
## InjuryNatureSprain 0.929
## InjuryNatureStrain 1.069
## TotalPaid -0.221
## IndemnityPaid 0.221
## OtherPaid 0.223
## Pr(>|t|)
## (Intercept) 0.5339
## GenderMale 0.5398
## GenderNot Available 0.1023
## SeasonOtoño 0.9590
## SeasonPrimavera 0.7641
## SeasonVerano 0.5229
## ClaimantAge_at_DOI 0.0331
## AverageWeeklyWage 0.3146
## ClaimantTypeMedical Only 4.66e-12
## ClaimantTypeReport Only 2.37e-06
## InjuryNatureAll Other Specific Injuries, Noc 0.2155
## InjuryNatureAngina Pectoris 0.6178
## InjuryNatureAsbestosis 0.5414
## InjuryNatureAsphyxiation 0.6456
## InjuryNatureBurn 0.1917
## InjuryNatureConcussion 0.1589
## InjuryNatureContagious Disease 0.6125
## InjuryNatureContusion 0.2161
## InjuryNatureDermatitis 0.4046
## InjuryNatureForeign Body 0.3911
## InjuryNatureFracture 0.9602
## InjuryNatureHeat Prostration 0.2894
## InjuryNatureInfection 0.3455
## InjuryNatureInflammation 0.2315
## InjuryNatureLaceration 0.2235
## InjuryNatureMental Stress 0.5054
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.9115
## InjuryNatureMultiple Physical Injuries Only 0.4791
## InjuryNatureNo Physical Injury 0.4969
## InjuryNatureNon-Standard Code 0.4997
## InjuryNatureNot Available 0.5455
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.7339
## InjuryNaturePuncture 0.2376
## InjuryNatureRadiation 0.6906
## InjuryNatureRespiratory Disorders 0.0522
## InjuryNatureSprain 0.3531
## InjuryNatureStrain 0.2853
## TotalPaid 0.8250
## IndemnityPaid 0.8252
## OtherPaid 0.8237
##
## (Intercept)
## GenderMale
## GenderNot Available
## SeasonOtoño
## SeasonPrimavera
## SeasonVerano
## ClaimantAge_at_DOI *
## AverageWeeklyWage
## ClaimantTypeMedical Only ***
## ClaimantTypeReport Only ***
## InjuryNatureAll Other Specific Injuries, Noc
## InjuryNatureAngina Pectoris
## InjuryNatureAsbestosis
## InjuryNatureAsphyxiation
## InjuryNatureBurn
## InjuryNatureConcussion
## InjuryNatureContagious Disease
## InjuryNatureContusion
## InjuryNatureDermatitis
## InjuryNatureForeign Body
## InjuryNatureFracture
## InjuryNatureHeat Prostration
## InjuryNatureInfection
## InjuryNatureInflammation
## InjuryNatureLaceration
## InjuryNatureMental Stress
## InjuryNatureMultiple Injuries Including Both Physical and Psychological
## InjuryNatureMultiple Physical Injuries Only
## InjuryNatureNo Physical Injury
## InjuryNatureNon-Standard Code
## InjuryNatureNot Available
## InjuryNaturePoisoning?Chemical (Other Than Metals)
## InjuryNaturePuncture
## InjuryNatureRadiation
## InjuryNatureRespiratory Disorders .
## InjuryNatureSprain
## InjuryNatureStrain
## TotalPaid
## IndemnityPaid
## OtherPaid
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 323.6 on 1292 degrees of freedom
## Multiple R-squared: 0.167, Adjusted R-squared: 0.1418
## F-statistic: 6.641 on 39 and 1292 DF, p-value: < 2.2e-16
#Regresión Total_Incurred_Cost
regresion_TIC <- lm(Total_Incurred_Cost ~ Gender + ClaimantType + InjuryNature, data = df3)
summary(regresion_TIC)##
## Call:
## lm(formula = Total_Incurred_Cost ~ Gender + ClaimantType + InjuryNature,
## data = df3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3476.9 -675.5 -359.1 315.9 9022.2
##
## Coefficients:
## Estimate
## (Intercept) 335.33
## GenderMale -79.50
## GenderNot Available 796.13
## ClaimantTypeMedical Only -1609.00
## ClaimantTypeReport Only -2246.62
## InjuryNatureAll Other Specific Injuries, Noc 1974.70
## InjuryNatureAngina Pectoris 1911.29
## InjuryNatureAsbestosis 1385.31
## InjuryNatureAsphyxiation 1273.67
## InjuryNatureBurn 1643.53
## InjuryNatureConcussion 2205.51
## InjuryNatureContagious Disease 1333.45
## InjuryNatureContusion 2160.83
## InjuryNatureDermatitis 1367.31
## InjuryNatureForeign Body 1351.85
## InjuryNatureFracture 6229.74
## InjuryNatureHeat Prostration 5475.98
## InjuryNatureInfection 681.42
## InjuryNatureInflammation 1799.84
## InjuryNatureLaceration 2206.14
## InjuryNatureMental Stress 469.17
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 5229.25
## InjuryNatureMultiple Physical Injuries Only 1801.42
## InjuryNatureNo Physical Injury 1319.92
## InjuryNatureNon-Standard Code 1075.02
## InjuryNatureNot Available 1921.89
## InjuryNaturePoisoning?Chemical (Other Than Metals) 1403.41
## InjuryNaturePuncture 2433.98
## InjuryNatureRadiation 1273.67
## InjuryNatureRespiratory Disorders 2238.33
## InjuryNatureSprain 1779.31
## InjuryNatureStrain 1949.14
## Std. Error
## (Intercept) 1142.62
## GenderMale 90.40
## GenderNot Available 439.97
## ClaimantTypeMedical Only 98.31
## ClaimantTypeReport Only 255.91
## InjuryNatureAll Other Specific Injuries, Noc 1189.43
## InjuryNatureAngina Pectoris 1994.27
## InjuryNatureAsbestosis 1354.64
## InjuryNatureAsphyxiation 1980.61
## InjuryNatureBurn 1229.74
## InjuryNatureConcussion 1351.50
## InjuryNatureContagious Disease 1618.42
## InjuryNatureContusion 1150.31
## InjuryNatureDermatitis 1182.52
## InjuryNatureForeign Body 1237.59
## InjuryNatureFracture 1474.96
## InjuryNatureHeat Prostration 1980.36
## InjuryNatureInfection 1319.55
## InjuryNatureInflammation 1195.50
## InjuryNatureLaceration 1162.18
## InjuryNatureMental Stress 1616.10
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 1978.04
## InjuryNatureMultiple Physical Injuries Only 1174.07
## InjuryNatureNo Physical Injury 1202.52
## InjuryNatureNon-Standard Code 1278.37
## InjuryNatureNot Available 1412.81
## InjuryNaturePoisoning?Chemical (Other Than Metals) 1980.61
## InjuryNaturePuncture 1209.26
## InjuryNatureRadiation 1980.61
## InjuryNatureRespiratory Disorders 1252.14
## InjuryNatureSprain 1154.00
## InjuryNatureStrain 1144.96
## t value
## (Intercept) 0.293
## GenderMale -0.879
## GenderNot Available 1.810
## ClaimantTypeMedical Only -16.366
## ClaimantTypeReport Only -8.779
## InjuryNatureAll Other Specific Injuries, Noc 1.660
## InjuryNatureAngina Pectoris 0.958
## InjuryNatureAsbestosis 1.023
## InjuryNatureAsphyxiation 0.643
## InjuryNatureBurn 1.336
## InjuryNatureConcussion 1.632
## InjuryNatureContagious Disease 0.824
## InjuryNatureContusion 1.878
## InjuryNatureDermatitis 1.156
## InjuryNatureForeign Body 1.092
## InjuryNatureFracture 4.224
## InjuryNatureHeat Prostration 2.765
## InjuryNatureInfection 0.516
## InjuryNatureInflammation 1.506
## InjuryNatureLaceration 1.898
## InjuryNatureMental Stress 0.290
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 2.644
## InjuryNatureMultiple Physical Injuries Only 1.534
## InjuryNatureNo Physical Injury 1.098
## InjuryNatureNon-Standard Code 0.841
## InjuryNatureNot Available 1.360
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.709
## InjuryNaturePuncture 2.013
## InjuryNatureRadiation 0.643
## InjuryNatureRespiratory Disorders 1.788
## InjuryNatureSprain 1.542
## InjuryNatureStrain 1.702
## Pr(>|t|)
## (Intercept) 0.76921
## GenderMale 0.37930
## GenderNot Available 0.07060
## ClaimantTypeMedical Only < 2e-16
## ClaimantTypeReport Only < 2e-16
## InjuryNatureAll Other Specific Injuries, Noc 0.09711
## InjuryNatureAngina Pectoris 0.33804
## InjuryNatureAsbestosis 0.30667
## InjuryNatureAsphyxiation 0.52029
## InjuryNatureBurn 0.18163
## InjuryNatureConcussion 0.10294
## InjuryNatureContagious Disease 0.41013
## InjuryNatureContusion 0.06054
## InjuryNatureDermatitis 0.24778
## InjuryNatureForeign Body 0.27489
## InjuryNatureFracture 2.57e-05
## InjuryNatureHeat Prostration 0.00577
## InjuryNatureInfection 0.60566
## InjuryNatureInflammation 0.13244
## InjuryNatureLaceration 0.05788
## InjuryNatureMental Stress 0.77162
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.00830
## InjuryNatureMultiple Physical Injuries Only 0.12519
## InjuryNatureNo Physical Injury 0.27257
## InjuryNatureNon-Standard Code 0.40054
## InjuryNatureNot Available 0.17396
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.47871
## InjuryNaturePuncture 0.04434
## InjuryNatureRadiation 0.52029
## InjuryNatureRespiratory Disorders 0.07407
## InjuryNatureSprain 0.12335
## InjuryNatureStrain 0.08893
##
## (Intercept)
## GenderMale
## GenderNot Available .
## ClaimantTypeMedical Only ***
## ClaimantTypeReport Only ***
## InjuryNatureAll Other Specific Injuries, Noc .
## InjuryNatureAngina Pectoris
## InjuryNatureAsbestosis
## InjuryNatureAsphyxiation
## InjuryNatureBurn
## InjuryNatureConcussion
## InjuryNatureContagious Disease
## InjuryNatureContusion .
## InjuryNatureDermatitis
## InjuryNatureForeign Body
## InjuryNatureFracture ***
## InjuryNatureHeat Prostration **
## InjuryNatureInfection
## InjuryNatureInflammation
## InjuryNatureLaceration .
## InjuryNatureMental Stress
## InjuryNatureMultiple Injuries Including Both Physical and Psychological **
## InjuryNatureMultiple Physical Injuries Only
## InjuryNatureNo Physical Injury
## InjuryNatureNon-Standard Code
## InjuryNatureNot Available
## InjuryNaturePoisoning?Chemical (Other Than Metals)
## InjuryNaturePuncture *
## InjuryNatureRadiation
## InjuryNatureRespiratory Disorders .
## InjuryNatureSprain
## InjuryNatureStrain .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1615 on 1300 degrees of freedom
## Multiple R-squared: 0.2247, Adjusted R-squared: 0.2062
## F-statistic: 12.15 on 31 and 1300 DF, p-value: < 2.2e-16
#Regresión Processing_Time
regresion_PT <- lm(Processing_Time ~ ClaimantAge_at_DOI + ClaimantType + InjuryNature, data = df3)
summary(regresion_PT)##
## Call:
## lm(formula = Processing_Time ~ ClaimantAge_at_DOI + ClaimantType +
## InjuryNature, data = df3)
##
## Residuals:
## Min 1Q Median 3Q Max
## -642.30 -159.79 -84.25 31.80 1707.16
##
## Coefficients:
## Estimate
## (Intercept) 143.2542
## ClaimantAge_at_DOI -1.4809
## ClaimantTypeMedical Only -219.8429
## ClaimantTypeReport Only -351.1357
## InjuryNatureAll Other Specific Injuries, Noc 402.1946
## InjuryNatureAngina Pectoris 289.3297
## InjuryNatureAsbestosis 245.3867
## InjuryNatureAsphyxiation 225.6708
## InjuryNatureBurn 401.9689
## InjuryNatureConcussion 499.6907
## InjuryNatureContagious Disease 232.6106
## InjuryNatureContusion 385.5032
## InjuryNatureDermatitis 266.2223
## InjuryNatureForeign Body 290.8771
## InjuryNatureFracture 276.2109
## InjuryNatureHeat Prostration 681.6489
## InjuryNatureInfection 276.3249
## InjuryNatureInflammation 387.2141
## InjuryNatureLaceration 394.0327
## InjuryNatureMental Stress 247.3067
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 311.0574
## InjuryNatureMultiple Physical Injuries Only 276.1516
## InjuryNatureNo Physical Injury 228.8884
## InjuryNatureNon-Standard Code 230.7014
## InjuryNatureNot Available 274.5297
## InjuryNaturePoisoning?Chemical (Other Than Metals) 195.5943
## InjuryNaturePuncture 399.0627
## InjuryNatureRadiation 202.8620
## InjuryNatureRespiratory Disorders 589.9489
## InjuryNatureSprain 310.9865
## InjuryNatureStrain 345.9125
## Std. Error
## (Intercept) 236.8654
## ClaimantAge_at_DOI 0.7779
## ClaimantTypeMedical Only 20.1999
## ClaimantTypeReport Only 52.6370
## InjuryNatureAll Other Specific Injuries, Noc 244.7128
## InjuryNatureAngina Pectoris 410.3902
## InjuryNatureAsbestosis 278.8613
## InjuryNatureAsphyxiation 407.4355
## InjuryNatureBurn 253.0357
## InjuryNatureConcussion 278.0825
## InjuryNatureContagious Disease 333.0298
## InjuryNatureContusion 236.7097
## InjuryNatureDermatitis 243.3127
## InjuryNatureForeign Body 254.5581
## InjuryNatureFracture 303.3598
## InjuryNatureHeat Prostration 407.5927
## InjuryNatureInfection 271.4620
## InjuryNatureInflammation 245.9792
## InjuryNatureLaceration 239.1266
## InjuryNatureMental Stress 332.4017
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 406.8907
## InjuryNatureMultiple Physical Injuries Only 241.5338
## InjuryNatureNo Physical Injury 247.4175
## InjuryNatureNon-Standard Code 263.0649
## InjuryNatureNot Available 290.6571
## InjuryNaturePoisoning?Chemical (Other Than Metals) 407.4965
## InjuryNaturePuncture 248.7585
## InjuryNatureRadiation 407.3870
## InjuryNatureRespiratory Disorders 257.6918
## InjuryNatureSprain 237.4430
## InjuryNatureStrain 235.6042
## t value
## (Intercept) 0.605
## ClaimantAge_at_DOI -1.904
## ClaimantTypeMedical Only -10.883
## ClaimantTypeReport Only -6.671
## InjuryNatureAll Other Specific Injuries, Noc 1.644
## InjuryNatureAngina Pectoris 0.705
## InjuryNatureAsbestosis 0.880
## InjuryNatureAsphyxiation 0.554
## InjuryNatureBurn 1.589
## InjuryNatureConcussion 1.797
## InjuryNatureContagious Disease 0.698
## InjuryNatureContusion 1.629
## InjuryNatureDermatitis 1.094
## InjuryNatureForeign Body 1.143
## InjuryNatureFracture 0.911
## InjuryNatureHeat Prostration 1.672
## InjuryNatureInfection 1.018
## InjuryNatureInflammation 1.574
## InjuryNatureLaceration 1.648
## InjuryNatureMental Stress 0.744
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.764
## InjuryNatureMultiple Physical Injuries Only 1.143
## InjuryNatureNo Physical Injury 0.925
## InjuryNatureNon-Standard Code 0.877
## InjuryNatureNot Available 0.945
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.480
## InjuryNaturePuncture 1.604
## InjuryNatureRadiation 0.498
## InjuryNatureRespiratory Disorders 2.289
## InjuryNatureSprain 1.310
## InjuryNatureStrain 1.468
## Pr(>|t|)
## (Intercept) 0.5454
## ClaimantAge_at_DOI 0.0572
## ClaimantTypeMedical Only < 2e-16
## ClaimantTypeReport Only 3.75e-11
## InjuryNatureAll Other Specific Injuries, Noc 0.1005
## InjuryNatureAngina Pectoris 0.4809
## InjuryNatureAsbestosis 0.3790
## InjuryNatureAsphyxiation 0.5798
## InjuryNatureBurn 0.1124
## InjuryNatureConcussion 0.0726
## InjuryNatureContagious Disease 0.4850
## InjuryNatureContusion 0.1036
## InjuryNatureDermatitis 0.2741
## InjuryNatureForeign Body 0.2534
## InjuryNatureFracture 0.3627
## InjuryNatureHeat Prostration 0.0947
## InjuryNatureInfection 0.3089
## InjuryNatureInflammation 0.1157
## InjuryNatureLaceration 0.0996
## InjuryNatureMental Stress 0.4570
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.4447
## InjuryNatureMultiple Physical Injuries Only 0.2531
## InjuryNatureNo Physical Injury 0.3551
## InjuryNatureNon-Standard Code 0.3807
## InjuryNatureNot Available 0.3451
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.6313
## InjuryNaturePuncture 0.1089
## InjuryNatureRadiation 0.6186
## InjuryNatureRespiratory Disorders 0.0222
## InjuryNatureSprain 0.1905
## InjuryNatureStrain 0.1423
##
## (Intercept)
## ClaimantAge_at_DOI .
## ClaimantTypeMedical Only ***
## ClaimantTypeReport Only ***
## InjuryNatureAll Other Specific Injuries, Noc
## InjuryNatureAngina Pectoris
## InjuryNatureAsbestosis
## InjuryNatureAsphyxiation
## InjuryNatureBurn
## InjuryNatureConcussion .
## InjuryNatureContagious Disease
## InjuryNatureContusion
## InjuryNatureDermatitis
## InjuryNatureForeign Body
## InjuryNatureFracture
## InjuryNatureHeat Prostration .
## InjuryNatureInfection
## InjuryNatureInflammation
## InjuryNatureLaceration .
## InjuryNatureMental Stress
## InjuryNatureMultiple Injuries Including Both Physical and Psychological
## InjuryNatureMultiple Physical Injuries Only
## InjuryNatureNo Physical Injury
## InjuryNatureNon-Standard Code
## InjuryNatureNot Available
## InjuryNaturePoisoning?Chemical (Other Than Metals)
## InjuryNaturePuncture
## InjuryNatureRadiation
## InjuryNatureRespiratory Disorders *
## InjuryNatureSprain
## InjuryNatureStrain
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 332.2 on 1301 degrees of freedom
## Multiple R-squared: 0.1157, Adjusted R-squared: 0.0953
## F-statistic: 5.674 on 30 and 1301 DF, p-value: < 2.2e-16
#Total_Incurred_Cost
data <- data.frame(Gender="Not Available", ClaimantType="Medical Only", InjuryNature="Puncture")
predict(regresion_TIC,data)## 1
## 1956.434
Interpretación:
Total_Incurred_Cost
El modelo predictivo nos muestra el costo total, considerando las demás
variables como de entrada, con una R-cuadrada ajustada del 20.62%.
Processing_Time
El modelo predictivo nos muestra el tiempo de procesamiento,
considerando las demás variables como de entrada, con una R-cuadrada
ajustada del 9.53%.