Importar base de datos

file.choose()
## [1] "C:\\Users\\ximen\\OneDrive\\Escritorio\\Modelo_predictivo_seguros.Rmd"
bd <- read.csv("C:\\Users\\ximen\\Downloads\\seguros.csv")

summary(bd)
##     ClaimID           TotalPaid       TotalReserves     TotalRecovery      
##  Min.   :  777632   Min.   :      0   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  800748   1st Qu.:     83   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  812128   Median :    271   Median :      0   Median :     0.00  
##  Mean   : 1864676   Mean   :  10404   Mean   :   3368   Mean   :    66.05  
##  3rd Qu.:  824726   3rd Qu.:   1122   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203364   Max.   :4527291   Max.   :1529053   Max.   :100000.00  
##                                                                            
##  IndemnityPaid      OtherPaid       TotalIncurredCost ClaimStatus       
##  Min.   :     0   Min.   :      0   Min.   : -10400   Length:31619      
##  1st Qu.:     0   1st Qu.:     80   1st Qu.:     80   Class :character  
##  Median :     0   Median :    265   Median :    266   Mode  :character  
##  Mean   :  4977   Mean   :   5427   Mean   :  13706                     
##  3rd Qu.:     0   3rd Qu.:   1023   3rd Qu.:   1098                     
##  Max.   :640732   Max.   :4129915   Max.   :4734750                     
##                                                                         
##  IncidentDate       IncidentDescription ReturnToWorkDate   ClaimantOpenedDate
##  Length:31619       Length:31619        Length:31619       Length:31619      
##  Class :character   Class :character    Class :character   Class :character  
##  Mode  :character   Mode  :character    Mode  :character   Mode  :character  
##                                                                              
##                                                                              
##                                                                              
##                                                                              
##  ClaimantClosedDate EmployerNotificationDate ReceivedDate      
##  Length:31619       Length:31619             Length:31619      
##  Class :character   Class :character         Class :character  
##  Mode  :character   Mode  :character         Mode  :character  
##                                                                
##                                                                
##                                                                
##                                                                
##     IsDenied       Transaction_Time Procesing_Time     ClaimantAge_at_DOI
##  Min.   :0.00000   Min.   :    0    Min.   :    0.00   Min.   :14.0      
##  1st Qu.:0.00000   1st Qu.:  211    1st Qu.:    4.00   1st Qu.:33.0      
##  Median :0.00000   Median :  780    Median :   10.00   Median :42.0      
##  Mean   :0.04463   Mean   : 1004    Mean   :   62.99   Mean   :41.6      
##  3rd Qu.:0.00000   3rd Qu.: 1440    3rd Qu.:   24.00   3rd Qu.:50.0      
##  Max.   :1.00000   Max.   :16428    Max.   :11558.00   Max.   :94.0      
##                    NA's   :614                                           
##     Gender          ClaimantType       InjuryNature       BodyPartRegion    
##  Length:31619       Length:31619       Length:31619       Length:31619      
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##    BodyPart         AverageWeeklyWage1    ClaimID1        BillReviewALE    
##  Length:31619       Min.   : 100.0     Min.   :  777632   Min.   : -448.0  
##  Class :character   1st Qu.: 492.0     1st Qu.:  800748   1st Qu.:   16.0  
##  Mode  :character   Median : 492.0     Median :  812128   Median :   24.0  
##                     Mean   : 536.5     Mean   : 1864676   Mean   :  188.7  
##                     3rd Qu.: 492.0     3rd Qu.:  824726   3rd Qu.:   64.1  
##                     Max.   :8613.5     Max.   :62203364   Max.   :46055.3  
##                                                           NA's   :14912    
##     Hospital         PhysicianOutpatient       Rx          
##  Min.   : -12570.4   Min.   :   -549.5   Min.   :  -160.7  
##  1st Qu.:    210.5   1st Qu.:    105.8   1st Qu.:    22.9  
##  Median :    613.9   Median :    218.0   Median :    61.5  
##  Mean   :   5113.2   Mean   :   1813.2   Mean   :  1695.2  
##  3rd Qu.:   2349.1   3rd Qu.:    680.6   3rd Qu.:   189.0  
##  Max.   :2759604.0   Max.   :1219766.6   Max.   :631635.5  
##  NA's   :19655       NA's   :2329        NA's   :20730

Herramienta: “Generador de Valor de Datos”

Paso 1. Definir el área de negocios que deseamos impactar o mejorar y su KPI.

Recursos humanos. Incrementar las medidas de seguridad de los empleados y conocer su opinión a través de encuestas de satisfacción.

Paso 2. Seleccionar plantilla (-s) para crear valor a partir de los datos de los clientes.

Visión / Segmentación / Personalización / Contextualización

Paso 3. Generar ideas o conceptos específicos.

  1. Crear nuevas formas de seguridad en cualquiera que sea la empresa.
  2. Generar encuestas que se realicen cada 6 meses donde los empleados puedan dar su opinión acerca de su trabajo y su seguridad, así como dar sugerencias.

Paso 4. Reunir los datos requeridos.

Los datos requeridos son el número de empleados, el nombre o identificador de cada uno, incidentes ocurridos con anterioridad, días de incapacidad, y género con el fin de identicar que género es el más expuesto.

Paso 5. Plan de ejecución.

De acuerdo a los resultados, los hombres son los que se encuentran más propensos a sufrir lesiones, por lo tanto, es necesario brindarles mayor seguridad y ofrecer las encuestas de satsfacción para ver si esta dando resultados en cuanto al KPI.

Agregar una columna de dias de incapacidad

(ReturnToWorkDate-IncidentDate)

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
#count(bd, IncidentDescription, sort = TRUE)
#count(bd, ClaimantType, sort = TRUE)
#count(bd, InjuryNature, sort = TRUE)
#count(bd, BodyPartRegion, sort = TRUE)
#count(bd, BodyPart, sort = TRUE)

Limpia nombres de las columnas

#install.packages("janitor")
library("janitor")
## 
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
## 
##     chisq.test, fisher.test
bd<- clean_names(bd)

Entender base de datos

resumen <-summary(bd)
resumen
##     claim_id          total_paid      total_reserves    total_recovery     
##  Min.   :  777632   Min.   :      0   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  800748   1st Qu.:     83   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  812128   Median :    271   Median :      0   Median :     0.00  
##  Mean   : 1864676   Mean   :  10404   Mean   :   3368   Mean   :    66.05  
##  3rd Qu.:  824726   3rd Qu.:   1122   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62203364   Max.   :4527291   Max.   :1529053   Max.   :100000.00  
##                                                                            
##  indemnity_paid     other_paid      total_incurred_cost claim_status      
##  Min.   :     0   Min.   :      0   Min.   : -10400     Length:31619      
##  1st Qu.:     0   1st Qu.:     80   1st Qu.:     80     Class :character  
##  Median :     0   Median :    265   Median :    266     Mode  :character  
##  Mean   :  4977   Mean   :   5427   Mean   :  13706                       
##  3rd Qu.:     0   3rd Qu.:   1023   3rd Qu.:   1098                       
##  Max.   :640732   Max.   :4129915   Max.   :4734750                       
##                                                                           
##  incident_date      incident_description return_to_work_date
##  Length:31619       Length:31619         Length:31619       
##  Class :character   Class :character     Class :character   
##  Mode  :character   Mode  :character     Mode  :character   
##                                                             
##                                                             
##                                                             
##                                                             
##  claimant_opened_date claimant_closed_date employer_notification_date
##  Length:31619         Length:31619         Length:31619              
##  Class :character     Class :character     Class :character          
##  Mode  :character     Mode  :character     Mode  :character          
##                                                                      
##                                                                      
##                                                                      
##                                                                      
##  received_date        is_denied       transaction_time procesing_time    
##  Length:31619       Min.   :0.00000   Min.   :    0    Min.   :    0.00  
##  Class :character   1st Qu.:0.00000   1st Qu.:  211    1st Qu.:    4.00  
##  Mode  :character   Median :0.00000   Median :  780    Median :   10.00  
##                     Mean   :0.04463   Mean   : 1004    Mean   :   62.99  
##                     3rd Qu.:0.00000   3rd Qu.: 1440    3rd Qu.:   24.00  
##                     Max.   :1.00000   Max.   :16428    Max.   :11558.00  
##                                       NA's   :614                        
##  claimant_age_at_doi    gender          claimant_type      injury_nature     
##  Min.   :14.0        Length:31619       Length:31619       Length:31619      
##  1st Qu.:33.0        Class :character   Class :character   Class :character  
##  Median :42.0        Mode  :character   Mode  :character   Mode  :character  
##  Mean   :41.6                                                                
##  3rd Qu.:50.0                                                                
##  Max.   :94.0                                                                
##                                                                              
##  body_part_region    body_part         average_weekly_wage1   claim_id1       
##  Length:31619       Length:31619       Min.   : 100.0       Min.   :  777632  
##  Class :character   Class :character   1st Qu.: 492.0       1st Qu.:  800748  
##  Mode  :character   Mode  :character   Median : 492.0       Median :  812128  
##                                        Mean   : 536.5       Mean   : 1864676  
##                                        3rd Qu.: 492.0       3rd Qu.:  824726  
##                                        Max.   :8613.5       Max.   :62203364  
##                                                                               
##  bill_review_ale      hospital         physician_outpatient       rx          
##  Min.   : -448.0   Min.   : -12570.4   Min.   :   -549.5    Min.   :  -160.7  
##  1st Qu.:   16.0   1st Qu.:    210.5   1st Qu.:    105.8    1st Qu.:    22.9  
##  Median :   24.0   Median :    613.9   Median :    218.0    Median :    61.5  
##  Mean   :  188.7   Mean   :   5113.2   Mean   :   1813.2    Mean   :  1695.2  
##  3rd Qu.:   64.1   3rd Qu.:   2349.1   3rd Qu.:    680.6    3rd Qu.:   189.0  
##  Max.   :46055.3   Max.   :2759604.0   Max.   :1219766.6    Max.   :631635.5  
##  NA's   :14912     NA's   :19655       NA's   :2329         NA's   :20730

Generar modelo predictivo

regresion <- lm (total_incurred_cost ~claimant_age_at_doi + gender + claimant_type + injury_nature + body_part_region + body_part + average_weekly_wage1, data =bd)
summary (regresion)
## 
## Call:
## lm(formula = total_incurred_cost ~ claimant_age_at_doi + gender + 
##     claimant_type + injury_nature + body_part_region + body_part + 
##     average_weekly_wage1, data = bd)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -477362  -12697    -550    5168 4673472 
## 
## Coefficients: (6 not defined because of singularities)
##                                                                            Estimate
## (Intercept)                                                              -2.378e+04
## claimant_age_at_doi                                                       1.562e+02
## genderMale                                                                1.284e+03
## genderNot Available                                                       6.689e+04
## claimant_typeMedical Only                                                -5.558e+04
## claimant_typeReport Only                                                 -5.011e+04
## injury_natureAll Other Specific Injuries, Noc                             5.673e+04
## injury_natureAmputation                                                   3.981e+04
## injury_natureAngina Pectoris                                             -3.435e+03
## injury_natureAsbestosis                                                   6.414e+04
## injury_natureAsphyxiation                                                 6.103e+04
## injury_natureBlack Lung                                                   6.015e+04
## injury_natureBurn                                                         5.822e+04
## injury_natureCancer                                                       6.751e+04
## injury_natureCarpal Tunnel Syndrome                                       3.969e+04
## injury_natureConcussion                                                   8.513e+04
## injury_natureContagious Disease                                           7.377e+04
## injury_natureContusion                                                    5.310e+04
## injury_natureCrushing                                                     5.680e+04
## injury_natureDermatitis                                                   5.106e+04
## injury_natureDislocation                                                  3.829e+04
## injury_natureDust Disease, NOC                                            5.988e+04
## injury_natureElectric Shock                                               6.393e+04
## injury_natureForeign Body                                                 5.245e+04
## injury_natureFracture                                                     5.006e+04
## injury_natureFreezing                                                     4.739e+04
## injury_natureHearing Loss Or Impairment                                   4.654e+04
## injury_natureHeat Prostration                                             4.574e+04
## injury_natureHernia                                                       2.304e+04
## injury_natureInfection                                                    4.686e+04
## injury_natureInflammation                                                 6.115e+04
## injury_natureLaceration                                                   5.288e+04
## injury_natureLoss of Hearing                                              4.266e+04
## injury_natureMental Disorder                                             -3.827e+04
## injury_natureMental Stress                                                5.016e+04
## injury_natureMultiple Injuries Including Both Physical and Psychological  3.957e+04
## injury_natureMultiple Physical Injuries Only                              5.938e+04
## injury_natureMyocardial Infarction                                        3.203e+04
## injury_natureNo Physical Injury                                           4.793e+04
## injury_natureNon-Standard Code                                            3.735e+04
## injury_natureNot Available                                                5.287e+04
## injury_naturePoisoning?Chemical (Other Than Metals)                       5.778e+04
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)              4.645e+04
## injury_naturePuncture                                                     5.340e+04
## injury_natureRadiation                                                    5.488e+04
## injury_natureRespiratory Disorders                                        5.089e+04
## injury_natureRupture                                                      6.257e+04
## injury_natureSeverance                                                    8.690e+04
## injury_natureSprain                                                       5.235e+04
## injury_natureStrain                                                       4.740e+04
## injury_natureSyncope                                                      4.655e+04
## injury_natureVascular                                                     2.162e+02
## injury_natureVDT-Related Disease                                          6.035e+02
## injury_natureVision Loss                                                  5.446e+04
## body_part_regionLower Extremities                                         1.748e+04
## body_part_regionMultiple Body Parts                                       2.913e+05
## body_part_regionNeck                                                      5.097e+04
## body_part_regionNon-Standard Code                                         5.759e+03
## body_part_regionTrunk                                                     8.666e+03
## body_part_regionUpper Extremities                                         1.304e+04
## body_partAnkle                                                           -6.760e+03
## body_partArtificial Appliance                                            -2.843e+05
## body_partBody Systems and Multiple Body Systems                          -2.765e+05
## body_partBrain                                                            4.126e+05
## body_partButtocks                                                         1.879e+04
## body_partChest                                                            3.892e+03
## body_partDisc-Trunk                                                       1.761e+04
## body_partEar(S)                                                           1.043e+04
## body_partElbow                                                           -1.760e+02
## body_partEyes                                                             1.369e+04
## body_partFacial Bones                                                     1.372e+04
## body_partFinger(S)                                                       -2.799e+03
## body_partFoot                                                            -8.480e+03
## body_partGreat Toe                                                       -8.733e+03
## body_partHand                                                            -2.864e+03
## body_partHeart                                                            6.144e+03
## body_partHip                                                              6.854e+03
## body_partInsufficient Info to Properly Identify?Unclassified             -2.826e+05
## body_partInternal Organs                                                  1.228e+04
## body_partKnee                                                            -1.194e+03
## body_partLarynx                                                          -8.529e+04
## body_partLower Arm                                                       -2.674e+03
## body_partLower Back Area                                                  2.532e+04
## body_partLower Leg                                                       -5.612e+01
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              1.772e+04
## body_partLungs                                                           -4.964e+02
## body_partMouth                                                            1.350e+04
## body_partMultiple Body Parts (Including Body Systems and Body Parts)     -2.711e+05
## body_partMultiple Head Injury                                             1.652e+04
## body_partMultiple Lower Extremities                                       1.911e+03
## body_partMultiple Neck Injury                                            -3.185e+04
## body_partMultiple Trunk                                                   6.008e+03
## body_partMultiple Upper Extremities                                       4.154e+03
## body_partNo Physical Injury                                              -2.756e+05
## body_partNon-Standard Code                                                       NA
## body_partNose                                                             9.839e+03
## body_partPelvis                                                           7.507e+02
## body_partSacrum And Coccyx                                                1.936e+04
## body_partShoulder(S)                                                      6.654e+03
## body_partSkull                                                            4.699e+04
## body_partSoft Tissue-Head                                                -1.759e+04
## body_partSoft Tissue-Neck                                                -1.805e+04
## body_partSpinal Cord-Trunk                                                9.208e+04
## body_partTeeth                                                                   NA
## body_partThumb                                                           -2.801e+03
## body_partToes                                                            -8.322e+03
## body_partTrachea                                                         -5.600e+04
## body_partUpper Arm                                                        3.218e+03
## body_partUpper Back Area                                                  6.851e+03
## body_partUpper Leg                                                               NA
## body_partVertebrae                                                               NA
## body_partWhole Body                                                              NA
## body_partWrist                                                                   NA
## average_weekly_wage1                                                      8.033e+00
##                                                                          Std. Error
## (Intercept)                                                               8.063e+04
## claimant_age_at_doi                                                       4.036e+01
## genderMale                                                                9.244e+02
## genderNot Available                                                       8.412e+03
## claimant_typeMedical Only                                                 1.152e+03
## claimant_typeReport Only                                                  2.596e+03
## injury_natureAll Other Specific Injuries, Noc                             8.019e+04
## injury_natureAmputation                                                   8.502e+04
## injury_natureAngina Pectoris                                              9.965e+04
## injury_natureAsbestosis                                                   8.190e+04
## injury_natureAsphyxiation                                                 1.134e+05
## injury_natureBlack Lung                                                   1.134e+05
## injury_natureBurn                                                         8.029e+04
## injury_natureCancer                                                       8.962e+04
## injury_natureCarpal Tunnel Syndrome                                       8.036e+04
## injury_natureConcussion                                                   8.056e+04
## injury_natureContagious Disease                                           8.067e+04
## injury_natureContusion                                                    8.018e+04
## injury_natureCrushing                                                     8.045e+04
## injury_natureDermatitis                                                   8.026e+04
## injury_natureDislocation                                                  8.043e+04
## injury_natureDust Disease, NOC                                            9.279e+04
## injury_natureElectric Shock                                               8.116e+04
## injury_natureForeign Body                                                 8.024e+04
## injury_natureFracture                                                     8.022e+04
## injury_natureFreezing                                                     9.252e+04
## injury_natureHearing Loss Or Impairment                                   8.260e+04
## injury_natureHeat Prostration                                             8.102e+04
## injury_natureHernia                                                       8.088e+04
## injury_natureInfection                                                    8.057e+04
## injury_natureInflammation                                                 8.029e+04
## injury_natureLaceration                                                   8.019e+04
## injury_natureLoss of Hearing                                              8.309e+04
## injury_natureMental Disorder                                              8.799e+04
## injury_natureMental Stress                                                8.077e+04
## injury_natureMultiple Injuries Including Both Physical and Psychological  8.279e+04
## injury_natureMultiple Physical Injuries Only                              8.025e+04
## injury_natureMyocardial Infarction                                        8.664e+04
## injury_natureNo Physical Injury                                           8.011e+04
## injury_natureNon-Standard Code                                            8.082e+04
## injury_natureNot Available                                                1.133e+05
## injury_naturePoisoning?Chemical (Other Than Metals)                       8.081e+04
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)              8.261e+04
## injury_naturePuncture                                                     8.020e+04
## injury_natureRadiation                                                    8.297e+04
## injury_natureRespiratory Disorders                                        8.038e+04
## injury_natureRupture                                                      8.119e+04
## injury_natureSeverance                                                    8.321e+04
## injury_natureSprain                                                       8.019e+04
## injury_natureStrain                                                       8.018e+04
## injury_natureSyncope                                                      8.093e+04
## injury_natureVascular                                                     1.132e+05
## injury_natureVDT-Related Disease                                          1.133e+05
## injury_natureVision Loss                                                  8.347e+04
## body_part_regionLower Extremities                                         9.834e+03
## body_part_regionMultiple Body Parts                                       3.140e+04
## body_part_regionNeck                                                      4.088e+04
## body_part_regionNon-Standard Code                                         1.367e+04
## body_part_regionTrunk                                                     9.718e+03
## body_part_regionUpper Extremities                                         8.743e+03
## body_partAnkle                                                            5.588e+03
## body_partArtificial Appliance                                             4.685e+04
## body_partBody Systems and Multiple Body Systems                           3.117e+04
## body_partBrain                                                            3.768e+04
## body_partButtocks                                                         9.258e+03
## body_partChest                                                            5.913e+03
## body_partDisc-Trunk                                                       7.302e+03
## body_partEar(S)                                                           1.227e+04
## body_partElbow                                                            4.234e+03
## body_partEyes                                                             8.927e+03
## body_partFacial Bones                                                     9.857e+03
## body_partFinger(S)                                                        2.933e+03
## body_partFoot                                                             5.699e+03
## body_partGreat Toe                                                        1.081e+04
## body_partHand                                                             2.960e+03
## body_partHeart                                                            3.530e+04
## body_partHip                                                              6.760e+03
## body_partInsufficient Info to Properly Identify?Unclassified              3.066e+04
## body_partInternal Organs                                                  1.275e+04
## body_partKnee                                                             5.259e+03
## body_partLarynx                                                           8.940e+04
## body_partLower Arm                                                        3.719e+03
## body_partLower Back Area                                                  4.984e+03
## body_partLower Leg                                                        5.884e+03
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              5.937e+03
## body_partLungs                                                            9.118e+03
## body_partMouth                                                            1.054e+04
## body_partMultiple Body Parts (Including Body Systems and Body Parts)      3.026e+04
## body_partMultiple Head Injury                                             8.836e+03
## body_partMultiple Lower Extremities                                       6.542e+03
## body_partMultiple Neck Injury                                             4.016e+04
## body_partMultiple Trunk                                                   1.184e+04
## body_partMultiple Upper Extremities                                       4.255e+03
## body_partNo Physical Injury                                               3.086e+04
## body_partNon-Standard Code                                                       NA
## body_partNose                                                             1.060e+04
## body_partPelvis                                                           1.139e+04
## body_partSacrum And Coccyx                                                1.612e+04
## body_partShoulder(S)                                                      3.078e+03
## body_partSkull                                                            1.638e+04
## body_partSoft Tissue-Head                                                 8.066e+04
## body_partSoft Tissue-Neck                                                 4.032e+04
## body_partSpinal Cord-Trunk                                                1.418e+04
## body_partTeeth                                                                   NA
## body_partThumb                                                            3.799e+03
## body_partToes                                                             7.792e+03
## body_partTrachea                                                          5.036e+04
## body_partUpper Arm                                                        4.484e+03
## body_partUpper Back Area                                                  6.937e+03
## body_partUpper Leg                                                               NA
## body_partVertebrae                                                               NA
## body_partWhole Body                                                              NA
## body_partWrist                                                                   NA
## average_weekly_wage1                                                      2.081e+00
##                                                                          t value
## (Intercept)                                                               -0.295
## claimant_age_at_doi                                                        3.871
## genderMale                                                                 1.389
## genderNot Available                                                        7.952
## claimant_typeMedical Only                                                -48.261
## claimant_typeReport Only                                                 -19.300
## injury_natureAll Other Specific Injuries, Noc                              0.707
## injury_natureAmputation                                                    0.468
## injury_natureAngina Pectoris                                              -0.034
## injury_natureAsbestosis                                                    0.783
## injury_natureAsphyxiation                                                  0.538
## injury_natureBlack Lung                                                    0.530
## injury_natureBurn                                                          0.725
## injury_natureCancer                                                        0.753
## injury_natureCarpal Tunnel Syndrome                                        0.494
## injury_natureConcussion                                                    1.057
## injury_natureContagious Disease                                            0.915
## injury_natureContusion                                                     0.662
## injury_natureCrushing                                                      0.706
## injury_natureDermatitis                                                    0.636
## injury_natureDislocation                                                   0.476
## injury_natureDust Disease, NOC                                             0.645
## injury_natureElectric Shock                                                0.788
## injury_natureForeign Body                                                  0.654
## injury_natureFracture                                                      0.624
## injury_natureFreezing                                                      0.512
## injury_natureHearing Loss Or Impairment                                    0.563
## injury_natureHeat Prostration                                              0.565
## injury_natureHernia                                                        0.285
## injury_natureInfection                                                     0.582
## injury_natureInflammation                                                  0.762
## injury_natureLaceration                                                    0.659
## injury_natureLoss of Hearing                                               0.513
## injury_natureMental Disorder                                              -0.435
## injury_natureMental Stress                                                 0.621
## injury_natureMultiple Injuries Including Both Physical and Psychological   0.478
## injury_natureMultiple Physical Injuries Only                               0.740
## injury_natureMyocardial Infarction                                         0.370
## injury_natureNo Physical Injury                                            0.598
## injury_natureNon-Standard Code                                             0.462
## injury_natureNot Available                                                 0.467
## injury_naturePoisoning?Chemical (Other Than Metals)                        0.715
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)               0.562
## injury_naturePuncture                                                      0.666
## injury_natureRadiation                                                     0.661
## injury_natureRespiratory Disorders                                         0.633
## injury_natureRupture                                                       0.771
## injury_natureSeverance                                                     1.044
## injury_natureSprain                                                        0.653
## injury_natureStrain                                                        0.591
## injury_natureSyncope                                                       0.575
## injury_natureVascular                                                      0.002
## injury_natureVDT-Related Disease                                           0.005
## injury_natureVision Loss                                                   0.652
## body_part_regionLower Extremities                                          1.778
## body_part_regionMultiple Body Parts                                        9.277
## body_part_regionNeck                                                       1.247
## body_part_regionNon-Standard Code                                          0.421
## body_part_regionTrunk                                                      0.892
## body_part_regionUpper Extremities                                          1.491
## body_partAnkle                                                            -1.210
## body_partArtificial Appliance                                             -6.068
## body_partBody Systems and Multiple Body Systems                           -8.871
## body_partBrain                                                            10.951
## body_partButtocks                                                          2.030
## body_partChest                                                             0.658
## body_partDisc-Trunk                                                        2.412
## body_partEar(S)                                                            0.850
## body_partElbow                                                            -0.042
## body_partEyes                                                              1.534
## body_partFacial Bones                                                      1.392
## body_partFinger(S)                                                        -0.954
## body_partFoot                                                             -1.488
## body_partGreat Toe                                                        -0.808
## body_partHand                                                             -0.967
## body_partHeart                                                             0.174
## body_partHip                                                               1.014
## body_partInsufficient Info to Properly Identify?Unclassified              -9.218
## body_partInternal Organs                                                   0.964
## body_partKnee                                                             -0.227
## body_partLarynx                                                           -0.954
## body_partLower Arm                                                        -0.719
## body_partLower Back Area                                                   5.080
## body_partLower Leg                                                        -0.010
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               2.985
## body_partLungs                                                            -0.054
## body_partMouth                                                             1.281
## body_partMultiple Body Parts (Including Body Systems and Body Parts)      -8.957
## body_partMultiple Head Injury                                              1.869
## body_partMultiple Lower Extremities                                        0.292
## body_partMultiple Neck Injury                                             -0.793
## body_partMultiple Trunk                                                    0.508
## body_partMultiple Upper Extremities                                        0.976
## body_partNo Physical Injury                                               -8.930
## body_partNon-Standard Code                                                    NA
## body_partNose                                                              0.929
## body_partPelvis                                                            0.066
## body_partSacrum And Coccyx                                                 1.201
## body_partShoulder(S)                                                       2.162
## body_partSkull                                                             2.868
## body_partSoft Tissue-Head                                                 -0.218
## body_partSoft Tissue-Neck                                                 -0.448
## body_partSpinal Cord-Trunk                                                 6.495
## body_partTeeth                                                                NA
## body_partThumb                                                            -0.737
## body_partToes                                                             -1.068
## body_partTrachea                                                          -1.112
## body_partUpper Arm                                                         0.718
## body_partUpper Back Area                                                   0.988
## body_partUpper Leg                                                            NA
## body_partVertebrae                                                            NA
## body_partWhole Body                                                           NA
## body_partWrist                                                                NA
## average_weekly_wage1                                                       3.860
##                                                                          Pr(>|t|)
## (Intercept)                                                              0.768018
## claimant_age_at_doi                                                      0.000109
## genderMale                                                               0.164980
## genderNot Available                                                      1.90e-15
## claimant_typeMedical Only                                                 < 2e-16
## claimant_typeReport Only                                                  < 2e-16
## injury_natureAll Other Specific Injuries, Noc                            0.479316
## injury_natureAmputation                                                  0.639614
## injury_natureAngina Pectoris                                             0.972499
## injury_natureAsbestosis                                                  0.433548
## injury_natureAsphyxiation                                                0.590606
## injury_natureBlack Lung                                                  0.595936
## injury_natureBurn                                                        0.468425
## injury_natureCancer                                                      0.451230
## injury_natureCarpal Tunnel Syndrome                                      0.621353
## injury_natureConcussion                                                  0.290675
## injury_natureContagious Disease                                          0.360437
## injury_natureContusion                                                   0.507791
## injury_natureCrushing                                                    0.480165
## injury_natureDermatitis                                                  0.524685
## injury_natureDislocation                                                 0.634034
## injury_natureDust Disease, NOC                                           0.518712
## injury_natureElectric Shock                                              0.430906
## injury_natureForeign Body                                                0.513297
## injury_natureFracture                                                    0.532576
## injury_natureFreezing                                                    0.608538
## injury_natureHearing Loss Or Impairment                                  0.573195
## injury_natureHeat Prostration                                            0.572386
## injury_natureHernia                                                      0.775742
## injury_natureInfection                                                   0.560845
## injury_natureInflammation                                                0.446283
## injury_natureLaceration                                                  0.509641
## injury_natureLoss of Hearing                                             0.607631
## injury_natureMental Disorder                                             0.663656
## injury_natureMental Stress                                               0.534599
## injury_natureMultiple Injuries Including Both Physical and Psychological 0.632666
## injury_natureMultiple Physical Injuries Only                             0.459316
## injury_natureMyocardial Infarction                                       0.711606
## injury_natureNo Physical Injury                                          0.549606
## injury_natureNon-Standard Code                                           0.643982
## injury_natureNot Available                                               0.640612
## injury_naturePoisoning?Chemical (Other Than Metals)                      0.474557
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)             0.573890
## injury_naturePuncture                                                    0.505543
## injury_natureRadiation                                                   0.508337
## injury_natureRespiratory Disorders                                       0.526623
## injury_natureRupture                                                     0.440943
## injury_natureSeverance                                                   0.296341
## injury_natureSprain                                                      0.513860
## injury_natureStrain                                                      0.554392
## injury_natureSyncope                                                     0.565167
## injury_natureVascular                                                    0.998477
## injury_natureVDT-Related Disease                                         0.995749
## injury_natureVision Loss                                                 0.514091
## body_part_regionLower Extremities                                        0.075477
## body_part_regionMultiple Body Parts                                       < 2e-16
## body_part_regionNeck                                                     0.212527
## body_part_regionNon-Standard Code                                        0.673656
## body_part_regionTrunk                                                    0.372556
## body_part_regionUpper Extremities                                        0.135999
## body_partAnkle                                                           0.226456
## body_partArtificial Appliance                                            1.31e-09
## body_partBody Systems and Multiple Body Systems                           < 2e-16
## body_partBrain                                                            < 2e-16
## body_partButtocks                                                        0.042366
## body_partChest                                                           0.510385
## body_partDisc-Trunk                                                      0.015884
## body_partEar(S)                                                          0.395371
## body_partElbow                                                           0.966846
## body_partEyes                                                            0.125140
## body_partFacial Bones                                                    0.164062
## body_partFinger(S)                                                       0.339968
## body_partFoot                                                            0.136747
## body_partGreat Toe                                                       0.419364
## body_partHand                                                            0.333304
## body_partHeart                                                           0.861813
## body_partHip                                                             0.310615
## body_partInsufficient Info to Properly Identify?Unclassified              < 2e-16
## body_partInternal Organs                                                 0.335180
## body_partKnee                                                            0.820407
## body_partLarynx                                                          0.340075
## body_partLower Arm                                                       0.472158
## body_partLower Back Area                                                 3.80e-07
## body_partLower Leg                                                       0.992390
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             0.002835
## body_partLungs                                                           0.956579
## body_partMouth                                                           0.200318
## body_partMultiple Body Parts (Including Body Systems and Body Parts)      < 2e-16
## body_partMultiple Head Injury                                            0.061608
## body_partMultiple Lower Extremities                                      0.770137
## body_partMultiple Neck Injury                                            0.427779
## body_partMultiple Trunk                                                  0.611717
## body_partMultiple Upper Extremities                                      0.328914
## body_partNo Physical Injury                                               < 2e-16
## body_partNon-Standard Code                                                     NA
## body_partNose                                                            0.353155
## body_partPelvis                                                          0.947456
## body_partSacrum And Coccyx                                               0.229765
## body_partShoulder(S)                                                     0.030656
## body_partSkull                                                           0.004132
## body_partSoft Tissue-Head                                                0.827415
## body_partSoft Tissue-Neck                                                0.654345
## body_partSpinal Cord-Trunk                                               8.40e-11
## body_partTeeth                                                                 NA
## body_partThumb                                                           0.460854
## body_partToes                                                            0.285566
## body_partTrachea                                                         0.266149
## body_partUpper Arm                                                       0.472978
## body_partUpper Back Area                                                 0.323337
## body_partUpper Leg                                                             NA
## body_partVertebrae                                                             NA
## body_partWhole Body                                                            NA
## body_partWrist                                                                 NA
## average_weekly_wage1                                                     0.000114
##                                                                             
## (Intercept)                                                                 
## claimant_age_at_doi                                                      ***
## genderMale                                                                  
## genderNot Available                                                      ***
## claimant_typeMedical Only                                                ***
## claimant_typeReport Only                                                 ***
## injury_natureAll Other Specific Injuries, Noc                               
## injury_natureAmputation                                                     
## injury_natureAngina Pectoris                                                
## injury_natureAsbestosis                                                     
## injury_natureAsphyxiation                                                   
## injury_natureBlack Lung                                                     
## injury_natureBurn                                                           
## injury_natureCancer                                                         
## injury_natureCarpal Tunnel Syndrome                                         
## injury_natureConcussion                                                     
## injury_natureContagious Disease                                             
## injury_natureContusion                                                      
## injury_natureCrushing                                                       
## injury_natureDermatitis                                                     
## injury_natureDislocation                                                    
## injury_natureDust Disease, NOC                                              
## injury_natureElectric Shock                                                 
## injury_natureForeign Body                                                   
## injury_natureFracture                                                       
## injury_natureFreezing                                                       
## injury_natureHearing Loss Or Impairment                                     
## injury_natureHeat Prostration                                               
## injury_natureHernia                                                         
## injury_natureInfection                                                      
## injury_natureInflammation                                                   
## injury_natureLaceration                                                     
## injury_natureLoss of Hearing                                                
## injury_natureMental Disorder                                                
## injury_natureMental Stress                                                  
## injury_natureMultiple Injuries Including Both Physical and Psychological    
## injury_natureMultiple Physical Injuries Only                                
## injury_natureMyocardial Infarction                                          
## injury_natureNo Physical Injury                                             
## injury_natureNon-Standard Code                                              
## injury_natureNot Available                                                  
## injury_naturePoisoning?Chemical (Other Than Metals)                         
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)                
## injury_naturePuncture                                                       
## injury_natureRadiation                                                      
## injury_natureRespiratory Disorders                                          
## injury_natureRupture                                                        
## injury_natureSeverance                                                      
## injury_natureSprain                                                         
## injury_natureStrain                                                         
## injury_natureSyncope                                                        
## injury_natureVascular                                                       
## injury_natureVDT-Related Disease                                            
## injury_natureVision Loss                                                    
## body_part_regionLower Extremities                                        .  
## body_part_regionMultiple Body Parts                                      ***
## body_part_regionNeck                                                        
## body_part_regionNon-Standard Code                                           
## body_part_regionTrunk                                                       
## body_part_regionUpper Extremities                                           
## body_partAnkle                                                              
## body_partArtificial Appliance                                            ***
## body_partBody Systems and Multiple Body Systems                          ***
## body_partBrain                                                           ***
## body_partButtocks                                                        *  
## body_partChest                                                              
## body_partDisc-Trunk                                                      *  
## body_partEar(S)                                                             
## body_partElbow                                                              
## body_partEyes                                                               
## body_partFacial Bones                                                       
## body_partFinger(S)                                                          
## body_partFoot                                                               
## body_partGreat Toe                                                          
## body_partHand                                                               
## body_partHeart                                                              
## body_partHip                                                                
## body_partInsufficient Info to Properly Identify?Unclassified             ***
## body_partInternal Organs                                                    
## body_partKnee                                                               
## body_partLarynx                                                             
## body_partLower Arm                                                          
## body_partLower Back Area                                                 ***
## body_partLower Leg                                                          
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             ** 
## body_partLungs                                                              
## body_partMouth                                                              
## body_partMultiple Body Parts (Including Body Systems and Body Parts)     ***
## body_partMultiple Head Injury                                            .  
## body_partMultiple Lower Extremities                                         
## body_partMultiple Neck Injury                                               
## body_partMultiple Trunk                                                     
## body_partMultiple Upper Extremities                                         
## body_partNo Physical Injury                                              ***
## body_partNon-Standard Code                                                  
## body_partNose                                                               
## body_partPelvis                                                             
## body_partSacrum And Coccyx                                                  
## body_partShoulder(S)                                                     *  
## body_partSkull                                                           ** 
## body_partSoft Tissue-Head                                                   
## body_partSoft Tissue-Neck                                                   
## body_partSpinal Cord-Trunk                                               ***
## body_partTeeth                                                              
## body_partThumb                                                              
## body_partToes                                                               
## body_partTrachea                                                            
## body_partUpper Arm                                                          
## body_partUpper Back Area                                                    
## body_partUpper Leg                                                          
## body_partVertebrae                                                          
## body_partWhole Body                                                         
## body_partWrist                                                              
## average_weekly_wage1                                                     ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 79930 on 31511 degrees of freedom
## Multiple R-squared:  0.1034, Adjusted R-squared:  0.1004 
## F-statistic: 33.98 on 107 and 31511 DF,  p-value: < 2.2e-16

Evaluar, y en caso necesario ajustar, la regresión lineal

regresion <- lm (total_incurred_cost ~claimant_age_at_doi + gender + claimant_type +  injury_nature + body_part_region + body_part + average_weekly_wage1, data =bd)
summary (regresion)
## 
## Call:
## lm(formula = total_incurred_cost ~ claimant_age_at_doi + gender + 
##     claimant_type + injury_nature + body_part_region + body_part + 
##     average_weekly_wage1, data = bd)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -477362  -12697    -550    5168 4673472 
## 
## Coefficients: (6 not defined because of singularities)
##                                                                            Estimate
## (Intercept)                                                              -2.378e+04
## claimant_age_at_doi                                                       1.562e+02
## genderMale                                                                1.284e+03
## genderNot Available                                                       6.689e+04
## claimant_typeMedical Only                                                -5.558e+04
## claimant_typeReport Only                                                 -5.011e+04
## injury_natureAll Other Specific Injuries, Noc                             5.673e+04
## injury_natureAmputation                                                   3.981e+04
## injury_natureAngina Pectoris                                             -3.435e+03
## injury_natureAsbestosis                                                   6.414e+04
## injury_natureAsphyxiation                                                 6.103e+04
## injury_natureBlack Lung                                                   6.015e+04
## injury_natureBurn                                                         5.822e+04
## injury_natureCancer                                                       6.751e+04
## injury_natureCarpal Tunnel Syndrome                                       3.969e+04
## injury_natureConcussion                                                   8.513e+04
## injury_natureContagious Disease                                           7.377e+04
## injury_natureContusion                                                    5.310e+04
## injury_natureCrushing                                                     5.680e+04
## injury_natureDermatitis                                                   5.106e+04
## injury_natureDislocation                                                  3.829e+04
## injury_natureDust Disease, NOC                                            5.988e+04
## injury_natureElectric Shock                                               6.393e+04
## injury_natureForeign Body                                                 5.245e+04
## injury_natureFracture                                                     5.006e+04
## injury_natureFreezing                                                     4.739e+04
## injury_natureHearing Loss Or Impairment                                   4.654e+04
## injury_natureHeat Prostration                                             4.574e+04
## injury_natureHernia                                                       2.304e+04
## injury_natureInfection                                                    4.686e+04
## injury_natureInflammation                                                 6.115e+04
## injury_natureLaceration                                                   5.288e+04
## injury_natureLoss of Hearing                                              4.266e+04
## injury_natureMental Disorder                                             -3.827e+04
## injury_natureMental Stress                                                5.016e+04
## injury_natureMultiple Injuries Including Both Physical and Psychological  3.957e+04
## injury_natureMultiple Physical Injuries Only                              5.938e+04
## injury_natureMyocardial Infarction                                        3.203e+04
## injury_natureNo Physical Injury                                           4.793e+04
## injury_natureNon-Standard Code                                            3.735e+04
## injury_natureNot Available                                                5.287e+04
## injury_naturePoisoning?Chemical (Other Than Metals)                       5.778e+04
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)              4.645e+04
## injury_naturePuncture                                                     5.340e+04
## injury_natureRadiation                                                    5.488e+04
## injury_natureRespiratory Disorders                                        5.089e+04
## injury_natureRupture                                                      6.257e+04
## injury_natureSeverance                                                    8.690e+04
## injury_natureSprain                                                       5.235e+04
## injury_natureStrain                                                       4.740e+04
## injury_natureSyncope                                                      4.655e+04
## injury_natureVascular                                                     2.162e+02
## injury_natureVDT-Related Disease                                          6.035e+02
## injury_natureVision Loss                                                  5.446e+04
## body_part_regionLower Extremities                                         1.748e+04
## body_part_regionMultiple Body Parts                                       2.913e+05
## body_part_regionNeck                                                      5.097e+04
## body_part_regionNon-Standard Code                                         5.759e+03
## body_part_regionTrunk                                                     8.666e+03
## body_part_regionUpper Extremities                                         1.304e+04
## body_partAnkle                                                           -6.760e+03
## body_partArtificial Appliance                                            -2.843e+05
## body_partBody Systems and Multiple Body Systems                          -2.765e+05
## body_partBrain                                                            4.126e+05
## body_partButtocks                                                         1.879e+04
## body_partChest                                                            3.892e+03
## body_partDisc-Trunk                                                       1.761e+04
## body_partEar(S)                                                           1.043e+04
## body_partElbow                                                           -1.760e+02
## body_partEyes                                                             1.369e+04
## body_partFacial Bones                                                     1.372e+04
## body_partFinger(S)                                                       -2.799e+03
## body_partFoot                                                            -8.480e+03
## body_partGreat Toe                                                       -8.733e+03
## body_partHand                                                            -2.864e+03
## body_partHeart                                                            6.144e+03
## body_partHip                                                              6.854e+03
## body_partInsufficient Info to Properly Identify?Unclassified             -2.826e+05
## body_partInternal Organs                                                  1.228e+04
## body_partKnee                                                            -1.194e+03
## body_partLarynx                                                          -8.529e+04
## body_partLower Arm                                                       -2.674e+03
## body_partLower Back Area                                                  2.532e+04
## body_partLower Leg                                                       -5.612e+01
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              1.772e+04
## body_partLungs                                                           -4.964e+02
## body_partMouth                                                            1.350e+04
## body_partMultiple Body Parts (Including Body Systems and Body Parts)     -2.711e+05
## body_partMultiple Head Injury                                             1.652e+04
## body_partMultiple Lower Extremities                                       1.911e+03
## body_partMultiple Neck Injury                                            -3.185e+04
## body_partMultiple Trunk                                                   6.008e+03
## body_partMultiple Upper Extremities                                       4.154e+03
## body_partNo Physical Injury                                              -2.756e+05
## body_partNon-Standard Code                                                       NA
## body_partNose                                                             9.839e+03
## body_partPelvis                                                           7.507e+02
## body_partSacrum And Coccyx                                                1.936e+04
## body_partShoulder(S)                                                      6.654e+03
## body_partSkull                                                            4.699e+04
## body_partSoft Tissue-Head                                                -1.759e+04
## body_partSoft Tissue-Neck                                                -1.805e+04
## body_partSpinal Cord-Trunk                                                9.208e+04
## body_partTeeth                                                                   NA
## body_partThumb                                                           -2.801e+03
## body_partToes                                                            -8.322e+03
## body_partTrachea                                                         -5.600e+04
## body_partUpper Arm                                                        3.218e+03
## body_partUpper Back Area                                                  6.851e+03
## body_partUpper Leg                                                               NA
## body_partVertebrae                                                               NA
## body_partWhole Body                                                              NA
## body_partWrist                                                                   NA
## average_weekly_wage1                                                      8.033e+00
##                                                                          Std. Error
## (Intercept)                                                               8.063e+04
## claimant_age_at_doi                                                       4.036e+01
## genderMale                                                                9.244e+02
## genderNot Available                                                       8.412e+03
## claimant_typeMedical Only                                                 1.152e+03
## claimant_typeReport Only                                                  2.596e+03
## injury_natureAll Other Specific Injuries, Noc                             8.019e+04
## injury_natureAmputation                                                   8.502e+04
## injury_natureAngina Pectoris                                              9.965e+04
## injury_natureAsbestosis                                                   8.190e+04
## injury_natureAsphyxiation                                                 1.134e+05
## injury_natureBlack Lung                                                   1.134e+05
## injury_natureBurn                                                         8.029e+04
## injury_natureCancer                                                       8.962e+04
## injury_natureCarpal Tunnel Syndrome                                       8.036e+04
## injury_natureConcussion                                                   8.056e+04
## injury_natureContagious Disease                                           8.067e+04
## injury_natureContusion                                                    8.018e+04
## injury_natureCrushing                                                     8.045e+04
## injury_natureDermatitis                                                   8.026e+04
## injury_natureDislocation                                                  8.043e+04
## injury_natureDust Disease, NOC                                            9.279e+04
## injury_natureElectric Shock                                               8.116e+04
## injury_natureForeign Body                                                 8.024e+04
## injury_natureFracture                                                     8.022e+04
## injury_natureFreezing                                                     9.252e+04
## injury_natureHearing Loss Or Impairment                                   8.260e+04
## injury_natureHeat Prostration                                             8.102e+04
## injury_natureHernia                                                       8.088e+04
## injury_natureInfection                                                    8.057e+04
## injury_natureInflammation                                                 8.029e+04
## injury_natureLaceration                                                   8.019e+04
## injury_natureLoss of Hearing                                              8.309e+04
## injury_natureMental Disorder                                              8.799e+04
## injury_natureMental Stress                                                8.077e+04
## injury_natureMultiple Injuries Including Both Physical and Psychological  8.279e+04
## injury_natureMultiple Physical Injuries Only                              8.025e+04
## injury_natureMyocardial Infarction                                        8.664e+04
## injury_natureNo Physical Injury                                           8.011e+04
## injury_natureNon-Standard Code                                            8.082e+04
## injury_natureNot Available                                                1.133e+05
## injury_naturePoisoning?Chemical (Other Than Metals)                       8.081e+04
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)              8.261e+04
## injury_naturePuncture                                                     8.020e+04
## injury_natureRadiation                                                    8.297e+04
## injury_natureRespiratory Disorders                                        8.038e+04
## injury_natureRupture                                                      8.119e+04
## injury_natureSeverance                                                    8.321e+04
## injury_natureSprain                                                       8.019e+04
## injury_natureStrain                                                       8.018e+04
## injury_natureSyncope                                                      8.093e+04
## injury_natureVascular                                                     1.132e+05
## injury_natureVDT-Related Disease                                          1.133e+05
## injury_natureVision Loss                                                  8.347e+04
## body_part_regionLower Extremities                                         9.834e+03
## body_part_regionMultiple Body Parts                                       3.140e+04
## body_part_regionNeck                                                      4.088e+04
## body_part_regionNon-Standard Code                                         1.367e+04
## body_part_regionTrunk                                                     9.718e+03
## body_part_regionUpper Extremities                                         8.743e+03
## body_partAnkle                                                            5.588e+03
## body_partArtificial Appliance                                             4.685e+04
## body_partBody Systems and Multiple Body Systems                           3.117e+04
## body_partBrain                                                            3.768e+04
## body_partButtocks                                                         9.258e+03
## body_partChest                                                            5.913e+03
## body_partDisc-Trunk                                                       7.302e+03
## body_partEar(S)                                                           1.227e+04
## body_partElbow                                                            4.234e+03
## body_partEyes                                                             8.927e+03
## body_partFacial Bones                                                     9.857e+03
## body_partFinger(S)                                                        2.933e+03
## body_partFoot                                                             5.699e+03
## body_partGreat Toe                                                        1.081e+04
## body_partHand                                                             2.960e+03
## body_partHeart                                                            3.530e+04
## body_partHip                                                              6.760e+03
## body_partInsufficient Info to Properly Identify?Unclassified              3.066e+04
## body_partInternal Organs                                                  1.275e+04
## body_partKnee                                                             5.259e+03
## body_partLarynx                                                           8.940e+04
## body_partLower Arm                                                        3.719e+03
## body_partLower Back Area                                                  4.984e+03
## body_partLower Leg                                                        5.884e+03
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              5.937e+03
## body_partLungs                                                            9.118e+03
## body_partMouth                                                            1.054e+04
## body_partMultiple Body Parts (Including Body Systems and Body Parts)      3.026e+04
## body_partMultiple Head Injury                                             8.836e+03
## body_partMultiple Lower Extremities                                       6.542e+03
## body_partMultiple Neck Injury                                             4.016e+04
## body_partMultiple Trunk                                                   1.184e+04
## body_partMultiple Upper Extremities                                       4.255e+03
## body_partNo Physical Injury                                               3.086e+04
## body_partNon-Standard Code                                                       NA
## body_partNose                                                             1.060e+04
## body_partPelvis                                                           1.139e+04
## body_partSacrum And Coccyx                                                1.612e+04
## body_partShoulder(S)                                                      3.078e+03
## body_partSkull                                                            1.638e+04
## body_partSoft Tissue-Head                                                 8.066e+04
## body_partSoft Tissue-Neck                                                 4.032e+04
## body_partSpinal Cord-Trunk                                                1.418e+04
## body_partTeeth                                                                   NA
## body_partThumb                                                            3.799e+03
## body_partToes                                                             7.792e+03
## body_partTrachea                                                          5.036e+04
## body_partUpper Arm                                                        4.484e+03
## body_partUpper Back Area                                                  6.937e+03
## body_partUpper Leg                                                               NA
## body_partVertebrae                                                               NA
## body_partWhole Body                                                              NA
## body_partWrist                                                                   NA
## average_weekly_wage1                                                      2.081e+00
##                                                                          t value
## (Intercept)                                                               -0.295
## claimant_age_at_doi                                                        3.871
## genderMale                                                                 1.389
## genderNot Available                                                        7.952
## claimant_typeMedical Only                                                -48.261
## claimant_typeReport Only                                                 -19.300
## injury_natureAll Other Specific Injuries, Noc                              0.707
## injury_natureAmputation                                                    0.468
## injury_natureAngina Pectoris                                              -0.034
## injury_natureAsbestosis                                                    0.783
## injury_natureAsphyxiation                                                  0.538
## injury_natureBlack Lung                                                    0.530
## injury_natureBurn                                                          0.725
## injury_natureCancer                                                        0.753
## injury_natureCarpal Tunnel Syndrome                                        0.494
## injury_natureConcussion                                                    1.057
## injury_natureContagious Disease                                            0.915
## injury_natureContusion                                                     0.662
## injury_natureCrushing                                                      0.706
## injury_natureDermatitis                                                    0.636
## injury_natureDislocation                                                   0.476
## injury_natureDust Disease, NOC                                             0.645
## injury_natureElectric Shock                                                0.788
## injury_natureForeign Body                                                  0.654
## injury_natureFracture                                                      0.624
## injury_natureFreezing                                                      0.512
## injury_natureHearing Loss Or Impairment                                    0.563
## injury_natureHeat Prostration                                              0.565
## injury_natureHernia                                                        0.285
## injury_natureInfection                                                     0.582
## injury_natureInflammation                                                  0.762
## injury_natureLaceration                                                    0.659
## injury_natureLoss of Hearing                                               0.513
## injury_natureMental Disorder                                              -0.435
## injury_natureMental Stress                                                 0.621
## injury_natureMultiple Injuries Including Both Physical and Psychological   0.478
## injury_natureMultiple Physical Injuries Only                               0.740
## injury_natureMyocardial Infarction                                         0.370
## injury_natureNo Physical Injury                                            0.598
## injury_natureNon-Standard Code                                             0.462
## injury_natureNot Available                                                 0.467
## injury_naturePoisoning?Chemical (Other Than Metals)                        0.715
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)               0.562
## injury_naturePuncture                                                      0.666
## injury_natureRadiation                                                     0.661
## injury_natureRespiratory Disorders                                         0.633
## injury_natureRupture                                                       0.771
## injury_natureSeverance                                                     1.044
## injury_natureSprain                                                        0.653
## injury_natureStrain                                                        0.591
## injury_natureSyncope                                                       0.575
## injury_natureVascular                                                      0.002
## injury_natureVDT-Related Disease                                           0.005
## injury_natureVision Loss                                                   0.652
## body_part_regionLower Extremities                                          1.778
## body_part_regionMultiple Body Parts                                        9.277
## body_part_regionNeck                                                       1.247
## body_part_regionNon-Standard Code                                          0.421
## body_part_regionTrunk                                                      0.892
## body_part_regionUpper Extremities                                          1.491
## body_partAnkle                                                            -1.210
## body_partArtificial Appliance                                             -6.068
## body_partBody Systems and Multiple Body Systems                           -8.871
## body_partBrain                                                            10.951
## body_partButtocks                                                          2.030
## body_partChest                                                             0.658
## body_partDisc-Trunk                                                        2.412
## body_partEar(S)                                                            0.850
## body_partElbow                                                            -0.042
## body_partEyes                                                              1.534
## body_partFacial Bones                                                      1.392
## body_partFinger(S)                                                        -0.954
## body_partFoot                                                             -1.488
## body_partGreat Toe                                                        -0.808
## body_partHand                                                             -0.967
## body_partHeart                                                             0.174
## body_partHip                                                               1.014
## body_partInsufficient Info to Properly Identify?Unclassified              -9.218
## body_partInternal Organs                                                   0.964
## body_partKnee                                                             -0.227
## body_partLarynx                                                           -0.954
## body_partLower Arm                                                        -0.719
## body_partLower Back Area                                                   5.080
## body_partLower Leg                                                        -0.010
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               2.985
## body_partLungs                                                            -0.054
## body_partMouth                                                             1.281
## body_partMultiple Body Parts (Including Body Systems and Body Parts)      -8.957
## body_partMultiple Head Injury                                              1.869
## body_partMultiple Lower Extremities                                        0.292
## body_partMultiple Neck Injury                                             -0.793
## body_partMultiple Trunk                                                    0.508
## body_partMultiple Upper Extremities                                        0.976
## body_partNo Physical Injury                                               -8.930
## body_partNon-Standard Code                                                    NA
## body_partNose                                                              0.929
## body_partPelvis                                                            0.066
## body_partSacrum And Coccyx                                                 1.201
## body_partShoulder(S)                                                       2.162
## body_partSkull                                                             2.868
## body_partSoft Tissue-Head                                                 -0.218
## body_partSoft Tissue-Neck                                                 -0.448
## body_partSpinal Cord-Trunk                                                 6.495
## body_partTeeth                                                                NA
## body_partThumb                                                            -0.737
## body_partToes                                                             -1.068
## body_partTrachea                                                          -1.112
## body_partUpper Arm                                                         0.718
## body_partUpper Back Area                                                   0.988
## body_partUpper Leg                                                            NA
## body_partVertebrae                                                            NA
## body_partWhole Body                                                           NA
## body_partWrist                                                                NA
## average_weekly_wage1                                                       3.860
##                                                                          Pr(>|t|)
## (Intercept)                                                              0.768018
## claimant_age_at_doi                                                      0.000109
## genderMale                                                               0.164980
## genderNot Available                                                      1.90e-15
## claimant_typeMedical Only                                                 < 2e-16
## claimant_typeReport Only                                                  < 2e-16
## injury_natureAll Other Specific Injuries, Noc                            0.479316
## injury_natureAmputation                                                  0.639614
## injury_natureAngina Pectoris                                             0.972499
## injury_natureAsbestosis                                                  0.433548
## injury_natureAsphyxiation                                                0.590606
## injury_natureBlack Lung                                                  0.595936
## injury_natureBurn                                                        0.468425
## injury_natureCancer                                                      0.451230
## injury_natureCarpal Tunnel Syndrome                                      0.621353
## injury_natureConcussion                                                  0.290675
## injury_natureContagious Disease                                          0.360437
## injury_natureContusion                                                   0.507791
## injury_natureCrushing                                                    0.480165
## injury_natureDermatitis                                                  0.524685
## injury_natureDislocation                                                 0.634034
## injury_natureDust Disease, NOC                                           0.518712
## injury_natureElectric Shock                                              0.430906
## injury_natureForeign Body                                                0.513297
## injury_natureFracture                                                    0.532576
## injury_natureFreezing                                                    0.608538
## injury_natureHearing Loss Or Impairment                                  0.573195
## injury_natureHeat Prostration                                            0.572386
## injury_natureHernia                                                      0.775742
## injury_natureInfection                                                   0.560845
## injury_natureInflammation                                                0.446283
## injury_natureLaceration                                                  0.509641
## injury_natureLoss of Hearing                                             0.607631
## injury_natureMental Disorder                                             0.663656
## injury_natureMental Stress                                               0.534599
## injury_natureMultiple Injuries Including Both Physical and Psychological 0.632666
## injury_natureMultiple Physical Injuries Only                             0.459316
## injury_natureMyocardial Infarction                                       0.711606
## injury_natureNo Physical Injury                                          0.549606
## injury_natureNon-Standard Code                                           0.643982
## injury_natureNot Available                                               0.640612
## injury_naturePoisoning?Chemical (Other Than Metals)                      0.474557
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)             0.573890
## injury_naturePuncture                                                    0.505543
## injury_natureRadiation                                                   0.508337
## injury_natureRespiratory Disorders                                       0.526623
## injury_natureRupture                                                     0.440943
## injury_natureSeverance                                                   0.296341
## injury_natureSprain                                                      0.513860
## injury_natureStrain                                                      0.554392
## injury_natureSyncope                                                     0.565167
## injury_natureVascular                                                    0.998477
## injury_natureVDT-Related Disease                                         0.995749
## injury_natureVision Loss                                                 0.514091
## body_part_regionLower Extremities                                        0.075477
## body_part_regionMultiple Body Parts                                       < 2e-16
## body_part_regionNeck                                                     0.212527
## body_part_regionNon-Standard Code                                        0.673656
## body_part_regionTrunk                                                    0.372556
## body_part_regionUpper Extremities                                        0.135999
## body_partAnkle                                                           0.226456
## body_partArtificial Appliance                                            1.31e-09
## body_partBody Systems and Multiple Body Systems                           < 2e-16
## body_partBrain                                                            < 2e-16
## body_partButtocks                                                        0.042366
## body_partChest                                                           0.510385
## body_partDisc-Trunk                                                      0.015884
## body_partEar(S)                                                          0.395371
## body_partElbow                                                           0.966846
## body_partEyes                                                            0.125140
## body_partFacial Bones                                                    0.164062
## body_partFinger(S)                                                       0.339968
## body_partFoot                                                            0.136747
## body_partGreat Toe                                                       0.419364
## body_partHand                                                            0.333304
## body_partHeart                                                           0.861813
## body_partHip                                                             0.310615
## body_partInsufficient Info to Properly Identify?Unclassified              < 2e-16
## body_partInternal Organs                                                 0.335180
## body_partKnee                                                            0.820407
## body_partLarynx                                                          0.340075
## body_partLower Arm                                                       0.472158
## body_partLower Back Area                                                 3.80e-07
## body_partLower Leg                                                       0.992390
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             0.002835
## body_partLungs                                                           0.956579
## body_partMouth                                                           0.200318
## body_partMultiple Body Parts (Including Body Systems and Body Parts)      < 2e-16
## body_partMultiple Head Injury                                            0.061608
## body_partMultiple Lower Extremities                                      0.770137
## body_partMultiple Neck Injury                                            0.427779
## body_partMultiple Trunk                                                  0.611717
## body_partMultiple Upper Extremities                                      0.328914
## body_partNo Physical Injury                                               < 2e-16
## body_partNon-Standard Code                                                     NA
## body_partNose                                                            0.353155
## body_partPelvis                                                          0.947456
## body_partSacrum And Coccyx                                               0.229765
## body_partShoulder(S)                                                     0.030656
## body_partSkull                                                           0.004132
## body_partSoft Tissue-Head                                                0.827415
## body_partSoft Tissue-Neck                                                0.654345
## body_partSpinal Cord-Trunk                                               8.40e-11
## body_partTeeth                                                                 NA
## body_partThumb                                                           0.460854
## body_partToes                                                            0.285566
## body_partTrachea                                                         0.266149
## body_partUpper Arm                                                       0.472978
## body_partUpper Back Area                                                 0.323337
## body_partUpper Leg                                                             NA
## body_partVertebrae                                                             NA
## body_partWhole Body                                                            NA
## body_partWrist                                                                 NA
## average_weekly_wage1                                                     0.000114
##                                                                             
## (Intercept)                                                                 
## claimant_age_at_doi                                                      ***
## genderMale                                                                  
## genderNot Available                                                      ***
## claimant_typeMedical Only                                                ***
## claimant_typeReport Only                                                 ***
## injury_natureAll Other Specific Injuries, Noc                               
## injury_natureAmputation                                                     
## injury_natureAngina Pectoris                                                
## injury_natureAsbestosis                                                     
## injury_natureAsphyxiation                                                   
## injury_natureBlack Lung                                                     
## injury_natureBurn                                                           
## injury_natureCancer                                                         
## injury_natureCarpal Tunnel Syndrome                                         
## injury_natureConcussion                                                     
## injury_natureContagious Disease                                             
## injury_natureContusion                                                      
## injury_natureCrushing                                                       
## injury_natureDermatitis                                                     
## injury_natureDislocation                                                    
## injury_natureDust Disease, NOC                                              
## injury_natureElectric Shock                                                 
## injury_natureForeign Body                                                   
## injury_natureFracture                                                       
## injury_natureFreezing                                                       
## injury_natureHearing Loss Or Impairment                                     
## injury_natureHeat Prostration                                               
## injury_natureHernia                                                         
## injury_natureInfection                                                      
## injury_natureInflammation                                                   
## injury_natureLaceration                                                     
## injury_natureLoss of Hearing                                                
## injury_natureMental Disorder                                                
## injury_natureMental Stress                                                  
## injury_natureMultiple Injuries Including Both Physical and Psychological    
## injury_natureMultiple Physical Injuries Only                                
## injury_natureMyocardial Infarction                                          
## injury_natureNo Physical Injury                                             
## injury_natureNon-Standard Code                                              
## injury_natureNot Available                                                  
## injury_naturePoisoning?Chemical (Other Than Metals)                         
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)                
## injury_naturePuncture                                                       
## injury_natureRadiation                                                      
## injury_natureRespiratory Disorders                                          
## injury_natureRupture                                                        
## injury_natureSeverance                                                      
## injury_natureSprain                                                         
## injury_natureStrain                                                         
## injury_natureSyncope                                                        
## injury_natureVascular                                                       
## injury_natureVDT-Related Disease                                            
## injury_natureVision Loss                                                    
## body_part_regionLower Extremities                                        .  
## body_part_regionMultiple Body Parts                                      ***
## body_part_regionNeck                                                        
## body_part_regionNon-Standard Code                                           
## body_part_regionTrunk                                                       
## body_part_regionUpper Extremities                                           
## body_partAnkle                                                              
## body_partArtificial Appliance                                            ***
## body_partBody Systems and Multiple Body Systems                          ***
## body_partBrain                                                           ***
## body_partButtocks                                                        *  
## body_partChest                                                              
## body_partDisc-Trunk                                                      *  
## body_partEar(S)                                                             
## body_partElbow                                                              
## body_partEyes                                                               
## body_partFacial Bones                                                       
## body_partFinger(S)                                                          
## body_partFoot                                                               
## body_partGreat Toe                                                          
## body_partHand                                                               
## body_partHeart                                                              
## body_partHip                                                                
## body_partInsufficient Info to Properly Identify?Unclassified             ***
## body_partInternal Organs                                                    
## body_partKnee                                                               
## body_partLarynx                                                             
## body_partLower Arm                                                          
## body_partLower Back Area                                                 ***
## body_partLower Leg                                                          
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             ** 
## body_partLungs                                                              
## body_partMouth                                                              
## body_partMultiple Body Parts (Including Body Systems and Body Parts)     ***
## body_partMultiple Head Injury                                            .  
## body_partMultiple Lower Extremities                                         
## body_partMultiple Neck Injury                                               
## body_partMultiple Trunk                                                     
## body_partMultiple Upper Extremities                                         
## body_partNo Physical Injury                                              ***
## body_partNon-Standard Code                                                  
## body_partNose                                                               
## body_partPelvis                                                             
## body_partSacrum And Coccyx                                                  
## body_partShoulder(S)                                                     *  
## body_partSkull                                                           ** 
## body_partSoft Tissue-Head                                                   
## body_partSoft Tissue-Neck                                                   
## body_partSpinal Cord-Trunk                                               ***
## body_partTeeth                                                              
## body_partThumb                                                              
## body_partToes                                                               
## body_partTrachea                                                            
## body_partUpper Arm                                                          
## body_partUpper Back Area                                                    
## body_partUpper Leg                                                          
## body_partVertebrae                                                          
## body_partWhole Body                                                         
## body_partWrist                                                              
## average_weekly_wage1                                                     ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 79930 on 31511 degrees of freedom
## Multiple R-squared:  0.1034, Adjusted R-squared:  0.1004 
## F-statistic: 33.98 on 107 and 31511 DF,  p-value: < 2.2e-16

Construir un modelo predictivo

datos_nuevos <-data.frame(claimant_age_at_doi = 20:80, gender ="Male", claimant_type = "Medical Only", injury_nature = "Amputation", body_part_region = "Multiple Body Parts",body_part = "Brain",average_weekly_wage1 = 537)
predict(regresion,datos_nuevos)
## Warning in predict.lm(regresion, datos_nuevos): prediction from a rank-deficient
## fit may be misleading
##        1        2        3        4        5        6        7        8 
## 673115.3 673271.5 673427.7 673583.9 673740.1 673896.3 674052.5 674208.7 
##        9       10       11       12       13       14       15       16 
## 674364.9 674521.1 674677.3 674833.5 674989.7 675145.9 675302.1 675458.3 
##       17       18       19       20       21       22       23       24 
## 675614.5 675770.7 675926.9 676083.1 676239.3 676395.5 676551.7 676707.9 
##       25       26       27       28       29       30       31       32 
## 676864.1 677020.3 677176.5 677332.7 677488.9 677645.1 677801.3 677957.5 
##       33       34       35       36       37       38       39       40 
## 678113.7 678269.9 678426.1 678582.3 678738.5 678894.7 679050.9 679207.1 
##       41       42       43       44       45       46       47       48 
## 679363.3 679519.5 679675.7 679831.9 679988.1 680144.3 680300.5 680456.7 
##       49       50       51       52       53       54       55       56 
## 680612.9 680769.1 680925.3 681081.5 681237.7 681393.9 681550.1 681706.3 
##       57       58       59       60       61 
## 681862.5 682018.7 682174.9 682331.1 682487.3

Conclusión

En conclusión, los modelos predictivos son importantes para cualquier empresa, ya que, le permite ver un posible escenario futuro, y gracias a esto, las empresas pueden generar soluciones antes de tener problemas, o incluso lograr evitarlos, también prepararse y tener un plan B, o incluso mejorar aspectos en su empresa para llegar a los objetivos y KPI´s deseados, de forma que puede evitar amenazas que como consecuencua sufriría la compañia internamente o externamente, para la mayoría de circunstancias.

Aún así, hay cosas impredecibles como lo fue el impacto que tuvo el COVID-19. Sin embargo, para este tipo de modelos predictivos, R es una gran herramienta. En el caso de esta base de datos, R es capaz de predecir los futuros accidentes basandose en los accidentes que más se han dado, además de los días de incapacidad, del costo, etc.