Worker´s compensation claims

Limpieza de la base de datos

Importamos las librerías

library (tidyverse)
library (foreign)
library (ggplot2)
library(dplyr)
library(scales)
library(ggrepel)
library(readr)
library(readxl)
library(rpart)
library(rpart.plot)
library(factoextra)

Importamos las Bases de Datos

claims <- read.csv("/Users/enrique/Downloads/Semestre 7- 1 Bloque R/ClaimsData2018.csv")
transactions <- read.csv("/Users/enrique/Downloads/Semestre 7- 1 Bloque R/TransactionsSummary2018.csv")
datos <- as.data.frame(claims)

Observaciones

summary(claims)
##     ClaimID           TotalPaid       TotalReserves     TotalRecovery      
##  Min.   :  650915   Min.   :   -270   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  811125   1st Qu.:     60   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  844626   Median :    235   Median :      0   Median :     0.00  
##  Mean   :10149151   Mean   :   6746   Mean   :   2233   Mean   :    68.88  
##  3rd Qu.:22716506   3rd Qu.:    938   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203891   Max.   :4527291   Max.   :2069575   Max.   :130541.03  
##  IndemnityPaid      OtherPaid       ClaimStatus        IncidentDate      
##  Min.   :  -475   Min.   :  -7820   Length:134004      Length:134004     
##  1st Qu.:     0   1st Qu.:     58   Class :character   Class :character  
##  Median :     0   Median :    230   Mode  :character   Mode  :character  
##  Mean   :  3061   Mean   :   3685                                        
##  3rd Qu.:     0   3rd Qu.:    855                                        
##  Max.   :640732   Max.   :4129915                                        
##  IncidentDescription ReturnToWorkDate   AverageWeeklyWage  ClaimantOpenedDate
##  Length:134004       Length:134004      Length:134004      Length:134004     
##  Class :character    Class :character   Class :character   Class :character  
##  Mode  :character    Mode  :character   Mode  :character   Mode  :character  
##                                                                              
##                                                                              
##                                                                              
##  ClaimantClosedDate EmployerNotificationDate ReceivedDate      
##  Length:134004      Length:134004            Length:134004     
##  Class :character   Class :character         Class :character  
##  Mode  :character   Mode  :character         Mode  :character  
##                                                                
##                                                                
##                                                                
##     IsDenied       ClaimantAge_at_DOI    Gender          ClaimantType      
##  Min.   :0.00000   Length:134004      Length:134004      Length:134004     
##  1st Qu.:0.00000   Class :character   Class :character   Class :character  
##  Median :0.00000   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :0.04474                                                           
##  3rd Qu.:0.00000                                                           
##  Max.   :1.00000                                                           
##   Injuryture        BodyPartRegion       BodyPart        
##  Length:134004      Length:134004      Length:134004     
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
## 
summary(transactions)
##     ClaimID         BillReviewALE        Hospital         PhysicianOutpatient
##  Min.   :  633915   Min.   : -456.0   Min.   : -12570.4   Min.   :  -4655.7  
##  1st Qu.:  793224   1st Qu.:   16.0   1st Qu.:    193.9   1st Qu.:    107.6  
##  Median :  828263   Median :   32.0   Median :    559.1   Median :    221.6  
##  Mean   :10112865   Mean   :  191.2   Mean   :   4394.7   Mean   :   1752.3  
##  3rd Qu.:22700126   3rd Qu.:   80.0   3rd Qu.:   2253.4   3rd Qu.:    710.5  
##  Max.   :62246496   Max.   :56475.3   Max.   :2759604.0   Max.   :1481468.5  
##                     NA's   :61857     NA's   :67254       NA's   :6978       
##        Rx          
##  Min.   :  -469.5  
##  1st Qu.:    23.3  
##  Median :    58.3  
##  Mean   :  1140.4  
##  3rd Qu.:   174.5  
##  Max.   :631635.5  
##  NA's   :67744

Claims:

  1. La base de datos cuenta otras columnas que no cuentan con ningun tipo de información relevante
  2. La base de datos cuenta con variables cuantitativas y cualitativas
  3. Hay variables tipo date and numeric que estan identificadas como character

Transactions:

  1. La base de datos “transactions” no es tan grande como la base de datos “claims”
  2. Cuenta con bastantes NA’s, pero esto es debido a que cada paciente requiere de diferentes servicios y medicamentos

Modificamos el tipo de variable, de caracter a fecha

claims$ClaimantOpenedDate<-as.Date(claims$ClaimantOpenedDate,format="%d/%m/%Y")
claims$ClaimantClosedDate<-as.Date(claims$ClaimantClosedDate,format="%d/%m/%Y")
claims$IncidentDate<-as.Date(claims$IncidentDate,format="%d/%m/%Y")
claims$ReturnToWorkDate<-as.Date(claims$ReturnToWorkDate,format="%d/%m/%Y")
claims$EmployerNotificationDate<-as.Date(claims$EmployerNotificationDate,format="%d/%m/%Y")
claims$ReceivedDate<-as.Date(claims$ReceivedDate,format="%d/%m/%Y")

Convertimos el tipo de variable de caracter a numerica

claims<-claims%>%mutate(AverageWeeklyWage=as.numeric(AverageWeeklyWage))
claims<-claims%>%mutate(ClaimantAge_at_DOI=as.numeric(ClaimantAge_at_DOI))

Eliminamos las edades iguales o menores a cero

claims <- subset(claims, ClaimantAge_at_DOI>= 0)

Unificamos las bases de datos con un left join en un nuevo df

trans_claims<-claims%>%left_join(transactions,by="ClaimID")
summary(trans_claims)
##     ClaimID           TotalPaid       TotalReserves     TotalRecovery      
##  Min.   :  650915   Min.   :    -22   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  814283   1st Qu.:     82   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  845571   Median :    281   Median :      0   Median :     0.00  
##  Mean   :12146395   Mean   :   8368   Mean   :   3365   Mean   :    68.22  
##  3rd Qu.:22725794   3rd Qu.:   1229   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203891   Max.   :4527291   Max.   :2069575   Max.   :130541.03  
##                                                                            
##  IndemnityPaid      OtherPaid       ClaimStatus         IncidentDate       
##  Min.   :  -475   Min.   :    -22   Length:88833       Min.   :1968-09-27  
##  1st Qu.:     0   1st Qu.:     79   Class :character   1st Qu.:2003-08-05  
##  Median :     0   Median :    275   Mode  :character   Median :2007-02-27  
##  Mean   :  3698   Mean   :   4670                      Mean   :2006-10-11  
##  3rd Qu.:     0   3rd Qu.:   1126                      3rd Qu.:2010-11-17  
##  Max.   :640732   Max.   :4129915                      Max.   :2014-06-27  
##                                                                            
##  IncidentDescription ReturnToWorkDate     AverageWeeklyWage  
##  Length:88833        Min.   :1984-01-01   Min.   :      0.0  
##  Class :character    1st Qu.:2005-12-09   1st Qu.:    300.0  
##  Mode  :character    Median :2009-04-29   Median :    502.6  
##                      Mean   :2008-07-19   Mean   :    629.0  
##                      3rd Qu.:2012-02-14   3rd Qu.:    684.8  
##                      Max.   :2015-05-07   Max.   :2024000.0  
##                      NA's   :30493        NA's   :50480      
##  ClaimantOpenedDate   ClaimantClosedDate   EmployerNotificationDate
##  Min.   :1968-09-27   Min.   :1999-06-01   Min.   :1972-09-10      
##  1st Qu.:2003-09-18   1st Qu.:2005-10-04   1st Qu.:2004-03-31      
##  Median :2007-04-18   Median :2008-12-11   Median :2007-09-26      
##  Mean   :2006-11-22   Mean   :2008-10-09   Mean   :2007-10-07      
##  3rd Qu.:2010-12-13   3rd Qu.:2011-06-10   3rd Qu.:2011-06-01      
##  Max.   :2014-06-30   Max.   :2014-06-30   Max.   :9988-02-21      
##                       NA's   :4637         NA's   :11756           
##   ReceivedDate           IsDenied       ClaimantAge_at_DOI    Gender         
##  Min.   :1968-09-27   Min.   :0.00000   Min.   : 0.00      Length:88833      
##  1st Qu.:2003-09-16   1st Qu.:0.00000   1st Qu.:33.00      Class :character  
##  Median :2007-03-28   Median :0.00000   Median :42.00      Mode  :character  
##  Mean   :2007-01-28   Mean   :0.05227   Mean   :42.05                        
##  3rd Qu.:2010-12-17   3rd Qu.:0.00000   3rd Qu.:51.00                        
##  Max.   :5202-01-10   Max.   :1.00000   Max.   :94.00                        
##                                                                              
##  ClaimantType        Injuryture        BodyPartRegion       BodyPart        
##  Length:88833       Length:88833       Length:88833       Length:88833      
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##  BillReviewALE        Hospital         PhysicianOutpatient       Rx          
##  Min.   : -448.0   Min.   : -12570.4   Min.   :   -549.5   Min.   :  -160.7  
##  1st Qu.:   16.0   1st Qu.:    205.4   1st Qu.:    105.8   1st Qu.:    22.4  
##  Median :   24.0   Median :    600.9   Median :    217.3   Median :    60.1  
##  Mean   :  188.4   Mean   :   5005.3   Mean   :   1773.7   Mean   :  1625.4  
##  3rd Qu.:   64.0   3rd Qu.:   2298.7   3rd Qu.:    673.7   3rd Qu.:   183.0  
##  Max.   :46055.3   Max.   :2759604.0   Max.   :1219766.6   Max.   :631635.5  
##  NA's   :70866     NA's   :75592       NA's   :56446       NA's   :76768
head(trans_claims)
##   ClaimID TotalPaid TotalReserves TotalRecovery IndemnityPaid OtherPaid
## 1  650915  11947.55             0             0        243.65  11703.90
## 2  650916      0.00             0             0          0.00      0.00
## 3  650917   9295.89             0             0          0.00   9295.89
## 4  650918   1026.29             0             0          0.00   1026.29
## 5  650919  43108.03             0             0      40000.00   3108.03
## 6  650920    331.90             0             0          0.00    331.90
##   ClaimStatus IncidentDate
## 1           C   2009-06-17
## 2           C   2009-06-26
## 3           C   2009-06-25
## 4           C   2009-06-12
## 5           C   2009-06-29
## 6           C   2009-06-25
##                                                                                                                                                                               IncidentDescription
## 1                                                                                                              Employee was moving concrete rings and installing a meter. He strained lower back.
## 2                                                                                                                        Employee was pulling lining. He felt a pop in the back causing a strain.
## 3                                                     Employee was in the restroom. He heard a scream from another restroom that startled him and he fell on his left hand causing a fracture. ()
## 4 Employee was unloading truck using a pallet jack to unload heavy equipment. Heavy load caused him to lose balance, and he struck his right shoulder on door jamb causing unspecified injury. ()
## 5                                        Employee was leaning over to pick up a piece of paper. She fell out of rolling chair causing pain to lower back. Dx: lower back strain/buldging disc. ()
## 6                                              Employee was performing general lawn care maintence and outdoor tours and educatiol programs. He sustained a bite of right calf causing infection.
##   ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate ClaimantClosedDate
## 1       2009-12-08            639.59         2009-07-02         2010-07-20
## 2       2009-06-26                NA         2009-07-02         2009-11-25
## 3       2009-07-13           1649.00         2009-07-02         2010-03-30
## 4       2009-06-12                NA         2009-07-02         2010-03-29
## 5             <NA>            539.00         2009-07-02         2011-05-06
## 6       2009-06-25                NA         2009-07-02         2009-11-25
##   EmployerNotificationDate ReceivedDate IsDenied ClaimantAge_at_DOI Gender
## 1               2009-06-29   2009-07-02        0                 49   Male
## 2               2009-07-01   2009-07-02        0                 49   Male
## 3               2009-06-25   2009-07-02        0                 47   Male
## 4               2009-06-23   2009-07-02        0                 61   Male
## 5               2009-07-01   2009-07-02        0                 41 Female
## 6               2009-06-25   2009-07-02        0                 28   Male
##   ClaimantType Injuryture    BodyPartRegion        BodyPart BillReviewALE
## 1    Indemnity     Strain             Trunk Lower Back Area            NA
## 2 Medical Only     Strain             Trunk Lower Back Area            NA
## 3    Indemnity   Fracture Upper Extremities            Hand            NA
## 4 Medical Only  Contusion Upper Extremities     Shoulder(S)            NA
## 5    Indemnity     Strain             Trunk Lower Back Area            NA
## 6 Medical Only   Puncture Lower Extremities       Lower Leg            NA
##   Hospital PhysicianOutpatient Rx
## 1       NA                  NA NA
## 2       NA                  NA NA
## 3       NA                  NA NA
## 4       NA                  NA NA
## 5       NA                  NA NA
## 6       NA                  NA NA

Regresión Lineal

Nuevo df para la Regresión lineal, tomando solo las variables que nos interesan. Cálculo de días totales de indemnización

df <- as.data.frame(claims)
df$Days <- as.numeric(difftime(df$ClaimantClosedDate, df$ClaimantOpenedDate, units = "days"))
df <- df[, c("TotalPaid", "Gender", "Days", "ClaimantType", "Injuryture", "BodyPartRegion", "BodyPart")]
df <- na.omit(df)

Regresión Lineal

regresion <- lm(TotalPaid ~ Gender + Days + ClaimantType
+ Injuryture + BodyPartRegion + BodyPart, data= df)
summary(regresion)
## 
## Call:
## lm(formula = TotalPaid ~ Gender + Days + ClaimantType + Injuryture + 
##     BodyPartRegion + BodyPart, data = df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
##  -36581   -4458      -4    2169 1372311 
## 
## Coefficients: (7 not defined because of singularities)
##                                                                         Estimate
## (Intercept)                                                            4.719e+03
## GenderMale                                                             1.889e+02
## GenderNot Available                                                    6.501e+03
## Days                                                                   3.152e+00
## ClaimantTypeMedical Only                                              -1.576e+04
## ClaimantTypeReport Only                                               -1.527e+04
## InjurytureAll Other Cumulative Injury, NOC                             3.102e+03
## InjurytureAll Other Occupatiol Disease Injury, NOC                     1.180e+04
## InjurytureAll Other Specific Injuries, Noc                             2.616e+03
## InjurytureAmputation                                                   8.228e+03
## InjurytureAngi Pectoris                                                3.261e+03
## InjurytureAsbestosis                                                   1.150e+04
## InjurytureAsphyxiation                                                 2.083e+04
## InjurytureBlack Lung                                                   4.914e+03
## InjurytureBurn                                                         6.462e+03
## InjurytureCancer                                                       2.554e+04
## InjurytureCarpal Tunnel Syndrome                                       4.553e+03
## InjurytureConcussion                                                   7.261e+03
## InjurytureContagious Disease                                           3.118e+03
## InjurytureContusion                                                    4.798e+03
## InjurytureCrushing                                                     6.400e+03
## InjurytureDermatitis                                                   4.291e+03
## InjurytureDislocation                                                  6.376e+03
## InjurytureDust Disease, NOC                                            4.285e+03
## InjurytureElectric Shock                                               3.152e+03
## InjurytureForeign Body                                                 3.639e+03
## InjurytureFracture                                                     8.861e+03
## InjurytureFreezing                                                     1.705e+03
## InjurytureHearing Loss Or Impairment                                  -3.014e+03
## InjurytureHeat Prostration                                             2.554e+03
## InjurytureHernia                                                       2.462e+01
## InjurytureInfection                                                    4.239e+03
## InjurytureInflammation                                                 5.140e+03
## InjurytureLaceration                                                   5.116e+03
## InjurytureLoss of Hearing                                              3.644e+03
## InjurytureMental Disorder                                              8.621e+03
## InjurytureMental Stress                                               -1.509e+02
## InjurytureMultiple Injuries Including Both Physical and Psychological  8.474e+03
## InjurytureMultiple Physical Injuries Only                              7.203e+03
## InjurytureMyocardial Infarction                                        7.457e+03
## InjurytureNo Physical Injury                                           4.739e+03
## InjurytureNon-Standard Code                                            1.388e+03
## InjurytureNot Available                                                5.863e+03
## InjuryturePoisoning?Chemical (Other Than Metals)                       3.501e+03
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)              4.241e+03
## InjuryturePuncture                                                     4.969e+03
## InjurytureRadiation                                                    8.736e+03
## InjurytureRespiratory Disorders                                        4.327e+03
## InjurytureRupture                                                      1.390e+04
## InjurytureSeverance                                                    1.958e+04
## InjurytureSilicosis                                                    5.136e+03
## InjurytureSprain                                                       5.737e+03
## InjurytureStrain                                                       4.869e+03
## InjurytureSyncope                                                      3.910e+03
## InjurytureVascular                                                     4.310e+03
## InjurytureVDT-Related Disease                                         -1.795e+03
## InjurytureVision Loss                                                  4.294e+03
## BodyPartRegionLower Extremities                                        5.119e+03
## BodyPartRegionMultiple Body Parts                                      1.035e+04
## BodyPartRegionNeck                                                     1.746e+04
## BodyPartRegionNon-Standard Code                                       -1.470e+03
## BodyPartRegionNot Available                                            6.237e+03
## BodyPartRegionTrunk                                                    3.038e+03
## BodyPartRegionUpper Extremities                                        3.464e+03
## BodyPartAnkle                                                         -2.648e+03
## BodyPartArtificial Appliance                                          -7.387e+03
## BodyPartBody Systems and Multiple Body Systems                        -6.359e+03
## BodyPartBrain                                                          1.309e+04
## BodyPartButtocks                                                       1.175e+03
## BodyPartChest                                                          9.252e+02
## BodyPartDisc-Trunk                                                     3.347e+03
## BodyPartEar(S)                                                         5.084e+03
## BodyPartElbow                                                          6.802e+02
## BodyPartEyes                                                           4.177e+03
## BodyPartFacial Bones                                                   3.602e+03
## BodyPartFinger(S)                                                     -1.011e+03
## BodyPartFoot                                                          -2.643e+03
## BodyPartGreat Toe                                                     -2.662e+03
## BodyPartHand                                                           1.200e+02
## BodyPartHeart                                                         -3.209e+03
## BodyPartHip                                                           -2.082e+02
## BodyPartInsufficient Info to Properly Identify?Unclassified           -5.929e+03
## BodyPartInterl Organs                                                  5.753e+02
## BodyPartKnee                                                           5.199e+02
## BodyPartLarynx                                                        -1.811e+04
## BodyPartLower Arm                                                      1.011e+03
## BodyPartLower Back Area                                                2.666e+03
## BodyPartLower Leg                                                     -1.442e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)            3.822e+03
## BodyPartLungs                                                          1.597e+03
## BodyPartMouth                                                          2.736e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)   -4.729e+03
## BodyPartMultiple Head Injury                                           4.727e+03
## BodyPartMultiple Lower Extremities                                     9.249e+02
## BodyPartMultiple Neck Injury                                          -1.180e+04
## BodyPartMultiple Trunk                                                -2.427e+03
## BodyPartMultiple Upper Extremities                                    -2.565e+02
## BodyPartNo Physical Injury                                            -6.257e+03
## BodyPartNon-Standard Code                                                     NA
## BodyPartNose                                                           4.225e+03
## BodyPartNot Available                                                         NA
## BodyPartPelvis                                                         4.388e+03
## BodyPartSacrum And Coccyx                                             -1.364e+03
## BodyPartShoulder(S)                                                    4.446e+03
## BodyPartSkull                                                          5.343e+03
## BodyPartSoft Tissue-Head                                               5.954e+03
## BodyPartSoft Tissue-Neck                                              -1.265e+04
## BodyPartSpil Cord-Trunk                                               -1.577e+03
## BodyPartTeeth                                                                 NA
## BodyPartThumb                                                         -6.400e+02
## BodyPartToes                                                          -3.139e+03
## BodyPartTrachea                                                       -1.612e+04
## BodyPartUpper Arm                                                      7.550e+02
## BodyPartUpper Back Area                                                1.287e+03
## BodyPartUpper Leg                                                             NA
## BodyPartVertebrae                                                             NA
## BodyPartWhole Body                                                            NA
## BodyPartWrist                                                                 NA
##                                                                       Std. Error
## (Intercept)                                                            9.639e+03
## GenderMale                                                             1.522e+02
## GenderNot Available                                                    9.853e+02
## Days                                                                   8.391e-02
## ClaimantTypeMedical Only                                               1.857e+02
## ClaimantTypeReport Only                                                3.307e+02
## InjurytureAll Other Cumulative Injury, NOC                             1.017e+04
## InjurytureAll Other Occupatiol Disease Injury, NOC                     1.092e+04
## InjurytureAll Other Specific Injuries, Noc                             9.534e+03
## InjurytureAmputation                                                   9.995e+03
## InjurytureAngi Pectoris                                                1.088e+04
## InjurytureAsbestosis                                                   9.972e+03
## InjurytureAsphyxiation                                                 1.149e+04
## InjurytureBlack Lung                                                   1.557e+04
## InjurytureBurn                                                         9.555e+03
## InjurytureCancer                                                       1.291e+04
## InjurytureCarpal Tunnel Syndrome                                       9.580e+03
## InjurytureConcussion                                                   9.578e+03
## InjurytureContagious Disease                                           9.626e+03
## InjurytureContusion                                                    9.531e+03
## InjurytureCrushing                                                     9.572e+03
## InjurytureDermatitis                                                   9.550e+03
## InjurytureDislocation                                                  9.605e+03
## InjurytureDust Disease, NOC                                            1.066e+04
## InjurytureElectric Shock                                               9.777e+03
## InjurytureForeign Body                                                 9.547e+03
## InjurytureFracture                                                     9.540e+03
## InjurytureFreezing                                                     1.429e+04
## InjurytureHearing Loss Or Impairment                                   9.950e+03
## InjurytureHeat Prostration                                             9.695e+03
## InjurytureHernia                                                       9.665e+03
## InjurytureInfection                                                    9.609e+03
## InjurytureInflammation                                                 9.551e+03
## InjurytureLaceration                                                   9.533e+03
## InjurytureLoss of Hearing                                              1.017e+04
## InjurytureMental Disorder                                              1.173e+04
## InjurytureMental Stress                                                9.691e+03
## InjurytureMultiple Injuries Including Both Physical and Psychological  1.005e+04
## InjurytureMultiple Physical Injuries Only                              9.543e+03
## InjurytureMyocardial Infarction                                        1.095e+04
## InjurytureNo Physical Injury                                           9.545e+03
## InjurytureNon-Standard Code                                            9.545e+03
## InjurytureNot Available                                                9.601e+03
## InjuryturePoisoning?Chemical (Other Than Metals)                       9.681e+03
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)              9.748e+03
## InjuryturePuncture                                                     9.537e+03
## InjurytureRadiation                                                    1.060e+04
## InjurytureRespiratory Disorders                                        9.587e+03
## InjurytureRupture                                                      9.786e+03
## InjurytureSeverance                                                    1.052e+04
## InjurytureSilicosis                                                    1.556e+04
## InjurytureSprain                                                       9.533e+03
## InjurytureStrain                                                       9.530e+03
## InjurytureSyncope                                                      9.732e+03
## InjurytureVascular                                                     1.167e+04
## InjurytureVDT-Related Disease                                          1.783e+04
## InjurytureVision Loss                                                  1.028e+04
## BodyPartRegionLower Extremities                                        1.662e+03
## BodyPartRegionMultiple Body Parts                                      2.749e+03
## BodyPartRegionNeck                                                     4.977e+03
## BodyPartRegionNon-Standard Code                                        1.585e+03
## BodyPartRegionNot Available                                            8.199e+03
## BodyPartRegionTrunk                                                    1.604e+03
## BodyPartRegionUpper Extremities                                        1.486e+03
## BodyPartAnkle                                                          9.093e+02
## BodyPartArtificial Appliance                                           9.008e+03
## BodyPartBody Systems and Multiple Body Systems                         2.591e+03
## BodyPartBrain                                                          4.122e+03
## BodyPartButtocks                                                       1.390e+03
## BodyPartChest                                                          8.896e+02
## BodyPartDisc-Trunk                                                     1.248e+03
## BodyPartEar(S)                                                         1.912e+03
## BodyPartElbow                                                          6.520e+02
## BodyPartEyes                                                           1.513e+03
## BodyPartFacial Bones                                                   1.648e+03
## BodyPartFinger(S)                                                      4.682e+02
## BodyPartFoot                                                           9.329e+02
## BodyPartGreat Toe                                                      1.856e+03
## BodyPartHand                                                           4.759e+02
## BodyPartHeart                                                          4.653e+03
## BodyPartHip                                                            1.072e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified            2.541e+03
## BodyPartInterl Organs                                                  1.870e+03
## BodyPartKnee                                                           8.646e+02
## BodyPartLarynx                                                         7.785e+03
## BodyPartLower Arm                                                      5.743e+02
## BodyPartLower Back Area                                                7.431e+02
## BodyPartLower Leg                                                      9.503e+02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)            1.016e+03
## BodyPartLungs                                                          1.450e+03
## BodyPartMouth                                                          1.809e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)    2.352e+03
## BodyPartMultiple Head Injury                                           1.533e+03
## BodyPartMultiple Lower Extremities                                     1.169e+03
## BodyPartMultiple Neck Injury                                           4.806e+03
## BodyPartMultiple Trunk                                                 1.978e+03
## BodyPartMultiple Upper Extremities                                     7.923e+02
## BodyPartNo Physical Injury                                             2.477e+03
## BodyPartNon-Standard Code                                                     NA
## BodyPartNose                                                           1.810e+03
## BodyPartNot Available                                                         NA
## BodyPartPelvis                                                         1.978e+03
## BodyPartSacrum And Coccyx                                              2.796e+03
## BodyPartShoulder(S)                                                    4.958e+02
## BodyPartSkull                                                          1.665e+03
## BodyPartSoft Tissue-Head                                               1.633e+03
## BodyPartSoft Tissue-Neck                                               4.793e+03
## BodyPartSpil Cord-Trunk                                                1.408e+03
## BodyPartTeeth                                                                 NA
## BodyPartThumb                                                          6.275e+02
## BodyPartToes                                                           1.312e+03
## BodyPartTrachea                                                        7.803e+03
## BodyPartUpper Arm                                                      7.016e+02
## BodyPartUpper Back Area                                                1.053e+03
## BodyPartUpper Leg                                                             NA
## BodyPartVertebrae                                                             NA
## BodyPartWhole Body                                                            NA
## BodyPartWrist                                                                 NA
##                                                                       t value
## (Intercept)                                                             0.490
## GenderMale                                                              1.241
## GenderNot Available                                                     6.598
## Days                                                                   37.564
## ClaimantTypeMedical Only                                              -84.874
## ClaimantTypeReport Only                                               -46.161
## InjurytureAll Other Cumulative Injury, NOC                              0.305
## InjurytureAll Other Occupatiol Disease Injury, NOC                      1.081
## InjurytureAll Other Specific Injuries, Noc                              0.274
## InjurytureAmputation                                                    0.823
## InjurytureAngi Pectoris                                                 0.300
## InjurytureAsbestosis                                                    1.154
## InjurytureAsphyxiation                                                  1.813
## InjurytureBlack Lung                                                    0.316
## InjurytureBurn                                                          0.676
## InjurytureCancer                                                        1.979
## InjurytureCarpal Tunnel Syndrome                                        0.475
## InjurytureConcussion                                                    0.758
## InjurytureContagious Disease                                            0.324
## InjurytureContusion                                                     0.503
## InjurytureCrushing                                                      0.669
## InjurytureDermatitis                                                    0.449
## InjurytureDislocation                                                   0.664
## InjurytureDust Disease, NOC                                             0.402
## InjurytureElectric Shock                                                0.322
## InjurytureForeign Body                                                  0.381
## InjurytureFracture                                                      0.929
## InjurytureFreezing                                                      0.119
## InjurytureHearing Loss Or Impairment                                   -0.303
## InjurytureHeat Prostration                                              0.263
## InjurytureHernia                                                        0.003
## InjurytureInfection                                                     0.441
## InjurytureInflammation                                                  0.538
## InjurytureLaceration                                                    0.537
## InjurytureLoss of Hearing                                               0.358
## InjurytureMental Disorder                                               0.735
## InjurytureMental Stress                                                -0.016
## InjurytureMultiple Injuries Including Both Physical and Psychological   0.843
## InjurytureMultiple Physical Injuries Only                               0.755
## InjurytureMyocardial Infarction                                         0.681
## InjurytureNo Physical Injury                                            0.496
## InjurytureNon-Standard Code                                             0.145
## InjurytureNot Available                                                 0.611
## InjuryturePoisoning?Chemical (Other Than Metals)                        0.362
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)               0.435
## InjuryturePuncture                                                      0.521
## InjurytureRadiation                                                     0.824
## InjurytureRespiratory Disorders                                         0.451
## InjurytureRupture                                                       1.420
## InjurytureSeverance                                                     1.862
## InjurytureSilicosis                                                     0.330
## InjurytureSprain                                                        0.602
## InjurytureStrain                                                        0.511
## InjurytureSyncope                                                       0.402
## InjurytureVascular                                                      0.369
## InjurytureVDT-Related Disease                                          -0.101
## InjurytureVision Loss                                                   0.418
## BodyPartRegionLower Extremities                                         3.079
## BodyPartRegionMultiple Body Parts                                       3.766
## BodyPartRegionNeck                                                      3.508
## BodyPartRegionNon-Standard Code                                        -0.927
## BodyPartRegionNot Available                                             0.761
## BodyPartRegionTrunk                                                     1.894
## BodyPartRegionUpper Extremities                                         2.332
## BodyPartAnkle                                                          -2.912
## BodyPartArtificial Appliance                                           -0.820
## BodyPartBody Systems and Multiple Body Systems                         -2.455
## BodyPartBrain                                                           3.176
## BodyPartButtocks                                                        0.846
## BodyPartChest                                                           1.040
## BodyPartDisc-Trunk                                                      2.681
## BodyPartEar(S)                                                          2.659
## BodyPartElbow                                                           1.043
## BodyPartEyes                                                            2.760
## BodyPartFacial Bones                                                    2.186
## BodyPartFinger(S)                                                      -2.159
## BodyPartFoot                                                           -2.833
## BodyPartGreat Toe                                                      -1.434
## BodyPartHand                                                            0.252
## BodyPartHeart                                                          -0.690
## BodyPartHip                                                            -0.194
## BodyPartInsufficient Info to Properly Identify?Unclassified            -2.333
## BodyPartInterl Organs                                                   0.308
## BodyPartKnee                                                            0.601
## BodyPartLarynx                                                         -2.327
## BodyPartLower Arm                                                       1.760
## BodyPartLower Back Area                                                 3.588
## BodyPartLower Leg                                                      -1.517
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             3.760
## BodyPartLungs                                                           1.101
## BodyPartMouth                                                           1.513
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)    -2.010
## BodyPartMultiple Head Injury                                            3.083
## BodyPartMultiple Lower Extremities                                      0.791
## BodyPartMultiple Neck Injury                                           -2.456
## BodyPartMultiple Trunk                                                 -1.227
## BodyPartMultiple Upper Extremities                                     -0.324
## BodyPartNo Physical Injury                                             -2.526
## BodyPartNon-Standard Code                                                  NA
## BodyPartNose                                                            2.334
## BodyPartNot Available                                                      NA
## BodyPartPelvis                                                          2.218
## BodyPartSacrum And Coccyx                                              -0.488
## BodyPartShoulder(S)                                                     8.966
## BodyPartSkull                                                           3.209
## BodyPartSoft Tissue-Head                                                3.647
## BodyPartSoft Tissue-Neck                                               -2.640
## BodyPartSpil Cord-Trunk                                                -1.121
## BodyPartTeeth                                                              NA
## BodyPartThumb                                                          -1.020
## BodyPartToes                                                           -2.393
## BodyPartTrachea                                                        -2.066
## BodyPartUpper Arm                                                       1.076
## BodyPartUpper Back Area                                                 1.222
## BodyPartUpper Leg                                                          NA
## BodyPartVertebrae                                                          NA
## BodyPartWhole Body                                                         NA
## BodyPartWrist                                                              NA
##                                                                       Pr(>|t|)
## (Intercept)                                                           0.624416
## GenderMale                                                            0.214431
## GenderNot Available                                                   4.18e-11
## Days                                                                   < 2e-16
## ClaimantTypeMedical Only                                               < 2e-16
## ClaimantTypeReport Only                                                < 2e-16
## InjurytureAll Other Cumulative Injury, NOC                            0.760316
## InjurytureAll Other Occupatiol Disease Injury, NOC                    0.279886
## InjurytureAll Other Specific Injuries, Noc                            0.783805
## InjurytureAmputation                                                  0.410381
## InjurytureAngi Pectoris                                               0.764325
## InjurytureAsbestosis                                                  0.248704
## InjurytureAsphyxiation                                                0.069869
## InjurytureBlack Lung                                                  0.752292
## InjurytureBurn                                                        0.498863
## InjurytureCancer                                                      0.047863
## InjurytureCarpal Tunnel Syndrome                                      0.634600
## InjurytureConcussion                                                  0.448390
## InjurytureContagious Disease                                          0.746027
## InjurytureContusion                                                   0.614654
## InjurytureCrushing                                                    0.503723
## InjurytureDermatitis                                                  0.653175
## InjurytureDislocation                                                 0.506796
## InjurytureDust Disease, NOC                                           0.687670
## InjurytureElectric Shock                                              0.747125
## InjurytureForeign Body                                                0.703049
## InjurytureFracture                                                    0.353000
## InjurytureFreezing                                                    0.905045
## InjurytureHearing Loss Or Impairment                                  0.761937
## InjurytureHeat Prostration                                            0.792216
## InjurytureHernia                                                      0.997967
## InjurytureInfection                                                   0.659106
## InjurytureInflammation                                                0.590456
## InjurytureLaceration                                                  0.591489
## InjurytureLoss of Hearing                                             0.720178
## InjurytureMental Disorder                                             0.462361
## InjurytureMental Stress                                               0.987577
## InjurytureMultiple Injuries Including Both Physical and Psychological 0.398971
## InjurytureMultiple Physical Injuries Only                             0.450348
## InjurytureMyocardial Infarction                                       0.496034
## InjurytureNo Physical Injury                                          0.619553
## InjurytureNon-Standard Code                                           0.884410
## InjurytureNot Available                                               0.541425
## InjuryturePoisoning?Chemical (Other Than Metals)                      0.717650
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)             0.663499
## InjuryturePuncture                                                    0.602334
## InjurytureRadiation                                                   0.409970
## InjurytureRespiratory Disorders                                       0.651767
## InjurytureRupture                                                     0.155649
## InjurytureSeverance                                                   0.062630
## InjurytureSilicosis                                                   0.741385
## InjurytureSprain                                                      0.547297
## InjurytureStrain                                                      0.609402
## InjurytureSyncope                                                     0.687865
## InjurytureVascular                                                    0.711966
## InjurytureVDT-Related Disease                                         0.919815
## InjurytureVision Loss                                                 0.676082
## BodyPartRegionLower Extremities                                       0.002077
## BodyPartRegionMultiple Body Parts                                     0.000166
## BodyPartRegionNeck                                                    0.000451
## BodyPartRegionNon-Standard Code                                       0.353802
## BodyPartRegionNot Available                                           0.446839
## BodyPartRegionTrunk                                                   0.058240
## BodyPartRegionUpper Extremities                                       0.019719
## BodyPartAnkle                                                         0.003593
## BodyPartArtificial Appliance                                          0.412221
## BodyPartBody Systems and Multiple Body Systems                        0.014108
## BodyPartBrain                                                         0.001492
## BodyPartButtocks                                                      0.397769
## BodyPartChest                                                         0.298345
## BodyPartDisc-Trunk                                                    0.007340
## BodyPartEar(S)                                                        0.007832
## BodyPartElbow                                                         0.296788
## BodyPartEyes                                                          0.005786
## BodyPartFacial Bones                                                  0.028787
## BodyPartFinger(S)                                                     0.030861
## BodyPartFoot                                                          0.004607
## BodyPartGreat Toe                                                     0.151448
## BodyPartHand                                                          0.800953
## BodyPartHeart                                                         0.490416
## BodyPartHip                                                           0.846059
## BodyPartInsufficient Info to Properly Identify?Unclassified           0.019626
## BodyPartInterl Organs                                                 0.758366
## BodyPartKnee                                                          0.547655
## BodyPartLarynx                                                        0.019993
## BodyPartLower Arm                                                     0.078346
## BodyPartLower Back Area                                               0.000333
## BodyPartLower Leg                                                     0.129283
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)           0.000170
## BodyPartLungs                                                         0.270917
## BodyPartMouth                                                         0.130397
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)   0.044393
## BodyPartMultiple Head Injury                                          0.002049
## BodyPartMultiple Lower Extremities                                    0.428973
## BodyPartMultiple Neck Injury                                          0.014053
## BodyPartMultiple Trunk                                                0.219773
## BodyPartMultiple Upper Extremities                                    0.746093
## BodyPartNo Physical Injury                                            0.011530
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                          0.019580
## BodyPartNot Available                                                       NA
## BodyPartPelvis                                                        0.026584
## BodyPartSacrum And Coccyx                                             0.625813
## BodyPartShoulder(S)                                                    < 2e-16
## BodyPartSkull                                                         0.001332
## BodyPartSoft Tissue-Head                                              0.000265
## BodyPartSoft Tissue-Neck                                              0.008300
## BodyPartSpil Cord-Trunk                                               0.262491
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                         0.307786
## BodyPartToes                                                          0.016731
## BodyPartTrachea                                                       0.038875
## BodyPartUpper Arm                                                     0.281885
## BodyPartUpper Back Area                                               0.221792
## BodyPartUpper Leg                                                           NA
## BodyPartVertebrae                                                           NA
## BodyPartWhole Body                                                          NA
## BodyPartWrist                                                               NA
##                                                                          
## (Intercept)                                                              
## GenderMale                                                               
## GenderNot Available                                                   ***
## Days                                                                  ***
## ClaimantTypeMedical Only                                              ***
## ClaimantTypeReport Only                                               ***
## InjurytureAll Other Cumulative Injury, NOC                               
## InjurytureAll Other Occupatiol Disease Injury, NOC                       
## InjurytureAll Other Specific Injuries, Noc                               
## InjurytureAmputation                                                     
## InjurytureAngi Pectoris                                                  
## InjurytureAsbestosis                                                     
## InjurytureAsphyxiation                                                .  
## InjurytureBlack Lung                                                     
## InjurytureBurn                                                           
## InjurytureCancer                                                      *  
## InjurytureCarpal Tunnel Syndrome                                         
## InjurytureConcussion                                                     
## InjurytureContagious Disease                                             
## InjurytureContusion                                                      
## InjurytureCrushing                                                       
## InjurytureDermatitis                                                     
## InjurytureDislocation                                                    
## InjurytureDust Disease, NOC                                              
## InjurytureElectric Shock                                                 
## InjurytureForeign Body                                                   
## InjurytureFracture                                                       
## InjurytureFreezing                                                       
## InjurytureHearing Loss Or Impairment                                     
## InjurytureHeat Prostration                                               
## InjurytureHernia                                                         
## InjurytureInfection                                                      
## InjurytureInflammation                                                   
## InjurytureLaceration                                                     
## InjurytureLoss of Hearing                                                
## InjurytureMental Disorder                                                
## InjurytureMental Stress                                                  
## InjurytureMultiple Injuries Including Both Physical and Psychological    
## InjurytureMultiple Physical Injuries Only                                
## InjurytureMyocardial Infarction                                          
## InjurytureNo Physical Injury                                             
## InjurytureNon-Standard Code                                              
## InjurytureNot Available                                                  
## InjuryturePoisoning?Chemical (Other Than Metals)                         
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)                
## InjuryturePuncture                                                       
## InjurytureRadiation                                                      
## InjurytureRespiratory Disorders                                          
## InjurytureRupture                                                        
## InjurytureSeverance                                                   .  
## InjurytureSilicosis                                                      
## InjurytureSprain                                                         
## InjurytureStrain                                                         
## InjurytureSyncope                                                        
## InjurytureVascular                                                       
## InjurytureVDT-Related Disease                                            
## InjurytureVision Loss                                                    
## BodyPartRegionLower Extremities                                       ** 
## BodyPartRegionMultiple Body Parts                                     ***
## BodyPartRegionNeck                                                    ***
## BodyPartRegionNon-Standard Code                                          
## BodyPartRegionNot Available                                              
## BodyPartRegionTrunk                                                   .  
## BodyPartRegionUpper Extremities                                       *  
## BodyPartAnkle                                                         ** 
## BodyPartArtificial Appliance                                             
## BodyPartBody Systems and Multiple Body Systems                        *  
## BodyPartBrain                                                         ** 
## BodyPartButtocks                                                         
## BodyPartChest                                                            
## BodyPartDisc-Trunk                                                    ** 
## BodyPartEar(S)                                                        ** 
## BodyPartElbow                                                            
## BodyPartEyes                                                          ** 
## BodyPartFacial Bones                                                  *  
## BodyPartFinger(S)                                                     *  
## BodyPartFoot                                                          ** 
## BodyPartGreat Toe                                                        
## BodyPartHand                                                             
## BodyPartHeart                                                            
## BodyPartHip                                                              
## BodyPartInsufficient Info to Properly Identify?Unclassified           *  
## BodyPartInterl Organs                                                    
## BodyPartKnee                                                             
## BodyPartLarynx                                                        *  
## BodyPartLower Arm                                                     .  
## BodyPartLower Back Area                                               ***
## BodyPartLower Leg                                                        
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)           ***
## BodyPartLungs                                                            
## BodyPartMouth                                                            
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)   *  
## BodyPartMultiple Head Injury                                          ** 
## BodyPartMultiple Lower Extremities                                       
## BodyPartMultiple Neck Injury                                          *  
## BodyPartMultiple Trunk                                                   
## BodyPartMultiple Upper Extremities                                       
## BodyPartNo Physical Injury                                            *  
## BodyPartNon-Standard Code                                                
## BodyPartNose                                                          *  
## BodyPartNot Available                                                    
## BodyPartPelvis                                                        *  
## BodyPartSacrum And Coccyx                                                
## BodyPartShoulder(S)                                                   ***
## BodyPartSkull                                                         ** 
## BodyPartSoft Tissue-Head                                              ***
## BodyPartSoft Tissue-Neck                                              ** 
## BodyPartSpil Cord-Trunk                                                  
## BodyPartTeeth                                                            
## BodyPartThumb                                                            
## BodyPartToes                                                          *  
## BodyPartTrachea                                                       *  
## BodyPartUpper Arm                                                        
## BodyPartUpper Back Area                                                  
## BodyPartUpper Leg                                                        
## BodyPartVertebrae                                                        
## BodyPartWhole Body                                                       
## BodyPartWrist                                                            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 21300 on 84085 degrees of freedom
## Multiple R-squared:  0.1245, Adjusted R-squared:  0.1234 
## F-statistic: 108.7 on 110 and 84085 DF,  p-value: < 2.2e-16

Ajustar Modelo

df <- subset(df, 
                      ClaimantType == "Medical Only" | 
                      ClaimantType == "Report Only" |
                      BodyPart %in% c("Body Systems and Multiple Body Systems", "Brain", "Disc-Trunk", "Eyes", 
                                      "Insufficient Info to Properly Identify?Unclassified", "Lower Back Area", 
                                      "Lumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)", 
                                      "Multiple Body Parts (Including Body Systems and Body Parts)", 
                                      "No Physical Injury", "Shoulder(S)")
)

Modelo Ajustado

regresion <- lm(TotalPaid ~ ClaimantType + Days + Injuryture + BodyPart, data= df)
summary(regresion)
## 
## Call:
## lm(formula = TotalPaid ~ ClaimantType + Days + Injuryture + BodyPart, 
##     data = df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
##  -32285   -1284     311    1010 1087942 
## 
## Coefficients:
##                                                                         Estimate
## (Intercept)                                                            1.443e+04
## ClaimantTypeMedical Only                                              -2.142e+04
## ClaimantTypeReport Only                                               -2.175e+04
## Days                                                                   1.774e+00
## InjurytureAll Other Cumulative Injury, NOC                             7.903e+03
## InjurytureAll Other Occupatiol Disease Injury, NOC                     7.210e+03
## InjurytureAll Other Specific Injuries, Noc                             5.875e+03
## InjurytureAmputation                                                   7.516e+03
## InjurytureAngi Pectoris                                                7.884e+03
## InjurytureAsbestosis                                                   4.043e+03
## InjurytureAsphyxiation                                                 7.108e+03
## InjurytureBlack Lung                                                   6.980e+03
## InjurytureBurn                                                         6.558e+03
## InjurytureCancer                                                       4.073e+03
## InjurytureCarpal Tunnel Syndrome                                       6.829e+03
## InjurytureConcussion                                                   8.141e+03
## InjurytureContagious Disease                                           5.860e+03
## InjurytureContusion                                                    6.814e+03
## InjurytureCrushing                                                     7.128e+03
## InjurytureDermatitis                                                   6.389e+03
## InjurytureDislocation                                                  6.539e+03
## InjurytureDust Disease, NOC                                            6.347e+03
## InjurytureElectric Shock                                               5.154e+03
## InjurytureForeign Body                                                 5.954e+03
## InjurytureFracture                                                     8.917e+03
## InjurytureFreezing                                                     4.378e+03
## InjurytureHearing Loss Or Impairment                                   6.105e+03
## InjurytureHeat Prostration                                             5.110e+03
## InjurytureHernia                                                       7.545e+03
## InjurytureInfection                                                    6.588e+03
## InjurytureInflammation                                                 7.289e+03
## InjurytureLaceration                                                   6.784e+03
## InjurytureLoss of Hearing                                              6.703e+03
## InjurytureMental Disorder                                              1.083e+04
## InjurytureMental Stress                                               -2.663e+02
## InjurytureMultiple Injuries Including Both Physical and Psychological  1.111e+02
## InjurytureMultiple Physical Injuries Only                              7.540e+03
## InjurytureMyocardial Infarction                                        6.215e+03
## InjurytureNo Physical Injury                                           6.850e+03
## InjurytureNon-Standard Code                                            4.787e+03
## InjurytureNot Available                                                7.628e+03
## InjuryturePoisoning?Chemical (Other Than Metals)                       6.167e+03
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)              6.404e+03
## InjuryturePuncture                                                     6.623e+03
## InjurytureRadiation                                                    1.286e+04
## InjurytureRespiratory Disorders                                        6.304e+03
## InjurytureRupture                                                      1.321e+04
## InjurytureSeverance                                                    2.963e+04
## InjurytureSilicosis                                                    7.161e+03
## InjurytureSprain                                                       7.189e+03
## InjurytureStrain                                                       6.624e+03
## InjurytureSyncope                                                      6.658e+03
## InjurytureVascular                                                     9.112e+03
## InjurytureVDT-Related Disease                                          7.408e+03
## InjurytureVision Loss                                                  5.454e+03
## BodyPartAnkle                                                         -6.147e+02
## BodyPartArtificial Appliance                                          -4.214e+02
## BodyPartBody Systems and Multiple Body Systems                        -2.008e+03
## BodyPartBrain                                                          6.945e+03
## BodyPartButtocks                                                      -2.086e+01
## BodyPartChest                                                         -6.016e+02
## BodyPartDisc-Trunk                                                     6.530e+02
## BodyPartEar(S)                                                        -4.247e+02
## BodyPartElbow                                                         -3.192e+02
## BodyPartEyes                                                          -1.249e+03
## BodyPartFacial Bones                                                  -4.397e+02
## BodyPartFinger(S)                                                     -7.353e+02
## BodyPartFoot                                                          -6.491e+02
## BodyPartGreat Toe                                                     -5.559e+02
## BodyPartHand                                                          -4.565e+02
## BodyPartHeart                                                          2.019e+03
## BodyPartHip                                                           -2.398e+02
## BodyPartInsufficient Info to Properly Identify?Unclassified           -1.993e+03
## BodyPartInterl Organs                                                 -1.035e+03
## BodyPartKnee                                                          -3.833e+02
## BodyPartLarynx                                                        -1.484e+02
## BodyPartLower Arm                                                     -8.330e+01
## BodyPartLower Back Area                                               -6.384e+02
## BodyPartLower Leg                                                     -4.373e+02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)            5.127e+02
## BodyPartLungs                                                          5.180e+02
## BodyPartMouth                                                         -5.199e+02
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)   -2.788e+02
## BodyPartMultiple Head Injury                                          -8.343e+02
## BodyPartMultiple Lower Extremities                                    -1.255e+03
## BodyPartMultiple Neck Injury                                          -6.547e+02
## BodyPartMultiple Trunk                                                -1.123e+03
## BodyPartMultiple Upper Extremities                                    -1.473e+03
## BodyPartNo Physical Injury                                            -1.903e+03
## BodyPartNon-Standard Code                                             -1.513e+03
## BodyPartNose                                                          -8.124e+02
## BodyPartNot Available                                                  6.757e+02
## BodyPartPelvis                                                        -3.236e+02
## BodyPartSacrum And Coccyx                                             -4.307e+02
## BodyPartShoulder(S)                                                    1.127e+03
## BodyPartSkull                                                          2.687e+02
## BodyPartSoft Tissue-Head                                               8.865e+02
## BodyPartSoft Tissue-Neck                                               4.945e+02
## BodyPartSpil Cord-Trunk                                               -3.740e+02
## BodyPartTeeth                                                         -1.823e+02
## BodyPartThumb                                                         -5.491e+02
## BodyPartToes                                                          -7.703e+02
## BodyPartTrachea                                                       -2.788e+03
## BodyPartUpper Arm                                                     -1.129e+03
## BodyPartUpper Back Area                                               -2.069e+02
## BodyPartUpper Leg                                                     -3.367e+02
## BodyPartVertebrae                                                      4.494e+02
## BodyPartWhole Body                                                     7.236e+02
## BodyPartWrist                                                         -5.398e+02
##                                                                       Std. Error
## (Intercept)                                                            7.576e+03
## ClaimantTypeMedical Only                                               2.412e+02
## ClaimantTypeReport Only                                                3.326e+02
## Days                                                                   7.241e-02
## InjurytureAll Other Cumulative Injury, NOC                             8.240e+03
## InjurytureAll Other Occupatiol Disease Injury, NOC                     8.985e+03
## InjurytureAll Other Specific Injuries, Noc                             7.551e+03
## InjurytureAmputation                                                   1.411e+04
## InjurytureAngi Pectoris                                                8.989e+03
## InjurytureAsbestosis                                                   7.979e+03
## InjurytureAsphyxiation                                                 9.412e+03
## InjurytureBlack Lung                                                   1.233e+04
## InjurytureBurn                                                         7.569e+03
## InjurytureCancer                                                       1.233e+04
## InjurytureCarpal Tunnel Syndrome                                       7.614e+03
## InjurytureConcussion                                                   7.602e+03
## InjurytureContagious Disease                                           7.627e+03
## InjurytureContusion                                                    7.547e+03
## InjurytureCrushing                                                     7.590e+03
## InjurytureDermatitis                                                   7.563e+03
## InjurytureDislocation                                                  7.627e+03
## InjurytureDust Disease, NOC                                            8.486e+03
## InjurytureElectric Shock                                               7.770e+03
## InjurytureForeign Body                                                 7.560e+03
## InjurytureFracture                                                     7.565e+03
## InjurytureFreezing                                                     1.132e+04
## InjurytureHearing Loss Or Impairment                                   8.152e+03
## InjurytureHeat Prostration                                             7.689e+03
## InjurytureHernia                                                       7.900e+03
## InjurytureInfection                                                    7.616e+03
## InjurytureInflammation                                                 7.566e+03
## InjurytureLaceration                                                   7.549e+03
## InjurytureLoss of Hearing                                              8.189e+03
## InjurytureMental Disorder                                              9.466e+03
## InjurytureMental Stress                                                7.692e+03
## InjurytureMultiple Injuries Including Both Physical and Psychological  8.070e+03
## InjurytureMultiple Physical Injuries Only                              7.558e+03
## InjurytureMyocardial Infarction                                        1.008e+04
## InjurytureNo Physical Injury                                           7.559e+03
## InjurytureNon-Standard Code                                            7.561e+03
## InjurytureNot Available                                                7.606e+03
## InjuryturePoisoning?Chemical (Other Than Metals)                       7.671e+03
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)              7.729e+03
## InjuryturePuncture                                                     7.552e+03
## InjurytureRadiation                                                    8.480e+03
## InjurytureRespiratory Disorders                                        7.598e+03
## InjurytureRupture                                                      7.924e+03
## InjurytureSeverance                                                    8.652e+03
## InjurytureSilicosis                                                    1.232e+04
## InjurytureSprain                                                       7.550e+03
## InjurytureStrain                                                       7.547e+03
## InjurytureSyncope                                                      7.730e+03
## InjurytureVascular                                                     9.622e+03
## InjurytureVDT-Related Disease                                          1.848e+04
## InjurytureVision Loss                                                  8.139e+03
## BodyPartAnkle                                                          7.369e+02
## BodyPartArtificial Appliance                                           7.574e+03
## BodyPartBody Systems and Multiple Body Systems                         1.138e+03
## BodyPartBrain                                                          3.141e+03
## BodyPartButtocks                                                       1.245e+03
## BodyPartChest                                                          8.107e+02
## BodyPartDisc-Trunk                                                     1.047e+03
## BodyPartEar(S)                                                         1.283e+03
## BodyPartElbow                                                          8.091e+02
## BodyPartEyes                                                           7.468e+02
## BodyPartFacial Bones                                                   9.373e+02
## BodyPartFinger(S)                                                      6.997e+02
## BodyPartFoot                                                           7.568e+02
## BodyPartGreat Toe                                                      1.561e+03
## BodyPartHand                                                           7.024e+02
## BodyPartHeart                                                          6.705e+03
## BodyPartHip                                                            9.009e+02
## BodyPartInsufficient Info to Properly Identify?Unclassified            1.035e+03
## BodyPartInterl Organs                                                  1.803e+03
## BodyPartKnee                                                           6.917e+02
## BodyPartLarynx                                                         6.411e+03
## BodyPartLower Arm                                                      7.520e+02
## BodyPartLower Back Area                                                6.839e+02
## BodyPartLower Leg                                                      7.731e+02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)            8.763e+02
## BodyPartLungs                                                          1.282e+03
## BodyPartMouth                                                          1.146e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)    6.828e+02
## BodyPartMultiple Head Injury                                           7.948e+02
## BodyPartMultiple Lower Extremities                                     9.953e+02
## BodyPartMultiple Neck Injury                                           8.636e+02
## BodyPartMultiple Trunk                                                 1.785e+03
## BodyPartMultiple Upper Extremities                                     9.061e+02
## BodyPartNo Physical Injury                                             9.599e+02
## BodyPartNon-Standard Code                                              8.844e+02
## BodyPartNose                                                           1.173e+03
## BodyPartNot Available                                                  6.424e+03
## BodyPartPelvis                                                         1.864e+03
## BodyPartSacrum And Coccyx                                              2.626e+03
## BodyPartShoulder(S)                                                    7.072e+02
## BodyPartSkull                                                          9.959e+02
## BodyPartSoft Tissue-Head                                               9.055e+02
## BodyPartSoft Tissue-Neck                                               7.811e+02
## BodyPartSpil Cord-Trunk                                                1.743e+03
## BodyPartTeeth                                                          1.536e+03
## BodyPartThumb                                                          7.867e+02
## BodyPartToes                                                           1.093e+03
## BodyPartTrachea                                                        5.403e+03
## BodyPartUpper Arm                                                      8.455e+02
## BodyPartUpper Back Area                                                9.807e+02
## BodyPartUpper Leg                                                      9.571e+02
## BodyPartVertebrae                                                      5.374e+03
## BodyPartWhole Body                                                     2.142e+03
## BodyPartWrist                                                          7.295e+02
##                                                                       t value
## (Intercept)                                                             1.905
## ClaimantTypeMedical Only                                              -88.807
## ClaimantTypeReport Only                                               -65.385
## Days                                                                   24.493
## InjurytureAll Other Cumulative Injury, NOC                              0.959
## InjurytureAll Other Occupatiol Disease Injury, NOC                      0.802
## InjurytureAll Other Specific Injuries, Noc                              0.778
## InjurytureAmputation                                                    0.533
## InjurytureAngi Pectoris                                                 0.877
## InjurytureAsbestosis                                                    0.507
## InjurytureAsphyxiation                                                  0.755
## InjurytureBlack Lung                                                    0.566
## InjurytureBurn                                                          0.866
## InjurytureCancer                                                        0.330
## InjurytureCarpal Tunnel Syndrome                                        0.897
## InjurytureConcussion                                                    1.071
## InjurytureContagious Disease                                            0.768
## InjurytureContusion                                                     0.903
## InjurytureCrushing                                                      0.939
## InjurytureDermatitis                                                    0.845
## InjurytureDislocation                                                   0.857
## InjurytureDust Disease, NOC                                             0.748
## InjurytureElectric Shock                                                0.663
## InjurytureForeign Body                                                  0.788
## InjurytureFracture                                                      1.179
## InjurytureFreezing                                                      0.387
## InjurytureHearing Loss Or Impairment                                    0.749
## InjurytureHeat Prostration                                              0.665
## InjurytureHernia                                                        0.955
## InjurytureInfection                                                     0.865
## InjurytureInflammation                                                  0.963
## InjurytureLaceration                                                    0.899
## InjurytureLoss of Hearing                                               0.819
## InjurytureMental Disorder                                               1.145
## InjurytureMental Stress                                                -0.035
## InjurytureMultiple Injuries Including Both Physical and Psychological   0.014
## InjurytureMultiple Physical Injuries Only                               0.998
## InjurytureMyocardial Infarction                                         0.617
## InjurytureNo Physical Injury                                            0.906
## InjurytureNon-Standard Code                                             0.633
## InjurytureNot Available                                                 1.003
## InjuryturePoisoning?Chemical (Other Than Metals)                        0.804
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)               0.829
## InjuryturePuncture                                                      0.877
## InjurytureRadiation                                                     1.516
## InjurytureRespiratory Disorders                                         0.830
## InjurytureRupture                                                       1.668
## InjurytureSeverance                                                     3.424
## InjurytureSilicosis                                                     0.581
## InjurytureSprain                                                        0.952
## InjurytureStrain                                                        0.878
## InjurytureSyncope                                                       0.861
## InjurytureVascular                                                      0.947
## InjurytureVDT-Related Disease                                           0.401
## InjurytureVision Loss                                                   0.670
## BodyPartAnkle                                                          -0.834
## BodyPartArtificial Appliance                                           -0.056
## BodyPartBody Systems and Multiple Body Systems                         -1.765
## BodyPartBrain                                                           2.211
## BodyPartButtocks                                                       -0.017
## BodyPartChest                                                          -0.742
## BodyPartDisc-Trunk                                                      0.623
## BodyPartEar(S)                                                         -0.331
## BodyPartElbow                                                          -0.394
## BodyPartEyes                                                           -1.672
## BodyPartFacial Bones                                                   -0.469
## BodyPartFinger(S)                                                      -1.051
## BodyPartFoot                                                           -0.858
## BodyPartGreat Toe                                                      -0.356
## BodyPartHand                                                           -0.650
## BodyPartHeart                                                           0.301
## BodyPartHip                                                            -0.266
## BodyPartInsufficient Info to Properly Identify?Unclassified            -1.925
## BodyPartInterl Organs                                                  -0.574
## BodyPartKnee                                                           -0.554
## BodyPartLarynx                                                         -0.023
## BodyPartLower Arm                                                      -0.111
## BodyPartLower Back Area                                                -0.933
## BodyPartLower Leg                                                      -0.566
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             0.585
## BodyPartLungs                                                           0.404
## BodyPartMouth                                                          -0.454
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)    -0.408
## BodyPartMultiple Head Injury                                           -1.050
## BodyPartMultiple Lower Extremities                                     -1.260
## BodyPartMultiple Neck Injury                                           -0.758
## BodyPartMultiple Trunk                                                 -0.629
## BodyPartMultiple Upper Extremities                                     -1.626
## BodyPartNo Physical Injury                                             -1.982
## BodyPartNon-Standard Code                                              -1.711
## BodyPartNose                                                           -0.692
## BodyPartNot Available                                                   0.105
## BodyPartPelvis                                                         -0.174
## BodyPartSacrum And Coccyx                                              -0.164
## BodyPartShoulder(S)                                                     1.594
## BodyPartSkull                                                           0.270
## BodyPartSoft Tissue-Head                                                0.979
## BodyPartSoft Tissue-Neck                                                0.633
## BodyPartSpil Cord-Trunk                                                -0.215
## BodyPartTeeth                                                          -0.119
## BodyPartThumb                                                          -0.698
## BodyPartToes                                                           -0.705
## BodyPartTrachea                                                        -0.516
## BodyPartUpper Arm                                                      -1.335
## BodyPartUpper Back Area                                                -0.211
## BodyPartUpper Leg                                                      -0.352
## BodyPartVertebrae                                                       0.084
## BodyPartWhole Body                                                      0.338
## BodyPartWrist                                                          -0.740
##                                                                       Pr(>|t|)
## (Intercept)                                                           0.056736
## ClaimantTypeMedical Only                                               < 2e-16
## ClaimantTypeReport Only                                                < 2e-16
## Days                                                                   < 2e-16
## InjurytureAll Other Cumulative Injury, NOC                            0.337513
## InjurytureAll Other Occupatiol Disease Injury, NOC                    0.422310
## InjurytureAll Other Specific Injuries, Noc                            0.436486
## InjurytureAmputation                                                  0.594373
## InjurytureAngi Pectoris                                               0.380447
## InjurytureAsbestosis                                                  0.612352
## InjurytureAsphyxiation                                                0.450102
## InjurytureBlack Lung                                                  0.571342
## InjurytureBurn                                                        0.386277
## InjurytureCancer                                                      0.741142
## InjurytureCarpal Tunnel Syndrome                                      0.369791
## InjurytureConcussion                                                  0.284219
## InjurytureContagious Disease                                          0.442325
## InjurytureContusion                                                   0.366632
## InjurytureCrushing                                                    0.347678
## InjurytureDermatitis                                                  0.398220
## InjurytureDislocation                                                 0.391248
## InjurytureDust Disease, NOC                                           0.454476
## InjurytureElectric Shock                                              0.507169
## InjurytureForeign Body                                                0.430933
## InjurytureFracture                                                    0.238513
## InjurytureFreezing                                                    0.698869
## InjurytureHearing Loss Or Impairment                                  0.453957
## InjurytureHeat Prostration                                            0.506338
## InjurytureHernia                                                      0.339545
## InjurytureInfection                                                   0.387054
## InjurytureInflammation                                                0.335356
## InjurytureLaceration                                                  0.368838
## InjurytureLoss of Hearing                                             0.413053
## InjurytureMental Disorder                                             0.252412
## InjurytureMental Stress                                               0.972379
## InjurytureMultiple Injuries Including Both Physical and Psychological 0.989019
## InjurytureMultiple Physical Injuries Only                             0.318500
## InjurytureMyocardial Infarction                                       0.537370
## InjurytureNo Physical Injury                                          0.364857
## InjurytureNon-Standard Code                                           0.526664
## InjurytureNot Available                                               0.315908
## InjuryturePoisoning?Chemical (Other Than Metals)                      0.421448
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)             0.407377
## InjuryturePuncture                                                    0.380527
## InjurytureRadiation                                                   0.129434
## InjurytureRespiratory Disorders                                       0.406721
## InjurytureRupture                                                     0.095380
## InjurytureSeverance                                                   0.000617
## InjurytureSilicosis                                                   0.561170
## InjurytureSprain                                                      0.341011
## InjurytureStrain                                                      0.380106
## InjurytureSyncope                                                     0.389025
## InjurytureVascular                                                    0.343632
## InjurytureVDT-Related Disease                                         0.688503
## InjurytureVision Loss                                                 0.502777
## BodyPartAnkle                                                         0.404140
## BodyPartArtificial Appliance                                          0.955628
## BodyPartBody Systems and Multiple Body Systems                        0.077644
## BodyPartBrain                                                         0.027030
## BodyPartButtocks                                                      0.986633
## BodyPartChest                                                         0.458030
## BodyPartDisc-Trunk                                                    0.533003
## BodyPartEar(S)                                                        0.740603
## BodyPartElbow                                                         0.693220
## BodyPartEyes                                                          0.094514
## BodyPartFacial Bones                                                  0.639002
## BodyPartFinger(S)                                                     0.293278
## BodyPartFoot                                                          0.391073
## BodyPartGreat Toe                                                     0.721728
## BodyPartHand                                                          0.515782
## BodyPartHeart                                                         0.763337
## BodyPartHip                                                           0.790093
## BodyPartInsufficient Info to Properly Identify?Unclassified           0.054199
## BodyPartInterl Organs                                                 0.566017
## BodyPartKnee                                                          0.579503
## BodyPartLarynx                                                        0.981529
## BodyPartLower Arm                                                     0.911799
## BodyPartLower Back Area                                               0.350606
## BodyPartLower Leg                                                     0.571676
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)           0.558451
## BodyPartLungs                                                         0.686253
## BodyPartMouth                                                         0.650177
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)   0.683069
## BodyPartMultiple Head Injury                                          0.293869
## BodyPartMultiple Lower Extremities                                    0.207497
## BodyPartMultiple Neck Injury                                          0.448434
## BodyPartMultiple Trunk                                                0.529099
## BodyPartMultiple Upper Extremities                                    0.104042
## BodyPartNo Physical Injury                                            0.047431
## BodyPartNon-Standard Code                                             0.087176
## BodyPartNose                                                          0.488719
## BodyPartNot Available                                                 0.916234
## BodyPartPelvis                                                        0.862199
## BodyPartSacrum And Coccyx                                             0.869700
## BodyPartShoulder(S)                                                   0.111023
## BodyPartSkull                                                         0.787341
## BodyPartSoft Tissue-Head                                              0.327532
## BodyPartSoft Tissue-Neck                                              0.526681
## BodyPartSpil Cord-Trunk                                               0.830098
## BodyPartTeeth                                                         0.905487
## BodyPartThumb                                                         0.485157
## BodyPartToes                                                          0.481107
## BodyPartTrachea                                                       0.605885
## BodyPartUpper Arm                                                     0.181824
## BodyPartUpper Back Area                                               0.832935
## BodyPartUpper Leg                                                     0.724998
## BodyPartVertebrae                                                     0.933367
## BodyPartWhole Body                                                    0.735438
## BodyPartWrist                                                         0.459265
##                                                                          
## (Intercept)                                                           .  
## ClaimantTypeMedical Only                                              ***
## ClaimantTypeReport Only                                               ***
## Days                                                                  ***
## InjurytureAll Other Cumulative Injury, NOC                               
## InjurytureAll Other Occupatiol Disease Injury, NOC                       
## InjurytureAll Other Specific Injuries, Noc                               
## InjurytureAmputation                                                     
## InjurytureAngi Pectoris                                                  
## InjurytureAsbestosis                                                     
## InjurytureAsphyxiation                                                   
## InjurytureBlack Lung                                                     
## InjurytureBurn                                                           
## InjurytureCancer                                                         
## InjurytureCarpal Tunnel Syndrome                                         
## InjurytureConcussion                                                     
## InjurytureContagious Disease                                             
## InjurytureContusion                                                      
## InjurytureCrushing                                                       
## InjurytureDermatitis                                                     
## InjurytureDislocation                                                    
## InjurytureDust Disease, NOC                                              
## InjurytureElectric Shock                                                 
## InjurytureForeign Body                                                   
## InjurytureFracture                                                       
## InjurytureFreezing                                                       
## InjurytureHearing Loss Or Impairment                                     
## InjurytureHeat Prostration                                               
## InjurytureHernia                                                         
## InjurytureInfection                                                      
## InjurytureInflammation                                                   
## InjurytureLaceration                                                     
## InjurytureLoss of Hearing                                                
## InjurytureMental Disorder                                                
## InjurytureMental Stress                                                  
## InjurytureMultiple Injuries Including Both Physical and Psychological    
## InjurytureMultiple Physical Injuries Only                                
## InjurytureMyocardial Infarction                                          
## InjurytureNo Physical Injury                                             
## InjurytureNon-Standard Code                                              
## InjurytureNot Available                                                  
## InjuryturePoisoning?Chemical (Other Than Metals)                         
## InjuryturePoisoning?General (NOT OD or Cumulative Injury)                
## InjuryturePuncture                                                       
## InjurytureRadiation                                                      
## InjurytureRespiratory Disorders                                          
## InjurytureRupture                                                     .  
## InjurytureSeverance                                                   ***
## InjurytureSilicosis                                                      
## InjurytureSprain                                                         
## InjurytureStrain                                                         
## InjurytureSyncope                                                        
## InjurytureVascular                                                       
## InjurytureVDT-Related Disease                                            
## InjurytureVision Loss                                                    
## BodyPartAnkle                                                            
## BodyPartArtificial Appliance                                             
## BodyPartBody Systems and Multiple Body Systems                        .  
## BodyPartBrain                                                         *  
## BodyPartButtocks                                                         
## BodyPartChest                                                            
## BodyPartDisc-Trunk                                                       
## BodyPartEar(S)                                                           
## BodyPartElbow                                                            
## BodyPartEyes                                                          .  
## BodyPartFacial Bones                                                     
## BodyPartFinger(S)                                                        
## BodyPartFoot                                                             
## BodyPartGreat Toe                                                        
## BodyPartHand                                                             
## BodyPartHeart                                                            
## BodyPartHip                                                              
## BodyPartInsufficient Info to Properly Identify?Unclassified           .  
## BodyPartInterl Organs                                                    
## BodyPartKnee                                                             
## BodyPartLarynx                                                           
## BodyPartLower Arm                                                        
## BodyPartLower Back Area                                                  
## BodyPartLower Leg                                                        
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              
## BodyPartLungs                                                            
## BodyPartMouth                                                            
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      
## BodyPartMultiple Head Injury                                             
## BodyPartMultiple Lower Extremities                                       
## BodyPartMultiple Neck Injury                                             
## BodyPartMultiple Trunk                                                   
## BodyPartMultiple Upper Extremities                                       
## BodyPartNo Physical Injury                                            *  
## BodyPartNon-Standard Code                                             .  
## BodyPartNose                                                             
## BodyPartNot Available                                                    
## BodyPartPelvis                                                           
## BodyPartSacrum And Coccyx                                                
## BodyPartShoulder(S)                                                      
## BodyPartSkull                                                            
## BodyPartSoft Tissue-Head                                                 
## BodyPartSoft Tissue-Neck                                                 
## BodyPartSpil Cord-Trunk                                                  
## BodyPartTeeth                                                            
## BodyPartThumb                                                            
## BodyPartToes                                                             
## BodyPartTrachea                                                          
## BodyPartUpper Arm                                                        
## BodyPartUpper Back Area                                                  
## BodyPartUpper Leg                                                        
## BodyPartVertebrae                                                        
## BodyPartWhole Body                                                       
## BodyPartWrist                                                            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 16870 on 71385 degrees of freedom
## Multiple R-squared:  0.1443, Adjusted R-squared:  0.143 
## F-statistic: 111.5 on 108 and 71385 DF,  p-value: < 2.2e-16

Modelo Predictivo

datos_m <- data.frame(Days = 100, ClaimantType= "Indemnity", Injuryture = "Strain", BodyPart = "Vertebrae")
predict(regresion,datos_m)
##       1 
## 21685.6

Árbol de Decisión

Exploramos los datos

summary(datos)
##     ClaimID           TotalPaid       TotalReserves     TotalRecovery      
##  Min.   :  650915   Min.   :   -270   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  811125   1st Qu.:     60   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  844626   Median :    235   Median :      0   Median :     0.00  
##  Mean   :10149151   Mean   :   6746   Mean   :   2233   Mean   :    68.88  
##  3rd Qu.:22716506   3rd Qu.:    938   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203891   Max.   :4527291   Max.   :2069575   Max.   :130541.03  
##  IndemnityPaid      OtherPaid       ClaimStatus        IncidentDate      
##  Min.   :  -475   Min.   :  -7820   Length:134004      Length:134004     
##  1st Qu.:     0   1st Qu.:     58   Class :character   Class :character  
##  Median :     0   Median :    230   Mode  :character   Mode  :character  
##  Mean   :  3061   Mean   :   3685                                        
##  3rd Qu.:     0   3rd Qu.:    855                                        
##  Max.   :640732   Max.   :4129915                                        
##  IncidentDescription ReturnToWorkDate   AverageWeeklyWage  ClaimantOpenedDate
##  Length:134004       Length:134004      Length:134004      Length:134004     
##  Class :character    Class :character   Class :character   Class :character  
##  Mode  :character    Mode  :character   Mode  :character   Mode  :character  
##                                                                              
##                                                                              
##                                                                              
##  ClaimantClosedDate EmployerNotificationDate ReceivedDate      
##  Length:134004      Length:134004            Length:134004     
##  Class :character   Class :character         Class :character  
##  Mode  :character   Mode  :character         Mode  :character  
##                                                                
##                                                                
##                                                                
##     IsDenied       ClaimantAge_at_DOI    Gender          ClaimantType      
##  Min.   :0.00000   Length:134004      Length:134004      Length:134004     
##  1st Qu.:0.00000   Class :character   Class :character   Class :character  
##  Median :0.00000   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :0.04474                                                           
##  3rd Qu.:0.00000                                                           
##  Max.   :1.00000                                                           
##   Injuryture        BodyPartRegion       BodyPart        
##  Length:134004      Length:134004      Length:134004     
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
## 
#count(datos,ClaimID, sort=TRUE)
#count(datos,TotalPaid, sort=TRUE)
#count(datos,TotalReserves, sort=TRUE)
#count(datos,TotalRecovery, sort=TRUE)
#count(datos,IndemnityPaid, sort=TRUE)
#count(datos,OtherPaid, sort=TRUE)
#count(datos,ClaimStatus, sort=TRUE)
#count(datos,IncidentDate, sort=TRUE)
#count(datos,IncidentDescription, sort=TRUE)
#count(datos,ReturnToWorkDate, sort=TRUE)
#count(datos,AverageWeeklyWage, sort=TRUE)
#count(datos,ClaimantOpenedDate, sort=TRUE)
#count(datos,ClaimantClosedDate, sort=TRUE)
#count(datos,Gender, sort=TRUE)
#count(datos,ClaimantType, sort=TRUE)
#count(datos,Injuryture, sort=TRUE)
#count(datos,BodyPartRegion, sort=TRUE)
#count(datos,BodyPart, sort=TRUE)

Observaciones: 1. Tenemos NAs en la base de datos 2. En el género hay una opción de no disponible

Limpiamos los datos

#Seleccionamos los datos que nos interesan
ad<- datos[,c("BodyPartRegion","Gender","IsDenied","ClaimStatus")]

#Cuanto Nas tenemos 
sum(is.na(ad))
## [1] 0
#Cuantos por variable 
sapply(ad,function(x) sum(is.na(x)))
## BodyPartRegion         Gender       IsDenied    ClaimStatus 
##              0              0              0              0
#eliminar NA
ad <- na.omit(ad)

str(ad)
## 'data.frame':    134004 obs. of  4 variables:
##  $ BodyPartRegion: chr  "Trunk" "Trunk" "Upper Extremities" "Upper Extremities" ...
##  $ Gender        : chr  "Male" "Male" "Male" "Male" ...
##  $ IsDenied      : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ ClaimStatus   : chr  "C" "C" "C" "C" ...
#conertir las variables a factor las que sean categoricas 
ad$BodyPartRegion <- as.factor(ad$BodyPartRegion)
ad$Gender <- as.factor(ad$Gender)
ad$IsDenied <- as.factor(ad$IsDenied)
str(ad)
## 'data.frame':    134004 obs. of  4 variables:
##  $ BodyPartRegion: Factor w/ 8 levels "Head","Lower Extremities",..: 7 7 8 8 7 2 7 8 3 3 ...
##  $ Gender        : Factor w/ 3 levels "Female","Male",..: 2 2 2 2 1 2 1 2 1 2 ...
##  $ IsDenied      : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
##  $ ClaimStatus   : chr  "C" "C" "C" "C" ...

Gráficamos el Árbol de Decisiones

arbol <- rpart(formula = Gender ~ ., data= ad)
arbol
## n= 134004 
## 
## node), split, n, loss, yval, (yprob)
##       * denotes terminal node
## 
##  1) root 134004 68879 Male (0.441755470 0.485992955 0.072251575)  
##    2) BodyPartRegion=Head,Lower Extremities,Multiple Body Parts,Neck,Not Available,Trunk,Upper Extremities 121353 59449 Male (0.484001220 0.510115119 0.005883662)  
##      4) BodyPartRegion=Lower Extremities,Multiple Body Parts,Neck,Not Available,Upper Extremities 87298 43365 Female (0.503253225 0.491202548 0.005544228)  
##        8) IsDenied=1 4491  1874 Female (0.582720998 0.413048319 0.004230684) *
##        9) IsDenied=0 82807 41491 Female (0.498943326 0.495441207 0.005615467)  
##         18) BodyPartRegion=Lower Extremities,Multiple Body Parts 41527 19959 Female (0.519372938 0.476003564 0.004623498) *
##         19) BodyPartRegion=Neck,Not Available,Upper Extremities 41280 20021 Male (0.478391473 0.514995155 0.006613372) *
##      5) BodyPartRegion=Head,Trunk 34055 15032 Male (0.434649831 0.558596388 0.006753781) *
##    3) BodyPartRegion=Non-Standard Code 12651  3683 Not Available (0.036518852 0.254604379 0.708876769) *
rpart.plot(arbol)

Análisis de Clusters

Nuevo df para el análisis de clusters

bd <- as.data.frame(claims)

Exploramos la base de datos

summary(bd)
##     ClaimID           TotalPaid       TotalReserves     TotalRecovery      
##  Min.   :  650915   Min.   :    -22   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  814283   1st Qu.:     82   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  845571   Median :    281   Median :      0   Median :     0.00  
##  Mean   :12146395   Mean   :   8368   Mean   :   3365   Mean   :    68.22  
##  3rd Qu.:22725794   3rd Qu.:   1229   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203891   Max.   :4527291   Max.   :2069575   Max.   :130541.03  
##                                                                            
##  IndemnityPaid      OtherPaid       ClaimStatus         IncidentDate       
##  Min.   :  -475   Min.   :    -22   Length:88833       Min.   :1968-09-27  
##  1st Qu.:     0   1st Qu.:     79   Class :character   1st Qu.:2003-08-05  
##  Median :     0   Median :    275   Mode  :character   Median :2007-02-27  
##  Mean   :  3698   Mean   :   4670                      Mean   :2006-10-11  
##  3rd Qu.:     0   3rd Qu.:   1126                      3rd Qu.:2010-11-17  
##  Max.   :640732   Max.   :4129915                      Max.   :2014-06-27  
##                                                                            
##  IncidentDescription ReturnToWorkDate     AverageWeeklyWage  
##  Length:88833        Min.   :1984-01-01   Min.   :      0.0  
##  Class :character    1st Qu.:2005-12-09   1st Qu.:    300.0  
##  Mode  :character    Median :2009-04-29   Median :    502.6  
##                      Mean   :2008-07-19   Mean   :    629.0  
##                      3rd Qu.:2012-02-14   3rd Qu.:    684.8  
##                      Max.   :2015-05-07   Max.   :2024000.0  
##                      NA's   :30493        NA's   :50480      
##  ClaimantOpenedDate   ClaimantClosedDate   EmployerNotificationDate
##  Min.   :1968-09-27   Min.   :1999-06-01   Min.   :1972-09-10      
##  1st Qu.:2003-09-18   1st Qu.:2005-10-04   1st Qu.:2004-03-31      
##  Median :2007-04-18   Median :2008-12-11   Median :2007-09-26      
##  Mean   :2006-11-22   Mean   :2008-10-09   Mean   :2007-10-07      
##  3rd Qu.:2010-12-13   3rd Qu.:2011-06-10   3rd Qu.:2011-06-01      
##  Max.   :2014-06-30   Max.   :2014-06-30   Max.   :9988-02-21      
##                       NA's   :4637         NA's   :11756           
##   ReceivedDate           IsDenied       ClaimantAge_at_DOI    Gender         
##  Min.   :1968-09-27   Min.   :0.00000   Min.   : 0.00      Length:88833      
##  1st Qu.:2003-09-16   1st Qu.:0.00000   1st Qu.:33.00      Class :character  
##  Median :2007-03-28   Median :0.00000   Median :42.00      Mode  :character  
##  Mean   :2007-01-28   Mean   :0.05227   Mean   :42.05                        
##  3rd Qu.:2010-12-17   3rd Qu.:0.00000   3rd Qu.:51.00                        
##  Max.   :5202-01-10   Max.   :1.00000   Max.   :94.00                        
##                                                                              
##  ClaimantType        Injuryture        BodyPartRegion       BodyPart        
##  Length:88833       Length:88833       Length:88833       Length:88833      
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
## 
#count(bd,ClaimantOpenedDate,sort = TRUE)
#count(bd,ClaimantClosedDate,sort = TRUE)

Observaciones 1. ClaimID, TotalPaid, TotalReserves y TotalRecovery son variables de tipo character y necesitan ser cambiados a numeric. 2. Existen negativos en TotalPaid.

Modificamos el tipo de variable

bd$TotalReserves<-as.numeric(bd$TotalReserves)
bd$TotalPaid<-as.numeric(bd$TotalPaid)
bd$TotalRecovery<-as.numeric(bd$TotalRecovery)

Eliminamos los negativos de total paid

bd <-bd[bd$TotalPaid>0,]

Realizamos cálculos importantes

# Obtener el Tiempo de Procesamiento en días.
bd<-mutate(bd, TiempoProcesamiento=difftime(bd$ClaimantClosedDate,bd$ClaimantOpenedDate, units="days"))

# Obtener el Costo Total
bd <- mutate(bd,CostoTotal=TotalReserves+TotalPaid-TotalRecovery)

Creamos una tabla nueva con las variables de interes: Tiempo de Procesamiento, Costo Total y ClaimID

nueva_bd<-select(bd,ClaimID,TiempoProcesamiento,CostoTotal)

Realizamos las modificaciones necesarias a nuestro data frame

# Cambiar el tipo de variable TiempoProcesamiento de difftime-numeric.
nueva_bd$TiempoProcesamiento <- as.numeric(nueva_bd$TiempoProcesamiento)

#Eliminamos los na
nueva_bd <- na.omit(nueva_bd)

Guardamos la columna de ID en una variable temporal y la eliminamos del conjunto de datos

ids <- nueva_bd$ClaimID
nueva_bd <- nueva_bd[, -1]

Determinamos el número de clusters optimo

wss <- numeric(10)
for (i in 1:10) {
  kmeans_result <- kmeans(nueva_bd, centers = i)
  wss[i] <- kmeans_result$tot.withinss
}

plot(1:10, wss, type = "b", xlab = "Número de Clusters (k)", ylab = "Suma de Cuadrados Dentro del Clúster (WSS)")

Realizamos K-means

k_optimo <- 4

kmeans_result <- kmeans(nueva_bd, centers = k_optimo)
#kmeans_result

resultados <- data.frame(ID = ids, Cluster = kmeans_result$cluster)
head(resultados)
##       ID Cluster
## 1 650915       3
## 3 650917       3
## 4 650918       3
## 5 650919       1
## 6 650920       3
## 8 650929       3

Visualizamos los resultados

fviz_cluster(kmeans_result, data = nueva_bd)

ShinnyApp

Shinyapp

LS0tCnRpdGxlOiAiQWN0aXZpZGFkIDQuNiIKYXV0aG9yOiAiRW5pZ21hIEFuYWx5dGljcyIKZGF0ZTogIjIwMjMtMTAtMDYiCm91dHB1dDogCiAgaHRtbF9kb2N1bWVudDoKICAgIHRvYzogdHJ1ZQogICAgdG9jX2Zsb2F0OiB0cnVlCiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlCiAgICB0aGVtZTogdW5pdGVkCiAgICBoaWdobGlnaHQ6ICJ6ZW5idXJuIgogICAgc21vb3RoX3Njcm9sbDogdHJ1ZQotLS0KCgojIDxzcGFuIHN0eWxlPSJjb2xvcjogb3JhbmdlOyI+IFdvcmtlcsK0cyBj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