Actividad Integradora

Importar la base de datos

BASE <- read.csv("/Users/oscarcamilo/Documents/Tec MTY/ANALÍTICA PARA NEGOCIOS/MODULO 4/EVALUACIÓN/base_act_4.6.csv")

1. Clusters

1.1 Librerias

library(dplyr)

1.2 Crear base

df<- read.csv("/Users/oscarcamilo/Documents/Tec MTY/ANALÍTICA PARA NEGOCIOS/MODULO 4/EVALUACIÓN/base_act_4.6.csv")

1.3 Limpieza extra de base

df <- df[complete.cases(df), ]
columnas_a_eliminar <- c("IncidentDate", "IncidentDescription", "ReturnToWorkDate", 
                         "ClaimantOpenedDate", "ClaimantClosedDate", "EmployerNotificationDate",
                         "ReceivedDate", "Gender", "ClaimantType", "InjuryNature",
                         "BodyPartRegion", "BodyPart")
df <- df %>%
  select(-one_of(columnas_a_eliminar))
columnas_constantes <- names(df)[apply(df, 2, var) == 0]
df <- df[, -which(names(df) %in% columnas_constantes)]
resultados_pca <- prcomp(df, scale = TRUE)

1.4 Determinar numero de grupos

grupos <- 4

1.5 Realizar clasificación

segmentos <- kmeans(df,grupos)

1.6 Asignación de grupos

asignación <- cbind(df,cluster=segmentos$cluster)

1.7 Graficar resultados

library (ggplot2)
library(factoextra)
fviz_cluster(segmentos,data=df,palette=c("red","blue","darkgreen","yellow"),
             ellipse.type="euclid",
             star.plot= T,
             repel=T,
             ggtheme=theme())

#6.Optimizar cantidad de grupos
library (cluster)
library (data.table)
set.seed (123)
optimización <- clusGap(df,FUN=kmeans, nstart=1, K.max=7)
plot(optimización, xlab="Número de clusters k")

2. Árbol de decisiones

2.1 Librerías y base de datos

library(rpart)
library(rpart.plot)
bd <- BASE

2.2 Entender

summary(bd)
##     ClaimID           TotalPaid        TotalReserves     TotalRecovery      
##  Min.   :  777624   Min.   :  777624   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  794257   1st Qu.:  794257   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  811232   Median :  811232   Median :      0   Median :     0.00  
##  Mean   : 2759736   Mean   : 2759736   Mean   :   1931   Mean   :    67.77  
##  3rd Qu.:  830786   3rd Qu.:  830786   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203364   Max.   :62203364   Max.   :1529053   Max.   :130335.75  
##                                                                             
##  IndemnityPaid      OtherPaid        ClaimStatus       IncidentDate      
##  Min.   :  -475   Min.   :  -7820   Min.   :  777624   Length:55996      
##  1st Qu.:     0   1st Qu.:     62   1st Qu.:  794257   Class :character  
##  Median :     0   Median :    233   Median :  811232   Mode  :character  
##  Mean   :  3604   Mean   :   3912   Mean   : 2759736                     
##  3rd Qu.:     0   3rd Qu.:    831   3rd Qu.:  830786                     
##  Max.   :640732   Max.   :4129915   Max.   :62203364                     
##                                                                          
##  IncidentDescription ReturnToWorkDate   AverageWeeklyWage  ClaimantOpenedDate
##  Length:55996        Length:55996       Min.   :    0.23   Length:55996      
##  Class :character    Class :character   1st Qu.:  266.80   Class :character  
##  Mode  :character    Mode  :character   Median :  471.92   Mode  :character  
##                                         Mean   :  479.64                     
##                                         3rd Qu.:  625.10                     
##                                         Max.   :96666.80                     
##                                         NA's   :35942                        
##  ClaimantClosedDate EmployerNotificationDate ReceivedDate      
##  Length:55996       Length:55996             Length:55996      
##  Class :character   Class :character         Class :character  
##  Mode  :character   Mode  :character         Mode  :character  
##                                                                
##                                                                
##                                                                
##                                                                
##     IsDenied       ClaimantAge_at_DOI    Gender          ClaimantType      
##  Min.   :0.00000   Min.   :-7550.00   Length:55996       Length:55996      
##  1st Qu.:0.00000   1st Qu.:   32.00   Class :character   Class :character  
##  Median :0.00000   Median :   42.00   Mode  :character   Mode  :character  
##  Mean   :0.04354   Mean   :   38.34                                        
##  3rd Qu.:0.00000   3rd Qu.:   50.00                                        
##  Max.   :1.00000   Max.   :   94.00                                        
##                    NA's   :20920                                           
##  InjuryNature       BodyPartRegion       BodyPart         BillReviewALE     
##  Length:55996       Length:55996       Length:55996       Min.   : -456.00  
##  Class :character   Class :character   Class :character   1st Qu.:    8.25  
##  Mode  :character   Mode  :character   Mode  :character   Median :   24.00  
##                                                           Mean   :  189.89  
##                                                           3rd Qu.:   65.20  
##                                                           Max.   :56475.30  
##                                                           NA's   :31790     
##     Hospital         PhysicianOutpatient       Rx          
##  Min.   : -12570.4   Min.   :   -549.5   Min.   :  -469.5  
##  1st Qu.:    202.5   1st Qu.:    107.3   1st Qu.:    22.7  
##  Median :    580.5   Median :    222.7   Median :    60.0  
##  Mean   :   4773.9   Mean   :   1762.7   Mean   :  1459.0  
##  3rd Qu.:   2298.5   3rd Qu.:    689.9   3rd Qu.:   178.3  
##  Max.   :2759604.0   Max.   :1481468.5   Max.   :631635.5  
##  NA's   :35042       NA's   :3892        NA's   :36229     
##  Total_Incurred_Cost_Claim Total_Paid_calc   tiempo_de_procesamiento_days
##  Min.   : -10400           Min.   :    -82   Min.   :-24649              
##  1st Qu.:     61           1st Qu.:     65   1st Qu.:   379              
##  Median :    233           Median :    237   Median :  1190              
##  Mean   :   9379           Mean   :   7515   Mean   :  1415              
##  3rd Qu.:    885           3rd Qu.:    918   3rd Qu.:  1897              
##  Max.   :4734750           Max.   :4527291   Max.   : 12346              
##                                              NA's   :623
#count(bd, ClaimID, sort = TRUE)
#count(bd, TotalReserves, sort = TRUE)
#count(bd, TotalRecovery, sort = TRUE)
#count(bd, IndemnityPaid, sort = TRUE)
#count(bd, OtherPaid, sort = TRUE)
#count(bd, IncidentDescription, sort = TRUE)
#count(bd, ReturnToWorkDate, sort = TRUE)
#count(bd, AverageWeeklyWage, sort = TRUE)
#count(bd, ClaimantOpenedDate, sort = TRUE)
#count(bd, ClaimantClosedDate, sort = TRUE)
#count(bd, EmployerNotificationDate, sort = TRUE)
#count(bd, ReceivedDate, sort = TRUE)
#count(bd, IsDenied, sort = TRUE)
#count(bd, ClaimantAge_at_DOI, sort = TRUE)
#count(bd, Gender, sort = TRUE)
#count(bd, ClaimantType, sort = TRUE)
#count(bd, InjuryNature, sort = TRUE)
#count(bd, BodyPartRegion, sort = TRUE)
#count(bd, BodyPart, sort = TRUE)
#count(bd, Hospital, sort = TRUE)
#count(bd, PhysicianOutpatient, sort = TRUE)
#count(bd, Total_Incurred_Cost_Claim, sort = TRUE)
#count(bd, Total_Paid_calc, sort = TRUE)
#count(bd, tiempo_de_procesamiento_days, sort = TRUE)

2.3 Limpiar base de datos

# Extraer las variables de interés
db <- bd[,c("ClaimantAge_at_DOI", "Gender", "ClaimantType", "BodyPart", "Total_Paid_calc", "tiempo_de_procesamiento_days")]

# ¿Cuántos NA tengo por variable?
sapply(db, function(x) sum(is.na(x)))
##           ClaimantAge_at_DOI                       Gender 
##                        20920                            0 
##                 ClaimantType                     BodyPart 
##                            0                            0 
##              Total_Paid_calc tiempo_de_procesamiento_days 
##                            0                          623
# Eliminar NA
db <- na.omit(db)

# Convertir las variables categóricas en factores
db$ClaimantAge_at_DOI <- as.factor(db$ClaimantAge_at_DOI)
db$Gender <- as.factor(db$Gender)
db$ClaimantType <- as.factor(db$ClaimantType)
db$BodyPart <- as.factor(db$BodyPart)
db$Total_Paid_calc <- as.factor(db$Total_Paid_calc)
db$tiempo_de_procesamiento_days <- as.factor(db$tiempo_de_procesamiento_days)

str(db)
## 'data.frame':    34454 obs. of  6 variables:
##  $ ClaimantAge_at_DOI          : Factor w/ 117 levels "-7550","-7165",..: 77 76 61 57 82 77 66 76 68 79 ...
##  $ Gender                      : Factor w/ 3 levels "Female","Male",..: 1 1 1 1 1 2 1 1 1 2 ...
##  $ ClaimantType                : Factor w/ 3 levels "Indemnity","Medical Only",..: 2 1 1 2 2 2 2 3 2 1 ...
##  $ BodyPart                    : Factor w/ 54 levels "Abdomen","Ankle",..: 29 29 24 29 29 23 29 29 50 32 ...
##  $ Total_Paid_calc             : Factor w/ 23817 levels "0","0.63","0.68",..: 249 1 20189 7905 6410 904 9981 1 12487 22563 ...
##  $ tiempo_de_procesamiento_days: Factor w/ 3708 levels "-20097","0","1",..: 2079 86 2077 2963 2043 2176 2434 2051 2076 2715 ...
##  - attr(*, "na.action")= 'omit' Named int [1:21542] 1 2 3 4 5 6 7 9 10 11 ...
##   ..- attr(*, "names")= chr [1:21542] "1" "2" "3" "4" ...

2.4 Crear arbol de decisiones

# arbol <- rpart(formula = Gender ~ ., data=db)
# arbol
# rpart.plot(arbol)

3. Regresión Lineal

library(dplyr)
library(readr)
library(readr)
base_act_4_6 <- BASE

3.1 Entender la base de datos

summary(base_act_4_6)
##     ClaimID           TotalPaid        TotalReserves     TotalRecovery      
##  Min.   :  777624   Min.   :  777624   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  794257   1st Qu.:  794257   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  811232   Median :  811232   Median :      0   Median :     0.00  
##  Mean   : 2759736   Mean   : 2759736   Mean   :   1931   Mean   :    67.77  
##  3rd Qu.:  830786   3rd Qu.:  830786   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203364   Max.   :62203364   Max.   :1529053   Max.   :130335.75  
##                                                                             
##  IndemnityPaid      OtherPaid        ClaimStatus       IncidentDate      
##  Min.   :  -475   Min.   :  -7820   Min.   :  777624   Length:55996      
##  1st Qu.:     0   1st Qu.:     62   1st Qu.:  794257   Class :character  
##  Median :     0   Median :    233   Median :  811232   Mode  :character  
##  Mean   :  3604   Mean   :   3912   Mean   : 2759736                     
##  3rd Qu.:     0   3rd Qu.:    831   3rd Qu.:  830786                     
##  Max.   :640732   Max.   :4129915   Max.   :62203364                     
##                                                                          
##  IncidentDescription ReturnToWorkDate   AverageWeeklyWage  ClaimantOpenedDate
##  Length:55996        Length:55996       Min.   :    0.23   Length:55996      
##  Class :character    Class :character   1st Qu.:  266.80   Class :character  
##  Mode  :character    Mode  :character   Median :  471.92   Mode  :character  
##                                         Mean   :  479.64                     
##                                         3rd Qu.:  625.10                     
##                                         Max.   :96666.80                     
##                                         NA's   :35942                        
##  ClaimantClosedDate EmployerNotificationDate ReceivedDate      
##  Length:55996       Length:55996             Length:55996      
##  Class :character   Class :character         Class :character  
##  Mode  :character   Mode  :character         Mode  :character  
##                                                                
##                                                                
##                                                                
##                                                                
##     IsDenied       ClaimantAge_at_DOI    Gender          ClaimantType      
##  Min.   :0.00000   Min.   :-7550.00   Length:55996       Length:55996      
##  1st Qu.:0.00000   1st Qu.:   32.00   Class :character   Class :character  
##  Median :0.00000   Median :   42.00   Mode  :character   Mode  :character  
##  Mean   :0.04354   Mean   :   38.34                                        
##  3rd Qu.:0.00000   3rd Qu.:   50.00                                        
##  Max.   :1.00000   Max.   :   94.00                                        
##                    NA's   :20920                                           
##  InjuryNature       BodyPartRegion       BodyPart         BillReviewALE     
##  Length:55996       Length:55996       Length:55996       Min.   : -456.00  
##  Class :character   Class :character   Class :character   1st Qu.:    8.25  
##  Mode  :character   Mode  :character   Mode  :character   Median :   24.00  
##                                                           Mean   :  189.89  
##                                                           3rd Qu.:   65.20  
##                                                           Max.   :56475.30  
##                                                           NA's   :31790     
##     Hospital         PhysicianOutpatient       Rx          
##  Min.   : -12570.4   Min.   :   -549.5   Min.   :  -469.5  
##  1st Qu.:    202.5   1st Qu.:    107.3   1st Qu.:    22.7  
##  Median :    580.5   Median :    222.7   Median :    60.0  
##  Mean   :   4773.9   Mean   :   1762.7   Mean   :  1459.0  
##  3rd Qu.:   2298.5   3rd Qu.:    689.9   3rd Qu.:   178.3  
##  Max.   :2759604.0   Max.   :1481468.5   Max.   :631635.5  
##  NA's   :35042       NA's   :3892        NA's   :36229     
##  Total_Incurred_Cost_Claim Total_Paid_calc   tiempo_de_procesamiento_days
##  Min.   : -10400           Min.   :    -82   Min.   :-24649              
##  1st Qu.:     61           1st Qu.:     65   1st Qu.:   379              
##  Median :    233           Median :    237   Median :  1190              
##  Mean   :   9379           Mean   :   7515   Mean   :  1415              
##  3rd Qu.:    885           3rd Qu.:    918   3rd Qu.:  1897              
##  Max.   :4734750           Max.   :4527291   Max.   : 12346              
##                                              NA's   :623

Observaciones.

1.En promedio el TotalPaid es de $275,9736 por atenderlos(IndemnityPaid + OtherPaid”.

2.En promedio se hacen 1,931 reservas totales (open claims).

3.En promedio 68 pacientes se recuperan en su totalidad.

4.En promedio el seguro le paga a sus empleados por accidente $3,064.

5.En promedio los accidentados pagan $3,912 adicional por su consulta.

3.2 Generar regresiones lineales

3.3 Costs of Claims

regresion <- lm(Total_Paid_calc ~ OtherPaid + Total_Incurred_Cost_Claim + IndemnityPaid + ClaimStatus + Gender + ClaimantType + InjuryNature + BodyPartRegion, data = base_act_4_6)
summary(regresion)
## 
## Call:
## lm(formula = Total_Paid_calc ~ OtherPaid + Total_Incurred_Cost_Claim + 
##     IndemnityPaid + ClaimStatus + Gender + ClaimantType + InjuryNature + 
##     BodyPartRegion, data = base_act_4_6)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -1.797e-07 -9.000e-12 -1.000e-12  9.000e-12  1.611e-08 
## 
## Coefficients:
##                                                                           Estimate
## (Intercept)                                                             -1.968e-11
## OtherPaid                                                                1.000e+00
## Total_Incurred_Cost_Claim                                                1.852e-15
## IndemnityPaid                                                            1.000e+00
## ClaimStatus                                                              4.494e-19
## GenderMale                                                              -9.026e-12
## GenderNot Available                                                     -7.518e-12
## ClaimantTypeMedical Only                                                 1.630e-11
## ClaimantTypeReport Only                                                  1.059e-11
## InjuryNatureAll Other Specific Injuries, Noc                            -9.387e-12
## InjuryNatureAmputation                                                  -7.787e-12
## InjuryNatureAngina Pectoris                                             -1.435e-11
## InjuryNatureAsbestosis                                                  -3.073e-12
## InjuryNatureAsphyxiation                                                -5.966e-12
## InjuryNatureBlack Lung                                                  -8.003e-12
## InjuryNatureBurn                                                        -1.612e-11
## InjuryNatureCancer                                                      -5.132e-12
## InjuryNatureCarpal Tunnel Syndrome                                      -1.440e-11
## InjuryNatureConcussion                                                  -1.233e-11
## InjuryNatureContagious Disease                                          -3.687e-12
## InjuryNatureContusion                                                   -1.536e-11
## InjuryNatureCrushing                                                    -1.931e-11
## InjuryNatureDermatitis                                                  -1.211e-11
## InjuryNatureDislocation                                                 -1.407e-11
## InjuryNatureDust Disease, NOC                                           -1.064e-11
## InjuryNatureElectric Shock                                              -7.817e-12
## InjuryNatureForeign Body                                                -1.376e-11
## InjuryNatureFracture                                                    -1.377e-11
## InjuryNatureFreezing                                                    -1.502e-11
## InjuryNatureHearing Loss Or Impairment                                  -7.241e-12
## InjuryNatureHeat Prostration                                             7.215e-12
## InjuryNatureHernia                                                      -7.362e-12
## InjuryNatureInfection                                                   -1.098e-11
## InjuryNatureInflammation                                                -1.842e-11
## InjuryNatureLaceration                                                  -1.873e-11
## InjuryNatureLoss of Hearing                                             -1.120e-11
## InjuryNatureMental Disorder                                              1.037e-11
## InjuryNatureMental Stress                                                1.321e-11
## InjuryNatureMultiple Injuries Including Both Physical and Psychological -6.151e-13
## InjuryNatureMultiple Physical Injuries Only                              3.816e-12
## InjuryNatureMyocardial Infarction                                       -1.036e-11
## InjuryNatureNo Physical Injury                                          -2.931e-13
## InjuryNatureNon-Standard Code                                           -1.796e-11
## InjuryNatureNot Available                                               -3.375e-11
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      -8.182e-12
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)             -1.217e-11
## InjuryNaturePuncture                                                    -1.543e-11
## InjuryNatureRadiation                                                   -1.184e-11
## InjuryNatureRespiratory Disorders                                       -1.116e-11
## InjuryNatureRupture                                                     -1.200e-11
## InjuryNatureSeverance                                                   -9.776e-12
## InjuryNatureSilicosis                                                   -1.669e-11
## InjuryNatureSprain                                                      -6.682e-11
## InjuryNatureStrain                                                      -1.768e-11
## InjuryNatureSyncope                                                      7.104e-13
## InjuryNatureVascular                                                     7.716e-12
## InjuryNatureVDT-Related Disease                                         -1.875e-11
## InjuryNatureVision Loss                                                 -1.229e-11
## BodyPartRegionLower Extremities                                          1.347e-11
## BodyPartRegionMultiple Body Parts                                       -2.234e-11
## BodyPartRegionNeck                                                       5.280e-12
## BodyPartRegionNon-Standard Code                                          4.751e-12
## BodyPartRegionTrunk                                                      5.148e-12
## BodyPartRegionUpper Extremities                                          5.601e-12
##                                                                         Std. Error
## (Intercept)                                                              5.410e-10
## OtherPaid                                                                2.031e-16
## Total_Incurred_Cost_Claim                                                1.341e-16
## IndemnityPaid                                                            2.765e-16
## ClaimStatus                                                              1.185e-18
## GenderMale                                                               6.819e-12
## GenderNot Available                                                      2.873e-11
## ClaimantTypeMedical Only                                                 8.721e-12
## ClaimantTypeReport Only                                                  1.593e-11
## InjuryNatureAll Other Specific Injuries, Noc                             5.410e-10
## InjuryNatureAmputation                                                   5.673e-10
## InjuryNatureAngina Pectoris                                              5.926e-10
## InjuryNatureAsbestosis                                                   5.566e-10
## InjuryNatureAsphyxiation                                                 6.400e-10
## InjuryNatureBlack Lung                                                   7.649e-10
## InjuryNatureBurn                                                         5.418e-10
## InjuryNatureCancer                                                       5.925e-10
## InjuryNatureCarpal Tunnel Syndrome                                       5.422e-10
## InjuryNatureConcussion                                                   5.445e-10
## InjuryNatureContagious Disease                                           5.443e-10
## InjuryNatureContusion                                                    5.409e-10
## InjuryNatureCrushing                                                     5.430e-10
## InjuryNatureDermatitis                                                   5.416e-10
## InjuryNatureDislocation                                                  5.432e-10
## InjuryNatureDust Disease, NOC                                            6.625e-10
## InjuryNatureElectric Shock                                               5.483e-10
## InjuryNatureForeign Body                                                 5.413e-10
## InjuryNatureFracture                                                     5.413e-10
## InjuryNatureFreezing                                                     6.624e-10
## InjuryNatureHearing Loss Or Impairment                                   5.622e-10
## InjuryNatureHeat Prostration                                             5.473e-10
## InjuryNatureHernia                                                       5.471e-10
## InjuryNatureInfection                                                    5.441e-10
## InjuryNatureInflammation                                                 5.419e-10
## InjuryNatureLaceration                                                   5.410e-10
## InjuryNatureLoss of Hearing                                              5.607e-10
## InjuryNatureMental Disorder                                              5.926e-10
## InjuryNatureMental Stress                                                5.462e-10
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  5.649e-10
## InjuryNatureMultiple Physical Injuries Only                              5.416e-10
## InjuryNatureMyocardial Infarction                                        5.783e-10
## InjuryNatureNo Physical Injury                                           5.417e-10
## InjuryNatureNon-Standard Code                                            5.479e-10
## InjuryNatureNot Available                                                9.376e-10
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       5.445e-10
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              5.592e-10
## InjuryNaturePuncture                                                     5.411e-10
## InjuryNatureRadiation                                                    5.630e-10
## InjuryNatureRespiratory Disorders                                        5.420e-10
## InjuryNatureRupture                                                      5.503e-10
## InjuryNatureSeverance                                                    5.508e-10
## InjuryNatureSilicosis                                                    9.369e-10
## InjuryNatureSprain                                                       5.410e-10
## InjuryNatureStrain                                                       5.409e-10
## InjuryNatureSyncope                                                      5.463e-10
## InjuryNatureVascular                                                     7.649e-10
## InjuryNatureVDT-Related Disease                                          7.649e-10
## InjuryNatureVision Loss                                                  5.719e-10
## BodyPartRegionLower Extremities                                          1.422e-11
## BodyPartRegionMultiple Body Parts                                        1.500e-11
## BodyPartRegionNeck                                                       2.304e-11
## BodyPartRegionNon-Standard Code                                          8.845e-11
## BodyPartRegionTrunk                                                      1.534e-11
## BodyPartRegionUpper Extremities                                          1.335e-11
##                                                                            t value
## (Intercept)                                                             -3.600e-02
## OtherPaid                                                                4.925e+15
## Total_Incurred_Cost_Claim                                                1.381e+01
## IndemnityPaid                                                            3.616e+15
## ClaimStatus                                                              3.790e-01
## GenderMale                                                              -1.324e+00
## GenderNot Available                                                     -2.620e-01
## ClaimantTypeMedical Only                                                 1.868e+00
## ClaimantTypeReport Only                                                  6.640e-01
## InjuryNatureAll Other Specific Injuries, Noc                            -1.700e-02
## InjuryNatureAmputation                                                  -1.400e-02
## InjuryNatureAngina Pectoris                                             -2.400e-02
## InjuryNatureAsbestosis                                                  -6.000e-03
## InjuryNatureAsphyxiation                                                -9.000e-03
## InjuryNatureBlack Lung                                                  -1.000e-02
## InjuryNatureBurn                                                        -3.000e-02
## InjuryNatureCancer                                                      -9.000e-03
## InjuryNatureCarpal Tunnel Syndrome                                      -2.700e-02
## InjuryNatureConcussion                                                  -2.300e-02
## InjuryNatureContagious Disease                                          -7.000e-03
## InjuryNatureContusion                                                   -2.800e-02
## InjuryNatureCrushing                                                    -3.600e-02
## InjuryNatureDermatitis                                                  -2.200e-02
## InjuryNatureDislocation                                                 -2.600e-02
## InjuryNatureDust Disease, NOC                                           -1.600e-02
## InjuryNatureElectric Shock                                              -1.400e-02
## InjuryNatureForeign Body                                                -2.500e-02
## InjuryNatureFracture                                                    -2.500e-02
## InjuryNatureFreezing                                                    -2.300e-02
## InjuryNatureHearing Loss Or Impairment                                  -1.300e-02
## InjuryNatureHeat Prostration                                             1.300e-02
## InjuryNatureHernia                                                      -1.300e-02
## InjuryNatureInfection                                                   -2.000e-02
## InjuryNatureInflammation                                                -3.400e-02
## InjuryNatureLaceration                                                  -3.500e-02
## InjuryNatureLoss of Hearing                                             -2.000e-02
## InjuryNatureMental Disorder                                              1.700e-02
## InjuryNatureMental Stress                                                2.400e-02
## InjuryNatureMultiple Injuries Including Both Physical and Psychological -1.000e-03
## InjuryNatureMultiple Physical Injuries Only                              7.000e-03
## InjuryNatureMyocardial Infarction                                       -1.800e-02
## InjuryNatureNo Physical Injury                                          -1.000e-03
## InjuryNatureNon-Standard Code                                           -3.300e-02
## InjuryNatureNot Available                                               -3.600e-02
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      -1.500e-02
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)             -2.200e-02
## InjuryNaturePuncture                                                    -2.900e-02
## InjuryNatureRadiation                                                   -2.100e-02
## InjuryNatureRespiratory Disorders                                       -2.100e-02
## InjuryNatureRupture                                                     -2.200e-02
## InjuryNatureSeverance                                                   -1.800e-02
## InjuryNatureSilicosis                                                   -1.800e-02
## InjuryNatureSprain                                                      -1.240e-01
## InjuryNatureStrain                                                      -3.300e-02
## InjuryNatureSyncope                                                      1.000e-03
## InjuryNatureVascular                                                     1.000e-02
## InjuryNatureVDT-Related Disease                                         -2.500e-02
## InjuryNatureVision Loss                                                 -2.100e-02
## BodyPartRegionLower Extremities                                          9.470e-01
## BodyPartRegionMultiple Body Parts                                       -1.489e+00
## BodyPartRegionNeck                                                       2.290e-01
## BodyPartRegionNon-Standard Code                                          5.400e-02
## BodyPartRegionTrunk                                                      3.360e-01
## BodyPartRegionUpper Extremities                                          4.200e-01
##                                                                         Pr(>|t|)
## (Intercept)                                                               0.9710
## OtherPaid                                                                 <2e-16
## Total_Incurred_Cost_Claim                                                 <2e-16
## IndemnityPaid                                                             <2e-16
## ClaimStatus                                                               0.7046
## GenderMale                                                                0.1857
## GenderNot Available                                                       0.7935
## ClaimantTypeMedical Only                                                  0.0617
## ClaimantTypeReport Only                                                   0.5064
## InjuryNatureAll Other Specific Injuries, Noc                              0.9862
## InjuryNatureAmputation                                                    0.9890
## InjuryNatureAngina Pectoris                                               0.9807
## InjuryNatureAsbestosis                                                    0.9956
## InjuryNatureAsphyxiation                                                  0.9926
## InjuryNatureBlack Lung                                                    0.9917
## InjuryNatureBurn                                                          0.9763
## InjuryNatureCancer                                                        0.9931
## InjuryNatureCarpal Tunnel Syndrome                                        0.9788
## InjuryNatureConcussion                                                    0.9819
## InjuryNatureContagious Disease                                            0.9946
## InjuryNatureContusion                                                     0.9773
## InjuryNatureCrushing                                                      0.9716
## InjuryNatureDermatitis                                                    0.9822
## InjuryNatureDislocation                                                   0.9793
## InjuryNatureDust Disease, NOC                                             0.9872
## InjuryNatureElectric Shock                                                0.9886
## InjuryNatureForeign Body                                                  0.9797
## InjuryNatureFracture                                                      0.9797
## InjuryNatureFreezing                                                      0.9819
## InjuryNatureHearing Loss Or Impairment                                    0.9897
## InjuryNatureHeat Prostration                                              0.9895
## InjuryNatureHernia                                                        0.9893
## InjuryNatureInfection                                                     0.9839
## InjuryNatureInflammation                                                  0.9729
## InjuryNatureLaceration                                                    0.9724
## InjuryNatureLoss of Hearing                                               0.9841
## InjuryNatureMental Disorder                                               0.9860
## InjuryNatureMental Stress                                                 0.9807
## InjuryNatureMultiple Injuries Including Both Physical and Psychological   0.9991
## InjuryNatureMultiple Physical Injuries Only                               0.9944
## InjuryNatureMyocardial Infarction                                         0.9857
## InjuryNatureNo Physical Injury                                            0.9996
## InjuryNatureNon-Standard Code                                             0.9738
## InjuryNatureNot Available                                                 0.9713
## InjuryNaturePoisoning?Chemical (Other Than Metals)                        0.9880
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)               0.9826
## InjuryNaturePuncture                                                      0.9773
## InjuryNatureRadiation                                                     0.9832
## InjuryNatureRespiratory Disorders                                         0.9836
## InjuryNatureRupture                                                       0.9826
## InjuryNatureSeverance                                                     0.9858
## InjuryNatureSilicosis                                                     0.9858
## InjuryNatureSprain                                                        0.9017
## InjuryNatureStrain                                                        0.9739
## InjuryNatureSyncope                                                       0.9990
## InjuryNatureVascular                                                      0.9920
## InjuryNatureVDT-Related Disease                                           0.9804
## InjuryNatureVision Loss                                                   0.9829
## BodyPartRegionLower Extremities                                           0.3434
## BodyPartRegionMultiple Body Parts                                         0.1364
## BodyPartRegionNeck                                                        0.8188
## BodyPartRegionNon-Standard Code                                           0.9572
## BodyPartRegionTrunk                                                       0.7372
## BodyPartRegionUpper Extremities                                           0.6748
##                                                                            
## (Intercept)                                                                
## OtherPaid                                                               ***
## Total_Incurred_Cost_Claim                                               ***
## IndemnityPaid                                                           ***
## ClaimStatus                                                                
## GenderMale                                                                 
## GenderNot Available                                                        
## ClaimantTypeMedical Only                                                .  
## ClaimantTypeReport Only                                                    
## InjuryNatureAll Other Specific Injuries, Noc                               
## InjuryNatureAmputation                                                     
## InjuryNatureAngina Pectoris                                                
## InjuryNatureAsbestosis                                                     
## InjuryNatureAsphyxiation                                                   
## InjuryNatureBlack Lung                                                     
## InjuryNatureBurn                                                           
## InjuryNatureCancer                                                         
## InjuryNatureCarpal Tunnel Syndrome                                         
## InjuryNatureConcussion                                                     
## InjuryNatureContagious Disease                                             
## InjuryNatureContusion                                                      
## InjuryNatureCrushing                                                       
## InjuryNatureDermatitis                                                     
## InjuryNatureDislocation                                                    
## InjuryNatureDust Disease, NOC                                              
## InjuryNatureElectric Shock                                                 
## InjuryNatureForeign Body                                                   
## InjuryNatureFracture                                                       
## InjuryNatureFreezing                                                       
## InjuryNatureHearing Loss Or Impairment                                     
## InjuryNatureHeat Prostration                                               
## InjuryNatureHernia                                                         
## InjuryNatureInfection                                                      
## InjuryNatureInflammation                                                   
## InjuryNatureLaceration                                                     
## InjuryNatureLoss of Hearing                                                
## InjuryNatureMental Disorder                                                
## InjuryNatureMental Stress                                                  
## InjuryNatureMultiple Injuries Including Both Physical and Psychological    
## InjuryNatureMultiple Physical Injuries Only                                
## InjuryNatureMyocardial Infarction                                          
## InjuryNatureNo Physical Injury                                             
## InjuryNatureNon-Standard Code                                              
## InjuryNatureNot Available                                                  
## InjuryNaturePoisoning?Chemical (Other Than Metals)                         
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)                
## InjuryNaturePuncture                                                       
## InjuryNatureRadiation                                                      
## InjuryNatureRespiratory Disorders                                          
## InjuryNatureRupture                                                        
## InjuryNatureSeverance                                                      
## InjuryNatureSilicosis                                                      
## InjuryNatureSprain                                                         
## InjuryNatureStrain                                                         
## InjuryNatureSyncope                                                        
## InjuryNatureVascular                                                       
## InjuryNatureVDT-Related Disease                                            
## InjuryNatureVision Loss                                                    
## BodyPartRegionLower Extremities                                            
## BodyPartRegionMultiple Body Parts                                          
## BodyPartRegionNeck                                                         
## BodyPartRegionNon-Standard Code                                            
## BodyPartRegionTrunk                                                        
## BodyPartRegionUpper Extremities                                            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 7.649e-10 on 55932 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 3.206e+30 on 63 and 55932 DF,  p-value: < 2.2e-16

3.4 Time To Process Claims

regresion2 <- lm(tiempo_de_procesamiento_days ~ BodyPart + BodyPartRegion + InjuryNature + ClaimantType + ClaimantAge_at_DOI, data = base_act_4_6)
summary(regresion2)
## 
## Call:
## lm(formula = tiempo_de_procesamiento_days ~ BodyPart + BodyPartRegion + 
##     InjuryNature + ClaimantType + ClaimantAge_at_DOI, data = base_act_4_6)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -20884.3   -634.0   -208.5    473.5  10497.0 
## 
## Coefficients: (6 not defined because of singularities)
##                                                                           Estimate
## (Intercept)                                                              202.18631
## BodyPartAnkle                                                            255.55145
## BodyPartArtificial Appliance                                             -33.75461
## BodyPartBody Systems and Multiple Body Systems                           -75.28881
## BodyPartBrain                                                            -72.62472
## BodyPartButtocks                                                          66.33402
## BodyPartChest                                                            198.05993
## BodyPartDisc-Trunk                                                       321.51754
## BodyPartEar(S)                                                            88.90459
## BodyPartElbow                                                            160.00558
## BodyPartEyes                                                              -5.80733
## BodyPartFacial Bones                                                     182.23095
## BodyPartFinger(S)                                                        284.24195
## BodyPartFoot                                                             204.56940
## BodyPartGreat Toe                                                        -33.47004
## BodyPartHand                                                             227.24357
## BodyPartHeart                                                            192.92790
## BodyPartHip                                                              244.46030
## BodyPartInsufficient Info to Properly Identify?Unclassified             -113.85722
## BodyPartInternal Organs                                                  702.47756
## BodyPartKnee                                                             212.66548
## BodyPartLarynx                                                           452.46540
## BodyPartLower Arm                                                         60.14031
## BodyPartLower Back Area                                                  276.35022
## BodyPartLower Leg                                                        157.94919
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              151.46118
## BodyPartLungs                                                           -257.73944
## BodyPartMouth                                                            250.39181
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      388.62757
## BodyPartMultiple Head Injury                                             110.96365
## BodyPartMultiple Lower Extremities                                       370.87428
## BodyPartMultiple Neck Injury                                             170.46232
## BodyPartMultiple Trunk                                                   496.12573
## BodyPartMultiple Upper Extremities                                       595.44895
## BodyPartNo Physical Injury                                               102.34640
## BodyPartNon-Standard Code                                               2399.26046
## BodyPartNose                                                             198.74390
## BodyPartPelvis                                                           -68.47841
## BodyPartSacrum And Coccyx                                               -135.67425
## BodyPartShoulder(S)                                                      102.87217
## BodyPartSkull                                                            206.20730
## BodyPartSoft Tissue-Head                                                3223.10998
## BodyPartSoft Tissue-Neck                                                -126.43392
## BodyPartSpinal Cord-Trunk                                                123.72400
## BodyPartTeeth                                                           -185.91704
## BodyPartThumb                                                            105.69789
## BodyPartToes                                                               0.24793
## BodyPartTrachea                                                           18.86028
## BodyPartUpper Arm                                                        619.01825
## BodyPartUpper Back Area                                                  105.02683
## BodyPartUpper Leg                                                        122.95884
## BodyPartVertebrae                                                        825.97829
## BodyPartWhole Body                                                      1031.47950
## BodyPartWrist                                                            223.46821
## BodyPartRegionLower Extremities                                                 NA
## BodyPartRegionMultiple Body Parts                                               NA
## BodyPartRegionNeck                                                              NA
## BodyPartRegionNon-Standard Code                                                 NA
## BodyPartRegionTrunk                                                             NA
## BodyPartRegionUpper Extremities                                                 NA
## InjuryNatureAll Other Specific Injuries, Noc                            1547.29324
## InjuryNatureAmputation                                                   856.79393
## InjuryNatureAngina Pectoris                                             -104.10030
## InjuryNatureAsbestosis                                                  1286.63297
## InjuryNatureAsphyxiation                                                1125.87276
## InjuryNatureBlack Lung                                                   880.23818
## InjuryNatureBurn                                                         655.14182
## InjuryNatureCancer                                                      1010.24554
## InjuryNatureCarpal Tunnel Syndrome                                       456.81459
## InjuryNatureConcussion                                                   559.06841
## InjuryNatureContagious Disease                                           983.43927
## InjuryNatureContusion                                                    692.62421
## InjuryNatureCrushing                                                     389.90231
## InjuryNatureDermatitis                                                   534.76655
## InjuryNatureDislocation                                                  667.16129
## InjuryNatureDust Disease, NOC                                            621.71726
## InjuryNatureElectric Shock                                               832.73068
## InjuryNatureForeign Body                                                1004.96425
## InjuryNatureFracture                                                     490.39241
## InjuryNatureFreezing                                                    2005.08117
## InjuryNatureHearing Loss Or Impairment                                  1316.32884
## InjuryNatureHeat Prostration                                             674.35220
## InjuryNatureHernia                                                       532.06112
## InjuryNatureInfection                                                    544.23215
## InjuryNatureInflammation                                                 572.95419
## InjuryNatureLaceration                                                   641.20974
## InjuryNatureLoss of Hearing                                             1043.58625
## InjuryNatureMental Disorder                                             1666.04565
## InjuryNatureMental Stress                                                584.45954
## InjuryNatureMultiple Injuries Including Both Physical and Psychological   40.82780
## InjuryNatureMultiple Physical Injuries Only                              204.58006
## InjuryNatureMyocardial Infarction                                        237.49453
## InjuryNatureNo Physical Injury                                           674.37018
## InjuryNatureNon-Standard Code                                            688.09248
## InjuryNatureNot Available                                               -305.51910
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      1181.05551
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              516.36992
## InjuryNaturePuncture                                                     622.28550
## InjuryNatureRadiation                                                   1003.68270
## InjuryNatureRespiratory Disorders                                        781.05253
## InjuryNatureRupture                                                      524.37594
## InjuryNatureSeverance                                                   1768.20727
## InjuryNatureSprain                                                       497.85551
## InjuryNatureStrain                                                       625.51783
## InjuryNatureSyncope                                                      742.82062
## InjuryNatureVascular                                                     422.29803
## InjuryNatureVDT-Related Disease                                          689.44043
## InjuryNatureVision Loss                                                  399.19480
## ClaimantTypeMedical Only                                                -220.34761
## ClaimantTypeReport Only                                                 -178.01812
## ClaimantAge_at_DOI                                                        -0.06151
##                                                                         Std. Error
## (Intercept)                                                              627.68139
## BodyPartAnkle                                                             55.19846
## BodyPartArtificial Appliance                                             398.72657
## BodyPartBody Systems and Multiple Body Systems                            88.91171
## BodyPartBrain                                                            533.15964
## BodyPartButtocks                                                          94.72219
## BodyPartChest                                                             60.77388
## BodyPartDisc-Trunk                                                        73.97543
## BodyPartEar(S)                                                           106.64049
## BodyPartElbow                                                             61.67213
## BodyPartEyes                                                              57.79008
## BodyPartFacial Bones                                                      73.56724
## BodyPartFinger(S)                                                         52.66390
## BodyPartFoot                                                              56.59334
## BodyPartGreat Toe                                                        109.99069
## BodyPartHand                                                              52.86533
## BodyPartHeart                                                            355.05363
## BodyPartHip                                                               68.19487
## BodyPartInsufficient Info to Properly Identify?Unclassified               71.46757
## BodyPartInternal Organs                                                  135.76771
## BodyPartKnee                                                              51.44050
## BodyPartLarynx                                                           885.24401
## BodyPartLower Arm                                                         57.82462
## BodyPartLower Back Area                                                   51.26376
## BodyPartLower Leg                                                         58.51294
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               62.20155
## BodyPartLungs                                                             92.72161
## BodyPartMouth                                                             81.17905
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)       51.19265
## BodyPartMultiple Head Injury                                              55.94204
## BodyPartMultiple Lower Extremities                                        65.61772
## BodyPartMultiple Neck Injury                                              58.57630
## BodyPartMultiple Trunk                                                   126.46046
## BodyPartMultiple Upper Extremities                                        62.39849
## BodyPartNo Physical Injury                                                78.29149
## BodyPartNon-Standard Code                                                128.14008
## BodyPartNose                                                              85.24849
## BodyPartPelvis                                                           117.14371
## BodyPartSacrum And Coccyx                                                166.19242
## BodyPartShoulder(S)                                                       53.50359
## BodyPartSkull                                                            162.73081
## BodyPartSoft Tissue-Head                                                 887.76616
## BodyPartSoft Tissue-Neck                                                  70.27669
## BodyPartSpinal Cord-Trunk                                                163.85519
## BodyPartTeeth                                                            103.48633
## BodyPartThumb                                                             58.63794
## BodyPartToes                                                              80.87833
## BodyPartTrachea                                                          340.74791
## BodyPartUpper Arm                                                         63.62114
## BodyPartUpper Back Area                                                   72.37912
## BodyPartUpper Leg                                                         71.63079
## BodyPartVertebrae                                                        364.25566
## BodyPartWhole Body                                                       512.68417
## BodyPartWrist                                                             54.46555
## BodyPartRegionLower Extremities                                                 NA
## BodyPartRegionMultiple Body Parts                                               NA
## BodyPartRegionNeck                                                              NA
## BodyPartRegionNon-Standard Code                                                 NA
## BodyPartRegionTrunk                                                             NA
## BodyPartRegionUpper Extremities                                                 NA
## InjuryNatureAll Other Specific Injuries, Noc                             626.14715
## InjuryNatureAmputation                                                   675.83700
## InjuryNatureAngina Pectoris                                              689.68976
## InjuryNatureAsbestosis                                                   647.78637
## InjuryNatureAsphyxiation                                                 884.76722
## InjuryNatureBlack Lung                                                  1085.61437
## InjuryNatureBurn                                                         627.47248
## InjuryNatureCancer                                                       740.53696
## InjuryNatureCarpal Tunnel Syndrome                                       628.47267
## InjuryNatureConcussion                                                   631.69755
## InjuryNatureContagious Disease                                           632.55827
## InjuryNatureContusion                                                    625.84888
## InjuryNatureCrushing                                                     629.22164
## InjuryNatureDermatitis                                                   627.05089
## InjuryNatureDislocation                                                  629.56703
## InjuryNatureDust Disease, NOC                                            768.17403
## InjuryNatureElectric Shock                                               639.11585
## InjuryNatureForeign Body                                                 626.76925
## InjuryNatureFracture                                                     626.46290
## InjuryNatureFreezing                                                     807.65388
## InjuryNatureHearing Loss Or Impairment                                   662.96788
## InjuryNatureHeat Prostration                                             636.84376
## InjuryNatureHernia                                                       635.62416
## InjuryNatureInfection                                                    631.16353
## InjuryNatureInflammation                                                 627.38484
## InjuryNatureLaceration                                                   625.98979
## InjuryNatureLoss of Hearing                                              670.28709
## InjuryNatureMental Disorder                                              747.26375
## InjuryNatureMental Stress                                                634.52534
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  659.58882
## InjuryNatureMultiple Physical Injuries Only                              626.95741
## InjuryNatureMyocardial Infarction                                        715.17178
## InjuryNatureNo Physical Injury                                           626.54476
## InjuryNatureNon-Standard Code                                            635.88464
## InjuryNatureNot Available                                               1083.23581
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       635.80977
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              656.17367
## InjuryNaturePuncture                                                     626.15416
## InjuryNatureRadiation                                                    666.12637
## InjuryNatureRespiratory Disorders                                        628.90677
## InjuryNatureRupture                                                      642.08255
## InjuryNatureSeverance                                                    672.60425
## InjuryNatureSprain                                                       626.09014
## InjuryNatureStrain                                                       625.90443
## InjuryNatureSyncope                                                      635.27117
## InjuryNatureVascular                                                    1083.19862
## InjuryNatureVDT-Related Disease                                         1083.68974
## InjuryNatureVision Loss                                                  672.72667
## ClaimantTypeMedical Only                                                  12.15975
## ClaimantTypeReport Only                                                   27.45158
## ClaimantAge_at_DOI                                                         0.03441
##                                                                         t value
## (Intercept)                                                               0.322
## BodyPartAnkle                                                             4.630
## BodyPartArtificial Appliance                                             -0.085
## BodyPartBody Systems and Multiple Body Systems                           -0.847
## BodyPartBrain                                                            -0.136
## BodyPartButtocks                                                          0.700
## BodyPartChest                                                             3.259
## BodyPartDisc-Trunk                                                        4.346
## BodyPartEar(S)                                                            0.834
## BodyPartElbow                                                             2.594
## BodyPartEyes                                                             -0.100
## BodyPartFacial Bones                                                      2.477
## BodyPartFinger(S)                                                         5.397
## BodyPartFoot                                                              3.615
## BodyPartGreat Toe                                                        -0.304
## BodyPartHand                                                              4.299
## BodyPartHeart                                                             0.543
## BodyPartHip                                                               3.585
## BodyPartInsufficient Info to Properly Identify?Unclassified              -1.593
## BodyPartInternal Organs                                                   5.174
## BodyPartKnee                                                              4.134
## BodyPartLarynx                                                            0.511
## BodyPartLower Arm                                                         1.040
## BodyPartLower Back Area                                                   5.391
## BodyPartLower Leg                                                         2.699
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               2.435
## BodyPartLungs                                                            -2.780
## BodyPartMouth                                                             3.084
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)       7.591
## BodyPartMultiple Head Injury                                              1.984
## BodyPartMultiple Lower Extremities                                        5.652
## BodyPartMultiple Neck Injury                                              2.910
## BodyPartMultiple Trunk                                                    3.923
## BodyPartMultiple Upper Extremities                                        9.543
## BodyPartNo Physical Injury                                                1.307
## BodyPartNon-Standard Code                                                18.724
## BodyPartNose                                                              2.331
## BodyPartPelvis                                                           -0.585
## BodyPartSacrum And Coccyx                                                -0.816
## BodyPartShoulder(S)                                                       1.923
## BodyPartSkull                                                             1.267
## BodyPartSoft Tissue-Head                                                  3.631
## BodyPartSoft Tissue-Neck                                                 -1.799
## BodyPartSpinal Cord-Trunk                                                 0.755
## BodyPartTeeth                                                            -1.797
## BodyPartThumb                                                             1.803
## BodyPartToes                                                              0.003
## BodyPartTrachea                                                           0.055
## BodyPartUpper Arm                                                         9.730
## BodyPartUpper Back Area                                                   1.451
## BodyPartUpper Leg                                                         1.717
## BodyPartVertebrae                                                         2.268
## BodyPartWhole Body                                                        2.012
## BodyPartWrist                                                             4.103
## BodyPartRegionLower Extremities                                              NA
## BodyPartRegionMultiple Body Parts                                            NA
## BodyPartRegionNeck                                                           NA
## BodyPartRegionNon-Standard Code                                              NA
## BodyPartRegionTrunk                                                          NA
## BodyPartRegionUpper Extremities                                              NA
## InjuryNatureAll Other Specific Injuries, Noc                              2.471
## InjuryNatureAmputation                                                    1.268
## InjuryNatureAngina Pectoris                                              -0.151
## InjuryNatureAsbestosis                                                    1.986
## InjuryNatureAsphyxiation                                                  1.273
## InjuryNatureBlack Lung                                                    0.811
## InjuryNatureBurn                                                          1.044
## InjuryNatureCancer                                                        1.364
## InjuryNatureCarpal Tunnel Syndrome                                        0.727
## InjuryNatureConcussion                                                    0.885
## InjuryNatureContagious Disease                                            1.555
## InjuryNatureContusion                                                     1.107
## InjuryNatureCrushing                                                      0.620
## InjuryNatureDermatitis                                                    0.853
## InjuryNatureDislocation                                                   1.060
## InjuryNatureDust Disease, NOC                                             0.809
## InjuryNatureElectric Shock                                                1.303
## InjuryNatureForeign Body                                                  1.603
## InjuryNatureFracture                                                      0.783
## InjuryNatureFreezing                                                      2.483
## InjuryNatureHearing Loss Or Impairment                                    1.986
## InjuryNatureHeat Prostration                                              1.059
## InjuryNatureHernia                                                        0.837
## InjuryNatureInfection                                                     0.862
## InjuryNatureInflammation                                                  0.913
## InjuryNatureLaceration                                                    1.024
## InjuryNatureLoss of Hearing                                               1.557
## InjuryNatureMental Disorder                                               2.230
## InjuryNatureMental Stress                                                 0.921
## InjuryNatureMultiple Injuries Including Both Physical and Psychological   0.062
## InjuryNatureMultiple Physical Injuries Only                               0.326
## InjuryNatureMyocardial Infarction                                         0.332
## InjuryNatureNo Physical Injury                                            1.076
## InjuryNatureNon-Standard Code                                             1.082
## InjuryNatureNot Available                                                -0.282
## InjuryNaturePoisoning?Chemical (Other Than Metals)                        1.858
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)               0.787
## InjuryNaturePuncture                                                      0.994
## InjuryNatureRadiation                                                     1.507
## InjuryNatureRespiratory Disorders                                         1.242
## InjuryNatureRupture                                                       0.817
## InjuryNatureSeverance                                                     2.629
## InjuryNatureSprain                                                        0.795
## InjuryNatureStrain                                                        0.999
## InjuryNatureSyncope                                                       1.169
## InjuryNatureVascular                                                      0.390
## InjuryNatureVDT-Related Disease                                           0.636
## InjuryNatureVision Loss                                                   0.593
## ClaimantTypeMedical Only                                                -18.121
## ClaimantTypeReport Only                                                  -6.485
## ClaimantAge_at_DOI                                                       -1.788
##                                                                         Pr(>|t|)
## (Intercept)                                                             0.747367
## BodyPartAnkle                                                           3.68e-06
## BodyPartArtificial Appliance                                            0.932535
## BodyPartBody Systems and Multiple Body Systems                          0.397123
## BodyPartBrain                                                           0.891652
## BodyPartButtocks                                                        0.483744
## BodyPartChest                                                           0.001119
## BodyPartDisc-Trunk                                                      1.39e-05
## BodyPartEar(S)                                                          0.404464
## BodyPartElbow                                                           0.009478
## BodyPartEyes                                                            0.919956
## BodyPartFacial Bones                                                    0.013251
## BodyPartFinger(S)                                                       6.81e-08
## BodyPartFoot                                                            0.000301
## BodyPartGreat Toe                                                       0.760902
## BodyPartHand                                                            1.72e-05
## BodyPartHeart                                                           0.586874
## BodyPartHip                                                             0.000338
## BodyPartInsufficient Info to Properly Identify?Unclassified             0.111140
## BodyPartInternal Organs                                                 2.30e-07
## BodyPartKnee                                                            3.57e-05
## BodyPartLarynx                                                          0.609271
## BodyPartLower Arm                                                       0.298326
## BodyPartLower Back Area                                                 7.06e-08
## BodyPartLower Leg                                                       0.006950
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             0.014897
## BodyPartLungs                                                           0.005444
## BodyPartMouth                                                           0.002041
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)     3.24e-14
## BodyPartMultiple Head Injury                                            0.047314
## BodyPartMultiple Lower Extremities                                      1.60e-08
## BodyPartMultiple Neck Injury                                            0.003616
## BodyPartMultiple Trunk                                                  8.76e-05
## BodyPartMultiple Upper Extremities                                       < 2e-16
## BodyPartNo Physical Injury                                              0.191137
## BodyPartNon-Standard Code                                                < 2e-16
## BodyPartNose                                                            0.019741
## BodyPartPelvis                                                          0.558842
## BodyPartSacrum And Coccyx                                               0.414295
## BodyPartShoulder(S)                                                     0.054524
## BodyPartSkull                                                           0.205104
## BodyPartSoft Tissue-Head                                                0.000283
## BodyPartSoft Tissue-Neck                                                0.072014
## BodyPartSpinal Cord-Trunk                                               0.450205
## BodyPartTeeth                                                           0.072418
## BodyPartThumb                                                           0.071467
## BodyPartToes                                                            0.997554
## BodyPartTrachea                                                         0.955860
## BodyPartUpper Arm                                                        < 2e-16
## BodyPartUpper Back Area                                                 0.146771
## BodyPartUpper Leg                                                       0.086068
## BodyPartVertebrae                                                       0.023361
## BodyPartWhole Body                                                      0.044236
## BodyPartWrist                                                           4.09e-05
## BodyPartRegionLower Extremities                                               NA
## BodyPartRegionMultiple Body Parts                                             NA
## BodyPartRegionNeck                                                            NA
## BodyPartRegionNon-Standard Code                                               NA
## BodyPartRegionTrunk                                                           NA
## BodyPartRegionUpper Extremities                                               NA
## InjuryNatureAll Other Specific Injuries, Noc                            0.013473
## InjuryNatureAmputation                                                  0.204895
## InjuryNatureAngina Pectoris                                             0.880026
## InjuryNatureAsbestosis                                                  0.047019
## InjuryNatureAsphyxiation                                                0.203202
## InjuryNatureBlack Lung                                                  0.417474
## InjuryNatureBurn                                                        0.296448
## InjuryNatureCancer                                                      0.172511
## InjuryNatureCarpal Tunnel Syndrome                                      0.467314
## InjuryNatureConcussion                                                  0.376149
## InjuryNatureContagious Disease                                          0.120026
## InjuryNatureContusion                                                   0.268433
## InjuryNatureCrushing                                                    0.535487
## InjuryNatureDermatitis                                                  0.393761
## InjuryNatureDislocation                                                 0.289282
## InjuryNatureDust Disease, NOC                                           0.418323
## InjuryNatureElectric Shock                                              0.192603
## InjuryNatureForeign Body                                                0.108855
## InjuryNatureFracture                                                    0.433753
## InjuryNatureFreezing                                                    0.013047
## InjuryNatureHearing Loss Or Impairment                                  0.047096
## InjuryNatureHeat Prostration                                            0.289654
## InjuryNatureHernia                                                      0.402560
## InjuryNatureInfection                                                   0.388546
## InjuryNatureInflammation                                                0.361122
## InjuryNatureLaceration                                                  0.305694
## InjuryNatureLoss of Hearing                                             0.119498
## InjuryNatureMental Disorder                                             0.025785
## InjuryNatureMental Stress                                               0.357006
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.950644
## InjuryNatureMultiple Physical Injuries Only                             0.744195
## InjuryNatureMyocardial Infarction                                       0.739831
## InjuryNatureNo Physical Injury                                          0.281786
## InjuryNatureNon-Standard Code                                           0.279214
## InjuryNatureNot Available                                               0.777912
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      0.063240
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)             0.431322
## InjuryNaturePuncture                                                    0.320317
## InjuryNatureRadiation                                                   0.131885
## InjuryNatureRespiratory Disorders                                       0.214274
## InjuryNatureRupture                                                     0.414117
## InjuryNatureSeverance                                                   0.008570
## InjuryNatureSprain                                                      0.426513
## InjuryNatureStrain                                                      0.317617
## InjuryNatureSyncope                                                     0.242292
## InjuryNatureVascular                                                    0.696641
## InjuryNatureVDT-Related Disease                                         0.524652
## InjuryNatureVision Loss                                                 0.552919
## ClaimantTypeMedical Only                                                 < 2e-16
## ClaimantTypeReport Only                                                 9.01e-11
## ClaimantAge_at_DOI                                                      0.073827
##                                                                            
## (Intercept)                                                                
## 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                
## BodyPartInternal 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                                                            *  
## BodyPartPelvis                                                             
## BodyPartSacrum And Coccyx                                                  
## BodyPartShoulder(S)                                                     .  
## BodyPartSkull                                                              
## BodyPartSoft Tissue-Head                                                ***
## BodyPartSoft Tissue-Neck                                                .  
## BodyPartSpinal Cord-Trunk                                                  
## BodyPartTeeth                                                           .  
## BodyPartThumb                                                           .  
## BodyPartToes                                                               
## BodyPartTrachea                                                            
## BodyPartUpper Arm                                                       ***
## BodyPartUpper Back Area                                                    
## BodyPartUpper Leg                                                       .  
## BodyPartVertebrae                                                       *  
## BodyPartWhole Body                                                      *  
## BodyPartWrist                                                           ***
## BodyPartRegionLower Extremities                                            
## BodyPartRegionMultiple Body Parts                                          
## BodyPartRegionNeck                                                         
## BodyPartRegionNon-Standard Code                                            
## BodyPartRegionTrunk                                                        
## BodyPartRegionUpper Extremities                                            
## InjuryNatureAll Other Specific Injuries, Noc                            *  
## InjuryNatureAmputation                                                     
## InjuryNatureAngina Pectoris                                                
## InjuryNatureAsbestosis                                                  *  
## InjuryNatureAsphyxiation                                                   
## InjuryNatureBlack Lung                                                     
## InjuryNatureBurn                                                           
## InjuryNatureCancer                                                         
## InjuryNatureCarpal Tunnel Syndrome                                         
## InjuryNatureConcussion                                                     
## InjuryNatureContagious Disease                                             
## InjuryNatureContusion                                                      
## InjuryNatureCrushing                                                       
## InjuryNatureDermatitis                                                     
## InjuryNatureDislocation                                                    
## InjuryNatureDust Disease, NOC                                              
## InjuryNatureElectric Shock                                                 
## InjuryNatureForeign Body                                                   
## InjuryNatureFracture                                                       
## InjuryNatureFreezing                                                    *  
## InjuryNatureHearing Loss Or Impairment                                  *  
## InjuryNatureHeat Prostration                                               
## InjuryNatureHernia                                                         
## InjuryNatureInfection                                                      
## InjuryNatureInflammation                                                   
## InjuryNatureLaceration                                                     
## InjuryNatureLoss of Hearing                                                
## InjuryNatureMental Disorder                                             *  
## InjuryNatureMental Stress                                                  
## InjuryNatureMultiple Injuries Including Both Physical and Psychological    
## InjuryNatureMultiple Physical Injuries Only                                
## InjuryNatureMyocardial Infarction                                          
## InjuryNatureNo Physical Injury                                             
## InjuryNatureNon-Standard Code                                              
## InjuryNatureNot Available                                                  
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      .  
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)                
## InjuryNaturePuncture                                                       
## InjuryNatureRadiation                                                      
## InjuryNatureRespiratory Disorders                                          
## InjuryNatureRupture                                                        
## InjuryNatureSeverance                                                   ** 
## InjuryNatureSprain                                                         
## InjuryNatureStrain                                                         
## InjuryNatureSyncope                                                        
## InjuryNatureVascular                                                       
## InjuryNatureVDT-Related Disease                                            
## InjuryNatureVision Loss                                                    
## ClaimantTypeMedical Only                                                ***
## ClaimantTypeReport Only                                                 ***
## ClaimantAge_at_DOI                                                      .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 883.8 on 34349 degrees of freedom
##   (21542 observations deleted due to missingness)
## Multiple R-squared:  0.1704, Adjusted R-squared:  0.1678 
## F-statistic: 67.82 on 104 and 34349 DF,  p-value: < 2.2e-16

3.5 Ajustar el modelo

3.6 Costs of Claims

regresion <- lm(Total_Paid_calc~OtherPaid + IndemnityPaid +Total_Incurred_Cost_Claim ,data=base_act_4_6)
summary(regresion)
## 
## Call:
## lm(formula = Total_Paid_calc ~ OtherPaid + IndemnityPaid + Total_Incurred_Cost_Claim, 
##     data = base_act_4_6)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -1.798e-07 -2.000e-12 -1.000e-12 -1.000e-12  2.377e-07 
## 
## Coefficients:
##                            Estimate Std. Error   t value Pr(>|t|)    
## (Intercept)               8.855e-11  5.412e-12 1.636e+01   <2e-16 ***
## OtherPaid                 1.000e+00  3.332e-16 3.001e+15   <2e-16 ***
## IndemnityPaid             1.000e+00  4.455e-16 2.245e+15   <2e-16 ***
## Total_Incurred_Cost_Claim 1.960e-17  2.205e-16 8.900e-02    0.929    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.261e-09 on 55992 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 2.477e+31 on 3 and 55992 DF,  p-value: < 2.2e-16

3.7 Time To Process Claims

regresion2 <- lm(tiempo_de_procesamiento_days ~ BodyPart + ClaimantType, data = base_act_4_6)
summary(regresion2)
## 
## Call:
## lm(formula = tiempo_de_procesamiento_days ~ BodyPart + ClaimantType, 
##     data = base_act_4_6)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -28081.6   -849.5   -119.0    576.6  11331.8 
## 
## Coefficients:
##                                                                      Estimate
## (Intercept)                                                         1002.1819
## BodyPartAnkle                                                        322.3060
## BodyPartArtificial Appliance                                          -0.6105
## BodyPartBody Systems and Multiple Body Systems                       315.0659
## BodyPartBrain                                                         61.4848
## BodyPartButtocks                                                      49.0077
## BodyPartChest                                                        317.9346
## BodyPartDisc-Trunk                                                   479.5033
## BodyPartEar(S)                                                       455.5269
## BodyPartElbow                                                        112.3145
## BodyPartEyes                                                         385.5396
## BodyPartFacial Bones                                                 299.2545
## BodyPartFinger(S)                                                    503.0461
## BodyPartFoot                                                         329.3083
## BodyPartGreat Toe                                                   -117.4582
## BodyPartHand                                                         394.6121
## BodyPartHeart                                                        -73.0009
## BodyPartHip                                                          432.8207
## BodyPartInsufficient Info to Properly Identify?Unclassified          380.0168
## BodyPartInternal Organs                                             1154.9771
## BodyPartKnee                                                         289.7935
## BodyPartLarynx                                                      -174.8605
## BodyPartLower Arm                                                     16.4740
## BodyPartLower Back Area                                              430.5773
## BodyPartLower Leg                                                    122.0593
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          146.8892
## BodyPartLungs                                                        -89.4470
## BodyPartMouth                                                        647.5287
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  636.8851
## BodyPartMultiple Head Injury                                         354.0325
## BodyPartMultiple Lower Extremities                                   764.7961
## BodyPartMultiple Neck Injury                                         265.5885
## BodyPartMultiple Trunk                                               783.4030
## BodyPartMultiple Upper Extremities                                  1179.0864
## BodyPartNo Physical Injury                                           273.5873
## BodyPartNon-Standard Code                                           2430.4420
## BodyPartNose                                                         345.4083
## BodyPartPelvis                                                       -85.7689
## BodyPartSacrum And Coccyx                                           -236.5589
## BodyPartShoulder(S)                                                   12.0675
## BodyPartSkull                                                         22.9813
## BodyPartSoft Tissue-Head                                            2809.8181
## BodyPartSoft Tissue-Neck                                            -134.3200
## BodyPartSpinal Cord-Trunk                                            -26.7734
## BodyPartTeeth                                                       -111.2717
## BodyPartThumb                                                        117.5862
## BodyPartToes                                                         275.1609
## BodyPartTrachea                                                      140.4292
## BodyPartUpper Arm                                                    830.5401
## BodyPartUpper Back Area                                               80.9959
## BodyPartUpper Leg                                                    140.6244
## BodyPartVertebrae                                                    644.2645
## BodyPartWhole Body                                                   876.1514
## BodyPartWrist                                                        298.0876
## ClaimantTypeMedical Only                                            -154.6428
## ClaimantTypeReport Only                                              -62.4011
##                                                                     Std. Error
## (Intercept)                                                            49.5561
## BodyPartAnkle                                                          53.7020
## BodyPartArtificial Appliance                                          358.6766
## BodyPartBody Systems and Multiple Body Systems                         81.9628
## BodyPartBrain                                                         617.4217
## BodyPartButtocks                                                       96.3325
## BodyPartChest                                                          60.7077
## BodyPartDisc-Trunk                                                     67.0868
## BodyPartEar(S)                                                         91.5147
## BodyPartElbow                                                          62.1020
## BodyPartEyes                                                           54.2407
## BodyPartFacial Bones                                                   72.0283
## BodyPartFinger(S)                                                      51.7801
## BodyPartFoot                                                           55.7742
## BodyPartGreat Toe                                                     118.7902
## BodyPartHand                                                           52.4309
## BodyPartHeart                                                         255.9932
## BodyPartHip                                                            67.4145
## BodyPartInsufficient Info to Properly Identify?Unclassified            69.0334
## BodyPartInternal Organs                                               125.5394
## BodyPartKnee                                                           51.3693
## BodyPartLarynx                                                        755.3329
## BodyPartLower Arm                                                      58.6077
## BodyPartLower Back Area                                                51.0431
## BodyPartLower Leg                                                      59.1066
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)            62.4446
## BodyPartLungs                                                          79.1904
## BodyPartMouth                                                          77.8510
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)    50.7613
## BodyPartMultiple Head Injury                                           55.0940
## BodyPartMultiple Lower Extremities                                     64.4578
## BodyPartMultiple Neck Injury                                           58.5282
## BodyPartMultiple Trunk                                                119.8085
## BodyPartMultiple Upper Extremities                                     59.8866
## BodyPartNo Physical Injury                                             64.5025
## BodyPartNon-Standard Code                                              52.7917
## BodyPartNose                                                           84.1956
## BodyPartPelvis                                                        124.3108
## BodyPartSacrum And Coccyx                                             179.7131
## BodyPartShoulder(S)                                                    54.0592
## BodyPartSkull                                                         186.7012
## BodyPartSoft Tissue-Head                                             1067.1068
## BodyPartSoft Tissue-Neck                                               73.2923
## BodyPartSpinal Cord-Trunk                                             194.7216
## BodyPartTeeth                                                         108.1936
## BodyPartThumb                                                          58.1017
## BodyPartToes                                                           78.8848
## BodyPartTrachea                                                       358.6707
## BodyPartUpper Arm                                                      59.7532
## BodyPartUpper Back Area                                                73.7573
## BodyPartUpper Leg                                                      72.1173
## BodyPartVertebrae                                                     380.0392
## BodyPartWhole Body                                                    617.4217
## BodyPartWrist                                                          54.1792
## ClaimantTypeMedical Only                                               11.5447
## ClaimantTypeReport Only                                                21.9601
##                                                                     t value
## (Intercept)                                                          20.223
## BodyPartAnkle                                                         6.002
## BodyPartArtificial Appliance                                         -0.002
## BodyPartBody Systems and Multiple Body Systems                        3.844
## BodyPartBrain                                                         0.100
## BodyPartButtocks                                                      0.509
## BodyPartChest                                                         5.237
## BodyPartDisc-Trunk                                                    7.148
## BodyPartEar(S)                                                        4.978
## BodyPartElbow                                                         1.809
## BodyPartEyes                                                          7.108
## BodyPartFacial Bones                                                  4.155
## BodyPartFinger(S)                                                     9.715
## BodyPartFoot                                                          5.904
## BodyPartGreat Toe                                                    -0.989
## BodyPartHand                                                          7.526
## BodyPartHeart                                                        -0.285
## BodyPartHip                                                           6.420
## BodyPartInsufficient Info to Properly Identify?Unclassified           5.505
## BodyPartInternal Organs                                               9.200
## BodyPartKnee                                                          5.641
## BodyPartLarynx                                                       -0.232
## BodyPartLower Arm                                                     0.281
## BodyPartLower Back Area                                               8.436
## BodyPartLower Leg                                                     2.065
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)           2.352
## BodyPartLungs                                                        -1.130
## BodyPartMouth                                                         8.318
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  12.547
## BodyPartMultiple Head Injury                                          6.426
## BodyPartMultiple Lower Extremities                                   11.865
## BodyPartMultiple Neck Injury                                          4.538
## BodyPartMultiple Trunk                                                6.539
## BodyPartMultiple Upper Extremities                                   19.689
## BodyPartNo Physical Injury                                            4.242
## BodyPartNon-Standard Code                                            46.038
## BodyPartNose                                                          4.102
## BodyPartPelvis                                                       -0.690
## BodyPartSacrum And Coccyx                                            -1.316
## BodyPartShoulder(S)                                                   0.223
## BodyPartSkull                                                         0.123
## BodyPartSoft Tissue-Head                                              2.633
## BodyPartSoft Tissue-Neck                                             -1.833
## BodyPartSpinal Cord-Trunk                                            -0.137
## BodyPartTeeth                                                        -1.028
## BodyPartThumb                                                         2.024
## BodyPartToes                                                          3.488
## BodyPartTrachea                                                       0.392
## BodyPartUpper Arm                                                    13.900
## BodyPartUpper Back Area                                               1.098
## BodyPartUpper Leg                                                     1.950
## BodyPartVertebrae                                                     1.695
## BodyPartWhole Body                                                    1.419
## BodyPartWrist                                                         5.502
## ClaimantTypeMedical Only                                            -13.395
## ClaimantTypeReport Only                                              -2.842
##                                                                     Pr(>|t|)
## (Intercept)                                                          < 2e-16
## BodyPartAnkle                                                       1.96e-09
## BodyPartArtificial Appliance                                        0.998642
## BodyPartBody Systems and Multiple Body Systems                      0.000121
## BodyPartBrain                                                       0.920676
## BodyPartButtocks                                                    0.610940
## BodyPartChest                                                       1.64e-07
## BodyPartDisc-Trunk                                                  8.95e-13
## BodyPartEar(S)                                                      6.46e-07
## BodyPartElbow                                                       0.070527
## BodyPartEyes                                                        1.19e-12
## BodyPartFacial Bones                                                3.26e-05
## BodyPartFinger(S)                                                    < 2e-16
## BodyPartFoot                                                        3.56e-09
## BodyPartGreat Toe                                                   0.322772
## BodyPartHand                                                        5.30e-14
## BodyPartHeart                                                       0.775517
## BodyPartHip                                                         1.37e-10
## BodyPartInsufficient Info to Properly Identify?Unclassified         3.71e-08
## BodyPartInternal Organs                                              < 2e-16
## BodyPartKnee                                                        1.70e-08
## BodyPartLarynx                                                      0.816926
## BodyPartLower Arm                                                   0.778643
## BodyPartLower Back Area                                              < 2e-16
## BodyPartLower Leg                                                   0.038921
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)         0.018661
## BodyPartLungs                                                       0.258684
## BodyPartMouth                                                        < 2e-16
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  < 2e-16
## BodyPartMultiple Head Injury                                        1.32e-10
## BodyPartMultiple Lower Extremities                                   < 2e-16
## BodyPartMultiple Neck Injury                                        5.70e-06
## BodyPartMultiple Trunk                                              6.26e-11
## BodyPartMultiple Upper Extremities                                   < 2e-16
## BodyPartNo Physical Injury                                          2.22e-05
## BodyPartNon-Standard Code                                            < 2e-16
## BodyPartNose                                                        4.09e-05
## BodyPartPelvis                                                      0.490225
## BodyPartSacrum And Coccyx                                           0.188074
## BodyPartShoulder(S)                                                 0.823359
## BodyPartSkull                                                       0.902035
## BodyPartSoft Tissue-Head                                            0.008463
## BodyPartSoft Tissue-Neck                                            0.066858
## BodyPartSpinal Cord-Trunk                                           0.890639
## BodyPartTeeth                                                       0.303743
## BodyPartThumb                                                       0.042996
## BodyPartToes                                                        0.000487
## BodyPartTrachea                                                     0.695409
## BodyPartUpper Arm                                                    < 2e-16
## BodyPartUpper Back Area                                             0.272148
## BodyPartUpper Leg                                                   0.051188
## BodyPartVertebrae                                                   0.090032
## BodyPartWhole Body                                                  0.155890
## BodyPartWrist                                                       3.77e-08
## ClaimantTypeMedical Only                                             < 2e-16
## ClaimantTypeReport Only                                             0.004491
##                                                                        
## (Intercept)                                                         ***
## 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         ***
## BodyPartInternal 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                                                        ***
## BodyPartPelvis                                                         
## BodyPartSacrum And Coccyx                                              
## BodyPartShoulder(S)                                                    
## BodyPartSkull                                                          
## BodyPartSoft Tissue-Head                                            ** 
## BodyPartSoft Tissue-Neck                                            .  
## BodyPartSpinal Cord-Trunk                                              
## BodyPartTeeth                                                          
## BodyPartThumb                                                       *  
## BodyPartToes                                                        ***
## BodyPartTrachea                                                        
## BodyPartUpper Arm                                                   ***
## BodyPartUpper Back Area                                                
## BodyPartUpper Leg                                                   .  
## BodyPartVertebrae                                                   .  
## BodyPartWhole Body                                                     
## BodyPartWrist                                                       ***
## ClaimantTypeMedical Only                                            ***
## ClaimantTypeReport Only                                             ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1066 on 55317 degrees of freedom
##   (623 observations deleted due to missingness)
## Multiple R-squared:  0.2412, Adjusted R-squared:  0.2405 
## F-statistic: 319.8 on 55 and 55317 DF,  p-value: < 2.2e-16

3.8 CONSTRUIR UN MODELO PREDICTIVO

3.9 Costs of Claims

datos <- data.frame(OtherPaid=1564.22,IndemnityPaid=2308.91,Total_Incurred_Cost_Claim=3873.13,Total_Paid_calc=3873.13)
predict(regresion,datos)
##       1 
## 3873.13
datos
##   OtherPaid IndemnityPaid Total_Incurred_Cost_Claim Total_Paid_calc
## 1   1564.22       2308.91                   3873.13         3873.13

3.10 Time To Process Claims

datos2 <- data.frame(BodyPart="Shoulder(S)",ClaimantType="Indemnity",tiempo_de_procesamiento_days=2080)
predict(regresion2,datos2)
##        1 
## 1014.249
datos
##   OtherPaid IndemnityPaid Total_Incurred_Cost_Claim Total_Paid_calc
## 1   1564.22       2308.91                   3873.13         3873.13

3.11 VISUALIZACIÓN DE REGRESIÓN LINEAL

3.12 Costs of Claims

library(ggplot2)
ggplot(base_act_4_6, aes(x = OtherPaid, y = IndemnityPaid)) +
  geom_point() +  # Puntos de dispersión
  geom_smooth(method = "lm", se = FALSE, color = "blue") +  # Línea de regresión
  labs(title = "Gráfico de Regresión Lineal",
       x = "IndemnityPaid",
       y = "OtherPaid") +
  geom_point(data = datos, aes(x = IndemnityPaid, y = OtherPaid), color = "red")  # Puntos de predicción en rojo

3.13 Time To Process Claims

library(ggplot2)
ggplot(base_act_4_6, aes(x = BodyPart, y =tiempo_de_procesamiento_days)) +
  geom_point() +  # Puntos de dispersión
  geom_smooth(method = "lm", se = FALSE, color = "blue") +  # Línea de regresión
  labs(title = "Gráfico de Regresión Lineal",
       x = "BodyPart",
       y = "tiempo_de_procesamiento_days") +
  geom_point(data = base_act_4_6, aes(x = BodyPart, y = tiempo_de_procesamiento_days), color = "red")
## Warning: Removed 623 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 623 rows containing missing values (`geom_point()`).
## Removed 623 rows containing missing values (`geom_point()`).

LS0tCnRpdGxlOiAiQUNUIDQuNiIKYXV0aG9yOiAiSU1BR086IElOTk9WQVRFIEFORCBHUk9XIENPTlNVTFRJTkcgR1JPVVAiCmRhdGU6ICIyMDIzLTA5LTI3IgpvdXRwdXQ6IAogICAgaHRtbF9kb2N1bWVudDoKICAgICAgdG9jOiBUUlVFCiAgICAgIHRvY19mbG9hdDogVFJVRQogICAgICBjb2RlX2Rvd25sb2FkOiBUUlVFCiAgICAgIHRoZW1lOiAic2ltcGxleCIKICAgICAgaGlnaGxpZ2h0OiAibW9ub2Nocm9tZSIKLS0tCgoKPGNlbnRlcj4KIyA8c3BhbiBzdHlsZT0iY29sb3I6IGJsdW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