Modelo Predictivo: Seguros

Importar Base de Datos

#file.choose()

bd <- read.csv("/Users/emilioolvera/Downloads/seguros.csv")

Generar Resumen

resumen <- summary(bd)
resumen
##     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

Identificar principales factores que impulsan los costos de los reclamos y el tiempo para procesarlos.

Estatus: o = open, c = closed, r = reopen
Agregar una columna de días de incapacidad (ReturnToWorkDate - IncidentDate)

Generar regresión lineal

regresion <- lm (TotalIncurredCost ~ TotalPaid + TotalReserves + TotalRecovery + IndemnityPaid + OtherPaid + IsDenied + Transaction_Time + Procesing_Time + ClaimantType + InjuryNature + BodyPartRegion + BodyPart + AverageWeeklyWage1 + BillReviewALE + Hospital + PhysicianOutpatient + Rx, data=bd)
summary (regresion)
## 
## Call:
## lm(formula = TotalIncurredCost ~ TotalPaid + TotalReserves + 
##     TotalRecovery + IndemnityPaid + OtherPaid + IsDenied + Transaction_Time + 
##     Procesing_Time + ClaimantType + InjuryNature + BodyPartRegion + 
##     BodyPart + AverageWeeklyWage1 + BillReviewALE + Hospital + 
##     PhysicianOutpatient + Rx, data = bd)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -1.144e-10 -1.690e-12  7.000e-14  1.530e-12  1.477e-09 
## 
## Coefficients: (8 not defined because of singularities)
##                                                                       Estimate
## (Intercept)                                                          1.028e-12
## TotalPaid                                                            1.000e+00
## TotalReserves                                                               NA
## TotalRecovery                                                       -1.000e+00
## IndemnityPaid                                                        1.917e-16
## OtherPaid                                                                   NA
## IsDenied                                                             4.824e-13
## Transaction_Time                                                     2.290e-15
## Procesing_Time                                                      -4.610e-16
## ClaimantTypeMedical Only                                             7.665e-13
## ClaimantTypeReport Only                                              7.419e-13
## InjuryNatureAsbestosis                                               5.278e-13
## InjuryNatureBurn                                                    -2.434e-13
## InjuryNatureCarpal Tunnel Syndrome                                   2.834e-12
## InjuryNatureConcussion                                              -1.421e-13
## InjuryNatureContagious Disease                                       1.533e-12
## InjuryNatureContusion                                                4.310e-12
## InjuryNatureCrushing                                                 1.193e-10
## InjuryNatureDermatitis                                               2.845e-12
## InjuryNatureDislocation                                              4.078e-12
## InjuryNatureDust Disease, NOC                                        2.375e-12
## InjuryNatureElectric Shock                                           5.484e-12
## InjuryNatureForeign Body                                            -8.338e-12
## InjuryNatureFracture                                                 4.836e-12
## InjuryNatureHearing Loss Or Impairment                               3.873e-13
## InjuryNatureHeat Prostration                                         1.187e-12
## InjuryNatureHernia                                                   4.019e-12
## InjuryNatureInfection                                               -6.813e-14
## InjuryNatureInflammation                                            -6.649e-12
## InjuryNatureLaceration                                               2.545e-12
## InjuryNatureLoss of Hearing                                          2.306e-12
## InjuryNatureMental Stress                                            1.695e-12
## InjuryNatureMultiple Physical Injuries Only                          3.391e-12
## InjuryNatureMyocardial Infarction                                    6.576e-12
## InjuryNatureNo Physical Injury                                      -4.177e-13
## InjuryNatureNon-Standard Code                                        2.528e-12
## InjuryNaturePoisoning?Chemical (Other Than Metals)                  -2.103e-12
## InjuryNaturePuncture                                                 1.790e-12
## InjuryNatureRespiratory Disorders                                    1.662e-12
## InjuryNatureRupture                                                  7.492e-12
## InjuryNatureSeverance                                               -1.341e-12
## InjuryNatureSprain                                                   4.018e-12
## InjuryNatureStrain                                                   3.524e-12
## InjuryNatureSyncope                                                  1.953e-12
## BodyPartRegionLower Extremities                                      2.075e-13
## BodyPartRegionMultiple Body Parts                                    2.561e-12
## BodyPartRegionNeck                                                   2.436e-12
## BodyPartRegionNon-Standard Code                                     -5.204e-12
## BodyPartRegionTrunk                                                 -2.030e-13
## BodyPartRegionUpper Extremities                                     -6.029e-14
## BodyPartAnkle                                                       -1.110e-12
## BodyPartArtificial Appliance                                         3.625e-13
## BodyPartBody Systems and Multiple Body Systems                       4.251e-13
## BodyPartButtocks                                                    -2.038e-13
## BodyPartChest                                                        6.844e-13
## BodyPartDisc-Trunk                                                  -7.240e-13
## BodyPartEar(S)                                                       7.146e-13
## BodyPartElbow                                                       -4.751e-13
## BodyPartEyes                                                         1.723e-11
## BodyPartFacial Bones                                                 9.744e-13
## BodyPartFinger(S)                                                   -3.019e-12
## BodyPartFoot                                                        -2.179e-12
## BodyPartGreat Toe                                                   -4.668e-13
## BodyPartHand                                                         6.044e-13
## BodyPartHeart                                                       -2.059e-12
## BodyPartHip                                                         -6.990e-13
## BodyPartInsufficient Info to Properly Identify?Unclassified         -9.747e-13
## BodyPartInternal Organs                                              3.750e-13
## BodyPartKnee                                                        -7.393e-13
## BodyPartLower Arm                                                    6.094e-13
## BodyPartLower Back Area                                             -3.395e-13
## BodyPartLower Leg                                                   -3.420e-13
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          5.273e-14
## BodyPartLungs                                                        3.145e-12
## BodyPartMouth                                                        1.893e-12
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -2.333e-12
## BodyPartMultiple Head Injury                                        -4.953e-13
## BodyPartMultiple Lower Extremities                                  -1.399e-12
## BodyPartMultiple Neck Injury                                        -2.760e-12
## BodyPartMultiple Trunk                                               6.998e-14
## BodyPartMultiple Upper Extremities                                   7.691e-13
## BodyPartNo Physical Injury                                                  NA
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                        -5.381e-13
## BodyPartPelvis                                                       3.606e-13
## BodyPartSacrum And Coccyx                                            2.883e-13
## BodyPartShoulder(S)                                                 -7.143e-13
## BodyPartSkull                                                        1.281e-12
## BodyPartSoft Tissue-Neck                                            -5.041e-15
## BodyPartSpinal Cord-Trunk                                           -4.786e-13
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                        1.113e-11
## BodyPartToes                                                        -5.972e-12
## BodyPartTrachea                                                             NA
## BodyPartUpper Arm                                                   -5.408e-13
## BodyPartUpper Back Area                                              5.047e-13
## BodyPartUpper Leg                                                           NA
## BodyPartWrist                                                               NA
## AverageWeeklyWage1                                                   2.013e-16
## BillReviewALE                                                       -1.389e-16
## Hospital                                                            -7.092e-18
## PhysicianOutpatient                                                  3.128e-17
## Rx                                                                  -1.124e-17
##                                                                     Std. Error
## (Intercept)                                                          1.649e-11
## TotalPaid                                                            4.420e-17
## TotalReserves                                                               NA
## TotalRecovery                                                        7.600e-16
## IndemnityPaid                                                        8.702e-17
## OtherPaid                                                                   NA
## IsDenied                                                             3.285e-12
## Transaction_Time                                                     8.217e-16
## Procesing_Time                                                       4.176e-15
## ClaimantTypeMedical Only                                             1.642e-12
## ClaimantTypeReport Only                                              3.662e-12
## InjuryNatureAsbestosis                                               2.390e-11
## InjuryNatureBurn                                                     5.966e-12
## InjuryNatureCarpal Tunnel Syndrome                                   7.843e-12
## InjuryNatureConcussion                                               1.283e-11
## InjuryNatureContagious Disease                                       1.317e-11
## InjuryNatureContusion                                                3.364e-12
## InjuryNatureCrushing                                                 1.123e-11
## InjuryNatureDermatitis                                               5.319e-12
## InjuryNatureDislocation                                              1.119e-11
## InjuryNatureDust Disease, NOC                                        3.331e-11
## InjuryNatureElectric Shock                                           1.881e-11
## InjuryNatureForeign Body                                             4.875e-12
## InjuryNatureFracture                                                 5.033e-12
## InjuryNatureHearing Loss Or Impairment                               2.276e-11
## InjuryNatureHeat Prostration                                         1.954e-11
## InjuryNatureHernia                                                   1.696e-11
## InjuryNatureInfection                                                1.306e-11
## InjuryNatureInflammation                                             7.085e-12
## InjuryNatureLaceration                                               3.927e-12
## InjuryNatureLoss of Hearing                                          2.283e-11
## InjuryNatureMental Stress                                            1.539e-11
## InjuryNatureMultiple Physical Injuries Only                          5.886e-12
## InjuryNatureMyocardial Infarction                                    3.946e-11
## InjuryNatureNo Physical Injury                                       7.347e-12
## InjuryNatureNon-Standard Code                                        1.646e-11
## InjuryNaturePoisoning?Chemical (Other Than Metals)                   1.519e-11
## InjuryNaturePuncture                                                 4.283e-12
## InjuryNatureRespiratory Disorders                                    8.721e-12
## InjuryNatureRupture                                                  2.442e-11
## InjuryNatureSeverance                                                2.640e-11
## InjuryNatureSprain                                                   4.227e-12
## InjuryNatureStrain                                                   3.513e-12
## InjuryNatureSyncope                                                  1.491e-11
## BodyPartRegionLower Extremities                                      1.725e-11
## BodyPartRegionMultiple Body Parts                                    1.757e-11
## BodyPartRegionNeck                                                   3.077e-11
## BodyPartRegionNon-Standard Code                                      2.377e-11
## BodyPartRegionTrunk                                                  1.691e-11
## BodyPartRegionUpper Extremities                                      1.622e-11
## BodyPartAnkle                                                        7.184e-12
## BodyPartArtificial Appliance                                         2.453e-11
## BodyPartBody Systems and Multiple Body Systems                       1.096e-11
## BodyPartButtocks                                                     1.254e-11
## BodyPartChest                                                        6.854e-12
## BodyPartDisc-Trunk                                                   1.013e-11
## BodyPartEar(S)                                                       2.068e-11
## BodyPartElbow                                                        5.073e-12
## BodyPartEyes                                                         1.636e-11
## BodyPartFacial Bones                                                 1.697e-11
## BodyPartFinger(S)                                                    3.595e-12
## BodyPartFoot                                                         7.251e-12
## BodyPartGreat Toe                                                    1.455e-11
## BodyPartHand                                                         3.571e-12
## BodyPartHeart                                                        3.247e-11
## BodyPartHip                                                          8.637e-12
## BodyPartInsufficient Info to Properly Identify?Unclassified          9.649e-12
## BodyPartInternal Organs                                              2.351e-11
## BodyPartKnee                                                         6.717e-12
## BodyPartLower Arm                                                    4.571e-12
## BodyPartLower Back Area                                              5.749e-12
## BodyPartLower Leg                                                    7.547e-12
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          6.976e-12
## BodyPartLungs                                                        1.074e-11
## BodyPartMouth                                                        1.772e-11
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  7.426e-12
## BodyPartMultiple Head Injury                                         1.629e-11
## BodyPartMultiple Lower Extremities                                   9.265e-12
## BodyPartMultiple Neck Injury                                         2.663e-11
## BodyPartMultiple Trunk                                               1.684e-11
## BodyPartMultiple Upper Extremities                                   5.824e-12
## BodyPartNo Physical Injury                                                  NA
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                         1.774e-11
## BodyPartPelvis                                                       1.097e-11
## BodyPartSacrum And Coccyx                                            1.921e-11
## BodyPartShoulder(S)                                                  3.775e-12
## BodyPartSkull                                                        2.161e-11
## BodyPartSoft Tissue-Neck                                             2.738e-11
## BodyPartSpinal Cord-Trunk                                            1.798e-11
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                        4.496e-12
## BodyPartToes                                                         9.657e-12
## BodyPartTrachea                                                             NA
## BodyPartUpper Arm                                                    6.096e-12
## BodyPartUpper Back Area                                              8.399e-12
## BodyPartUpper Leg                                                           NA
## BodyPartWrist                                                               NA
## AverageWeeklyWage1                                                   2.439e-15
## BillReviewALE                                                        4.606e-16
## Hospital                                                             1.508e-17
## PhysicianOutpatient                                                  4.083e-17
## Rx                                                                   3.295e-17
##                                                                        t value
## (Intercept)                                                          6.200e-02
## TotalPaid                                                            2.262e+16
## TotalReserves                                                               NA
## TotalRecovery                                                       -1.316e+15
## IndemnityPaid                                                        2.203e+00
## OtherPaid                                                                   NA
## IsDenied                                                             1.470e-01
## Transaction_Time                                                     2.787e+00
## Procesing_Time                                                      -1.100e-01
## ClaimantTypeMedical Only                                             4.670e-01
## ClaimantTypeReport Only                                              2.030e-01
## InjuryNatureAsbestosis                                               2.200e-02
## InjuryNatureBurn                                                    -4.100e-02
## InjuryNatureCarpal Tunnel Syndrome                                   3.610e-01
## InjuryNatureConcussion                                              -1.100e-02
## InjuryNatureContagious Disease                                       1.160e-01
## InjuryNatureContusion                                                1.281e+00
## InjuryNatureCrushing                                                 1.062e+01
## InjuryNatureDermatitis                                               5.350e-01
## InjuryNatureDislocation                                              3.640e-01
## InjuryNatureDust Disease, NOC                                        7.100e-02
## InjuryNatureElectric Shock                                           2.910e-01
## InjuryNatureForeign Body                                            -1.711e+00
## InjuryNatureFracture                                                 9.610e-01
## InjuryNatureHearing Loss Or Impairment                               1.700e-02
## InjuryNatureHeat Prostration                                         6.100e-02
## InjuryNatureHernia                                                   2.370e-01
## InjuryNatureInfection                                               -5.000e-03
## InjuryNatureInflammation                                            -9.380e-01
## InjuryNatureLaceration                                               6.480e-01
## InjuryNatureLoss of Hearing                                          1.010e-01
## InjuryNatureMental Stress                                            1.100e-01
## InjuryNatureMultiple Physical Injuries Only                          5.760e-01
## InjuryNatureMyocardial Infarction                                    1.670e-01
## InjuryNatureNo Physical Injury                                      -5.700e-02
## InjuryNatureNon-Standard Code                                        1.540e-01
## InjuryNaturePoisoning?Chemical (Other Than Metals)                  -1.380e-01
## InjuryNaturePuncture                                                 4.180e-01
## InjuryNatureRespiratory Disorders                                    1.910e-01
## InjuryNatureRupture                                                  3.070e-01
## InjuryNatureSeverance                                               -5.100e-02
## InjuryNatureSprain                                                   9.500e-01
## InjuryNatureStrain                                                   1.003e+00
## InjuryNatureSyncope                                                  1.310e-01
## BodyPartRegionLower Extremities                                      1.200e-02
## BodyPartRegionMultiple Body Parts                                    1.460e-01
## BodyPartRegionNeck                                                   7.900e-02
## BodyPartRegionNon-Standard Code                                     -2.190e-01
## BodyPartRegionTrunk                                                 -1.200e-02
## BodyPartRegionUpper Extremities                                     -4.000e-03
## BodyPartAnkle                                                       -1.550e-01
## BodyPartArtificial Appliance                                         1.500e-02
## BodyPartBody Systems and Multiple Body Systems                       3.900e-02
## BodyPartButtocks                                                    -1.600e-02
## BodyPartChest                                                        1.000e-01
## BodyPartDisc-Trunk                                                  -7.100e-02
## BodyPartEar(S)                                                       3.500e-02
## BodyPartElbow                                                       -9.400e-02
## BodyPartEyes                                                         1.053e+00
## BodyPartFacial Bones                                                 5.700e-02
## BodyPartFinger(S)                                                   -8.400e-01
## BodyPartFoot                                                        -3.000e-01
## BodyPartGreat Toe                                                   -3.200e-02
## BodyPartHand                                                         1.690e-01
## BodyPartHeart                                                       -6.300e-02
## BodyPartHip                                                         -8.100e-02
## BodyPartInsufficient Info to Properly Identify?Unclassified         -1.010e-01
## BodyPartInternal Organs                                              1.600e-02
## BodyPartKnee                                                        -1.100e-01
## BodyPartLower Arm                                                    1.330e-01
## BodyPartLower Back Area                                             -5.900e-02
## BodyPartLower Leg                                                   -4.500e-02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          8.000e-03
## BodyPartLungs                                                        2.930e-01
## BodyPartMouth                                                        1.070e-01
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -3.140e-01
## BodyPartMultiple Head Injury                                        -3.000e-02
## BodyPartMultiple Lower Extremities                                  -1.510e-01
## BodyPartMultiple Neck Injury                                        -1.040e-01
## BodyPartMultiple Trunk                                               4.000e-03
## BodyPartMultiple Upper Extremities                                   1.320e-01
## BodyPartNo Physical Injury                                                  NA
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                        -3.000e-02
## BodyPartPelvis                                                       3.300e-02
## BodyPartSacrum And Coccyx                                            1.500e-02
## BodyPartShoulder(S)                                                 -1.890e-01
## BodyPartSkull                                                        5.900e-02
## BodyPartSoft Tissue-Neck                                             0.000e+00
## BodyPartSpinal Cord-Trunk                                           -2.700e-02
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                        2.475e+00
## BodyPartToes                                                        -6.180e-01
## BodyPartTrachea                                                             NA
## BodyPartUpper Arm                                                   -8.900e-02
## BodyPartUpper Back Area                                              6.000e-02
## BodyPartUpper Leg                                                           NA
## BodyPartWrist                                                               NA
## AverageWeeklyWage1                                                   8.300e-02
## BillReviewALE                                                       -3.020e-01
## Hospital                                                            -4.700e-01
## PhysicianOutpatient                                                  7.660e-01
## Rx                                                                  -3.410e-01
##                                                                     Pr(>|t|)
## (Intercept)                                                          0.95031
## TotalPaid                                                            < 2e-16
## TotalReserves                                                             NA
## TotalRecovery                                                        < 2e-16
## IndemnityPaid                                                        0.02767
## OtherPaid                                                                 NA
## IsDenied                                                             0.88326
## Transaction_Time                                                     0.00535
## Procesing_Time                                                       0.91211
## ClaimantTypeMedical Only                                             0.64057
## ClaimantTypeReport Only                                              0.83946
## InjuryNatureAsbestosis                                               0.98238
## InjuryNatureBurn                                                     0.96746
## InjuryNatureCarpal Tunnel Syndrome                                   0.71788
## InjuryNatureConcussion                                               0.99116
## InjuryNatureContagious Disease                                       0.90734
## InjuryNatureContusion                                                0.20019
## InjuryNatureCrushing                                                 < 2e-16
## InjuryNatureDermatitis                                               0.59286
## InjuryNatureDislocation                                              0.71565
## InjuryNatureDust Disease, NOC                                        0.94317
## InjuryNatureElectric Shock                                           0.77069
## InjuryNatureForeign Body                                             0.08727
## InjuryNatureFracture                                                 0.33674
## InjuryNatureHearing Loss Or Impairment                               0.98642
## InjuryNatureHeat Prostration                                         0.95155
## InjuryNatureHernia                                                   0.81267
## InjuryNatureInfection                                                0.99584
## InjuryNatureInflammation                                             0.34809
## InjuryNatureLaceration                                               0.51706
## InjuryNatureLoss of Hearing                                          0.91954
## InjuryNatureMental Stress                                            0.91231
## InjuryNatureMultiple Physical Injuries Only                          0.56459
## InjuryNatureMyocardial Infarction                                    0.86764
## InjuryNatureNo Physical Injury                                       0.95467
## InjuryNatureNon-Standard Code                                        0.87798
## InjuryNaturePoisoning?Chemical (Other Than Metals)                   0.88987
## InjuryNaturePuncture                                                 0.67598
## InjuryNatureRespiratory Disorders                                    0.84891
## InjuryNatureRupture                                                  0.75901
## InjuryNatureSeverance                                                0.95950
## InjuryNatureSprain                                                   0.34195
## InjuryNatureStrain                                                   0.31589
## InjuryNatureSyncope                                                  0.89583
## BodyPartRegionLower Extremities                                      0.99040
## BodyPartRegionMultiple Body Parts                                    0.88413
## BodyPartRegionNeck                                                   0.93691
## BodyPartRegionNon-Standard Code                                      0.82669
## BodyPartRegionTrunk                                                  0.99042
## BodyPartRegionUpper Extremities                                      0.99703
## BodyPartAnkle                                                        0.87722
## BodyPartArtificial Appliance                                         0.98821
## BodyPartBody Systems and Multiple Body Systems                       0.96905
## BodyPartButtocks                                                     0.98703
## BodyPartChest                                                        0.92047
## BodyPartDisc-Trunk                                                   0.94304
## BodyPartEar(S)                                                       0.97244
## BodyPartElbow                                                        0.92539
## BodyPartEyes                                                         0.29225
## BodyPartFacial Bones                                                 0.95422
## BodyPartFinger(S)                                                    0.40119
## BodyPartFoot                                                         0.76384
## BodyPartGreat Toe                                                    0.97440
## BodyPartHand                                                         0.86562
## BodyPartHeart                                                        0.94945
## BodyPartHip                                                          0.93550
## BodyPartInsufficient Info to Properly Identify?Unclassified          0.91954
## BodyPartInternal Organs                                              0.98727
## BodyPartKnee                                                         0.91237
## BodyPartLower Arm                                                    0.89394
## BodyPartLower Back Area                                              0.95292
## BodyPartLower Leg                                                    0.96385
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          0.99397
## BodyPartLungs                                                        0.76954
## BodyPartMouth                                                        0.91495
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  0.75344
## BodyPartMultiple Head Injury                                         0.97575
## BodyPartMultiple Lower Extremities                                   0.88002
## BodyPartMultiple Neck Injury                                         0.91746
## BodyPartMultiple Trunk                                               0.99669
## BodyPartMultiple Upper Extremities                                   0.89494
## BodyPartNo Physical Injury                                                NA
## BodyPartNon-Standard Code                                                 NA
## BodyPartNose                                                         0.97580
## BodyPartPelvis                                                       0.97379
## BodyPartSacrum And Coccyx                                            0.98803
## BodyPartShoulder(S)                                                  0.84994
## BodyPartSkull                                                        0.95273
## BodyPartSoft Tissue-Neck                                             0.99985
## BodyPartSpinal Cord-Trunk                                            0.97877
## BodyPartTeeth                                                             NA
## BodyPartThumb                                                        0.01337
## BodyPartToes                                                         0.53633
## BodyPartTrachea                                                           NA
## BodyPartUpper Arm                                                    0.92932
## BodyPartUpper Back Area                                              0.95209
## BodyPartUpper Leg                                                         NA
## BodyPartWrist                                                             NA
## AverageWeeklyWage1                                                   0.93423
## BillReviewALE                                                        0.76294
## Hospital                                                             0.63821
## PhysicianOutpatient                                                  0.44372
## Rx                                                                   0.73295
##                                                                        
## (Intercept)                                                            
## TotalPaid                                                           ***
## TotalReserves                                                          
## TotalRecovery                                                       ***
## IndemnityPaid                                                       *  
## OtherPaid                                                              
## IsDenied                                                               
## Transaction_Time                                                    ** 
## Procesing_Time                                                         
## ClaimantTypeMedical Only                                               
## ClaimantTypeReport Only                                                
## InjuryNatureAsbestosis                                                 
## InjuryNatureBurn                                                       
## InjuryNatureCarpal Tunnel Syndrome                                     
## InjuryNatureConcussion                                                 
## InjuryNatureContagious Disease                                         
## InjuryNatureContusion                                                  
## InjuryNatureCrushing                                                ***
## InjuryNatureDermatitis                                                 
## InjuryNatureDislocation                                                
## InjuryNatureDust Disease, NOC                                          
## InjuryNatureElectric Shock                                             
## InjuryNatureForeign Body                                            .  
## InjuryNatureFracture                                                   
## InjuryNatureHearing Loss Or Impairment                                 
## InjuryNatureHeat Prostration                                           
## InjuryNatureHernia                                                     
## InjuryNatureInfection                                                  
## InjuryNatureInflammation                                               
## InjuryNatureLaceration                                                 
## InjuryNatureLoss of Hearing                                            
## InjuryNatureMental Stress                                              
## InjuryNatureMultiple Physical Injuries Only                            
## InjuryNatureMyocardial Infarction                                      
## InjuryNatureNo Physical Injury                                         
## InjuryNatureNon-Standard Code                                          
## InjuryNaturePoisoning?Chemical (Other Than Metals)                     
## InjuryNaturePuncture                                                   
## InjuryNatureRespiratory Disorders                                      
## InjuryNatureRupture                                                    
## InjuryNatureSeverance                                                  
## InjuryNatureSprain                                                     
## InjuryNatureStrain                                                     
## InjuryNatureSyncope                                                    
## BodyPartRegionLower Extremities                                        
## BodyPartRegionMultiple Body Parts                                      
## BodyPartRegionNeck                                                     
## BodyPartRegionNon-Standard Code                                        
## BodyPartRegionTrunk                                                    
## BodyPartRegionUpper Extremities                                        
## BodyPartAnkle                                                          
## BodyPartArtificial Appliance                                           
## BodyPartBody Systems and Multiple Body Systems                         
## BodyPartButtocks                                                       
## BodyPartChest                                                          
## BodyPartDisc-Trunk                                                     
## BodyPartEar(S)                                                         
## BodyPartElbow                                                          
## BodyPartEyes                                                           
## BodyPartFacial Bones                                                   
## BodyPartFinger(S)                                                      
## BodyPartFoot                                                           
## BodyPartGreat Toe                                                      
## BodyPartHand                                                           
## BodyPartHeart                                                          
## BodyPartHip                                                            
## BodyPartInsufficient Info to Properly Identify?Unclassified            
## BodyPartInternal Organs                                                
## BodyPartKnee                                                           
## BodyPartLower Arm                                                      
## BodyPartLower Back Area                                                
## BodyPartLower Leg                                                      
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)            
## BodyPartLungs                                                          
## BodyPartMouth                                                          
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)    
## BodyPartMultiple Head Injury                                           
## BodyPartMultiple Lower Extremities                                     
## BodyPartMultiple Neck Injury                                           
## BodyPartMultiple Trunk                                                 
## BodyPartMultiple Upper Extremities                                     
## BodyPartNo Physical Injury                                             
## BodyPartNon-Standard Code                                              
## BodyPartNose                                                           
## BodyPartPelvis                                                         
## BodyPartSacrum And Coccyx                                              
## BodyPartShoulder(S)                                                    
## BodyPartSkull                                                          
## BodyPartSoft Tissue-Neck                                               
## BodyPartSpinal Cord-Trunk                                              
## BodyPartTeeth                                                          
## BodyPartThumb                                                       *  
## BodyPartToes                                                           
## BodyPartTrachea                                                        
## BodyPartUpper Arm                                                      
## BodyPartUpper Back Area                                                
## BodyPartUpper Leg                                                      
## BodyPartWrist                                                          
## AverageWeeklyWage1                                                     
## BillReviewALE                                                          
## Hospital                                                               
## PhysicianOutpatient                                                    
## Rx                                                                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.185e-11 on 3114 degrees of freedom
##   (28410 observations deleted due to missingness)
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 2.312e+31 on 94 and 3114 DF,  p-value: < 2.2e-16

Instalar Paquetes

install.packages(“dplyr”)
library(dplyr)
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)

Generar Modelo Predictivo

regresion <- lm (TotalIncurredCost ~ ClaimantAge_at_DOI + Gender + ClaimantType + InjuryNature + BodyPartRegion + BodyPart + AverageWeeklyWage1, data = bd)
summary(regresion)
## 
## Call:
## lm(formula = TotalIncurredCost ~ ClaimantAge_at_DOI + Gender + 
##     ClaimantType + InjuryNature + BodyPartRegion + BodyPart + 
##     AverageWeeklyWage1, 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
## ClaimantAge_at_DOI                                                       1.562e+02
## GenderMale                                                               1.284e+03
## GenderNot Available                                                      6.689e+04
## ClaimantTypeMedical Only                                                -5.558e+04
## ClaimantTypeReport Only                                                 -5.011e+04
## InjuryNatureAll Other Specific Injuries, Noc                             5.673e+04
## InjuryNatureAmputation                                                   3.981e+04
## InjuryNatureAngina Pectoris                                             -3.435e+03
## InjuryNatureAsbestosis                                                   6.414e+04
## InjuryNatureAsphyxiation                                                 6.103e+04
## InjuryNatureBlack Lung                                                   6.015e+04
## InjuryNatureBurn                                                         5.822e+04
## InjuryNatureCancer                                                       6.751e+04
## InjuryNatureCarpal Tunnel Syndrome                                       3.969e+04
## InjuryNatureConcussion                                                   8.513e+04
## InjuryNatureContagious Disease                                           7.377e+04
## InjuryNatureContusion                                                    5.310e+04
## InjuryNatureCrushing                                                     5.680e+04
## InjuryNatureDermatitis                                                   5.106e+04
## InjuryNatureDislocation                                                  3.829e+04
## InjuryNatureDust Disease, NOC                                            5.988e+04
## InjuryNatureElectric Shock                                               6.393e+04
## InjuryNatureForeign Body                                                 5.245e+04
## InjuryNatureFracture                                                     5.006e+04
## InjuryNatureFreezing                                                     4.739e+04
## InjuryNatureHearing Loss Or Impairment                                   4.654e+04
## InjuryNatureHeat Prostration                                             4.574e+04
## InjuryNatureHernia                                                       2.304e+04
## InjuryNatureInfection                                                    4.686e+04
## InjuryNatureInflammation                                                 6.115e+04
## InjuryNatureLaceration                                                   5.288e+04
## InjuryNatureLoss of Hearing                                              4.266e+04
## InjuryNatureMental Disorder                                             -3.827e+04
## InjuryNatureMental Stress                                                5.016e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  3.957e+04
## InjuryNatureMultiple Physical Injuries Only                              5.938e+04
## InjuryNatureMyocardial Infarction                                        3.203e+04
## InjuryNatureNo Physical Injury                                           4.793e+04
## InjuryNatureNon-Standard Code                                            3.735e+04
## InjuryNatureNot Available                                                5.287e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       5.778e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              4.645e+04
## InjuryNaturePuncture                                                     5.340e+04
## InjuryNatureRadiation                                                    5.488e+04
## InjuryNatureRespiratory Disorders                                        5.089e+04
## InjuryNatureRupture                                                      6.257e+04
## InjuryNatureSeverance                                                    8.690e+04
## InjuryNatureSprain                                                       5.235e+04
## InjuryNatureStrain                                                       4.740e+04
## InjuryNatureSyncope                                                      4.655e+04
## InjuryNatureVascular                                                     2.162e+02
## InjuryNatureVDT-Related Disease                                          6.035e+02
## InjuryNatureVision Loss                                                  5.446e+04
## BodyPartRegionLower Extremities                                          1.748e+04
## BodyPartRegionMultiple Body Parts                                        2.913e+05
## BodyPartRegionNeck                                                       5.097e+04
## BodyPartRegionNon-Standard Code                                          5.759e+03
## BodyPartRegionTrunk                                                      8.666e+03
## BodyPartRegionUpper Extremities                                          1.304e+04
## BodyPartAnkle                                                           -6.760e+03
## BodyPartArtificial Appliance                                            -2.843e+05
## BodyPartBody Systems and Multiple Body Systems                          -2.765e+05
## BodyPartBrain                                                            4.126e+05
## BodyPartButtocks                                                         1.879e+04
## BodyPartChest                                                            3.892e+03
## BodyPartDisc-Trunk                                                       1.761e+04
## BodyPartEar(S)                                                           1.043e+04
## BodyPartElbow                                                           -1.760e+02
## BodyPartEyes                                                             1.369e+04
## BodyPartFacial Bones                                                     1.372e+04
## BodyPartFinger(S)                                                       -2.799e+03
## BodyPartFoot                                                            -8.480e+03
## BodyPartGreat Toe                                                       -8.733e+03
## BodyPartHand                                                            -2.864e+03
## BodyPartHeart                                                            6.144e+03
## BodyPartHip                                                              6.854e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified             -2.826e+05
## BodyPartInternal Organs                                                  1.228e+04
## BodyPartKnee                                                            -1.194e+03
## BodyPartLarynx                                                          -8.529e+04
## BodyPartLower Arm                                                       -2.674e+03
## BodyPartLower Back Area                                                  2.532e+04
## BodyPartLower Leg                                                       -5.612e+01
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              1.772e+04
## BodyPartLungs                                                           -4.964e+02
## BodyPartMouth                                                            1.350e+04
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)     -2.711e+05
## BodyPartMultiple Head Injury                                             1.652e+04
## BodyPartMultiple Lower Extremities                                       1.911e+03
## BodyPartMultiple Neck Injury                                            -3.185e+04
## BodyPartMultiple Trunk                                                   6.008e+03
## BodyPartMultiple Upper Extremities                                       4.154e+03
## BodyPartNo Physical Injury                                              -2.756e+05
## BodyPartNon-Standard Code                                                       NA
## BodyPartNose                                                             9.839e+03
## BodyPartPelvis                                                           7.507e+02
## BodyPartSacrum And Coccyx                                                1.936e+04
## BodyPartShoulder(S)                                                      6.654e+03
## BodyPartSkull                                                            4.699e+04
## BodyPartSoft Tissue-Head                                                -1.759e+04
## BodyPartSoft Tissue-Neck                                                -1.805e+04
## BodyPartSpinal Cord-Trunk                                                9.208e+04
## BodyPartTeeth                                                                   NA
## BodyPartThumb                                                           -2.801e+03
## BodyPartToes                                                            -8.322e+03
## BodyPartTrachea                                                         -5.600e+04
## BodyPartUpper Arm                                                        3.218e+03
## BodyPartUpper Back Area                                                  6.851e+03
## BodyPartUpper Leg                                                               NA
## BodyPartVertebrae                                                               NA
## BodyPartWhole Body                                                              NA
## BodyPartWrist                                                                   NA
## AverageWeeklyWage1                                                       8.033e+00
##                                                                         Std. Error
## (Intercept)                                                              8.063e+04
## ClaimantAge_at_DOI                                                       4.036e+01
## GenderMale                                                               9.244e+02
## GenderNot Available                                                      8.412e+03
## ClaimantTypeMedical Only                                                 1.152e+03
## ClaimantTypeReport Only                                                  2.596e+03
## InjuryNatureAll Other Specific Injuries, Noc                             8.019e+04
## InjuryNatureAmputation                                                   8.502e+04
## InjuryNatureAngina Pectoris                                              9.965e+04
## InjuryNatureAsbestosis                                                   8.190e+04
## InjuryNatureAsphyxiation                                                 1.134e+05
## InjuryNatureBlack Lung                                                   1.134e+05
## InjuryNatureBurn                                                         8.029e+04
## InjuryNatureCancer                                                       8.962e+04
## InjuryNatureCarpal Tunnel Syndrome                                       8.036e+04
## InjuryNatureConcussion                                                   8.056e+04
## InjuryNatureContagious Disease                                           8.067e+04
## InjuryNatureContusion                                                    8.018e+04
## InjuryNatureCrushing                                                     8.045e+04
## InjuryNatureDermatitis                                                   8.026e+04
## InjuryNatureDislocation                                                  8.043e+04
## InjuryNatureDust Disease, NOC                                            9.279e+04
## InjuryNatureElectric Shock                                               8.116e+04
## InjuryNatureForeign Body                                                 8.024e+04
## InjuryNatureFracture                                                     8.022e+04
## InjuryNatureFreezing                                                     9.252e+04
## InjuryNatureHearing Loss Or Impairment                                   8.260e+04
## InjuryNatureHeat Prostration                                             8.102e+04
## InjuryNatureHernia                                                       8.088e+04
## InjuryNatureInfection                                                    8.057e+04
## InjuryNatureInflammation                                                 8.029e+04
## InjuryNatureLaceration                                                   8.019e+04
## InjuryNatureLoss of Hearing                                              8.309e+04
## InjuryNatureMental Disorder                                              8.799e+04
## InjuryNatureMental Stress                                                8.077e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  8.279e+04
## InjuryNatureMultiple Physical Injuries Only                              8.025e+04
## InjuryNatureMyocardial Infarction                                        8.664e+04
## InjuryNatureNo Physical Injury                                           8.011e+04
## InjuryNatureNon-Standard Code                                            8.082e+04
## InjuryNatureNot Available                                                1.133e+05
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       8.081e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              8.261e+04
## InjuryNaturePuncture                                                     8.020e+04
## InjuryNatureRadiation                                                    8.297e+04
## InjuryNatureRespiratory Disorders                                        8.038e+04
## InjuryNatureRupture                                                      8.119e+04
## InjuryNatureSeverance                                                    8.321e+04
## InjuryNatureSprain                                                       8.019e+04
## InjuryNatureStrain                                                       8.018e+04
## InjuryNatureSyncope                                                      8.093e+04
## InjuryNatureVascular                                                     1.132e+05
## InjuryNatureVDT-Related Disease                                          1.133e+05
## InjuryNatureVision Loss                                                  8.347e+04
## BodyPartRegionLower Extremities                                          9.834e+03
## BodyPartRegionMultiple Body Parts                                        3.140e+04
## BodyPartRegionNeck                                                       4.088e+04
## BodyPartRegionNon-Standard Code                                          1.367e+04
## BodyPartRegionTrunk                                                      9.718e+03
## BodyPartRegionUpper Extremities                                          8.743e+03
## BodyPartAnkle                                                            5.588e+03
## BodyPartArtificial Appliance                                             4.685e+04
## BodyPartBody Systems and Multiple Body Systems                           3.117e+04
## BodyPartBrain                                                            3.768e+04
## BodyPartButtocks                                                         9.258e+03
## BodyPartChest                                                            5.913e+03
## BodyPartDisc-Trunk                                                       7.302e+03
## BodyPartEar(S)                                                           1.227e+04
## BodyPartElbow                                                            4.234e+03
## BodyPartEyes                                                             8.927e+03
## BodyPartFacial Bones                                                     9.857e+03
## BodyPartFinger(S)                                                        2.933e+03
## BodyPartFoot                                                             5.699e+03
## BodyPartGreat Toe                                                        1.081e+04
## BodyPartHand                                                             2.960e+03
## BodyPartHeart                                                            3.530e+04
## BodyPartHip                                                              6.760e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified              3.066e+04
## BodyPartInternal Organs                                                  1.275e+04
## BodyPartKnee                                                             5.259e+03
## BodyPartLarynx                                                           8.940e+04
## BodyPartLower Arm                                                        3.719e+03
## BodyPartLower Back Area                                                  4.984e+03
## BodyPartLower Leg                                                        5.884e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              5.937e+03
## BodyPartLungs                                                            9.118e+03
## BodyPartMouth                                                            1.054e+04
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      3.026e+04
## BodyPartMultiple Head Injury                                             8.836e+03
## BodyPartMultiple Lower Extremities                                       6.542e+03
## BodyPartMultiple Neck Injury                                             4.016e+04
## BodyPartMultiple Trunk                                                   1.184e+04
## BodyPartMultiple Upper Extremities                                       4.255e+03
## BodyPartNo Physical Injury                                               3.086e+04
## BodyPartNon-Standard Code                                                       NA
## BodyPartNose                                                             1.060e+04
## BodyPartPelvis                                                           1.139e+04
## BodyPartSacrum And Coccyx                                                1.612e+04
## BodyPartShoulder(S)                                                      3.078e+03
## BodyPartSkull                                                            1.638e+04
## BodyPartSoft Tissue-Head                                                 8.066e+04
## BodyPartSoft Tissue-Neck                                                 4.032e+04
## BodyPartSpinal Cord-Trunk                                                1.418e+04
## BodyPartTeeth                                                                   NA
## BodyPartThumb                                                            3.799e+03
## BodyPartToes                                                             7.792e+03
## BodyPartTrachea                                                          5.036e+04
## BodyPartUpper Arm                                                        4.484e+03
## BodyPartUpper Back Area                                                  6.937e+03
## BodyPartUpper Leg                                                               NA
## BodyPartVertebrae                                                               NA
## BodyPartWhole Body                                                              NA
## BodyPartWrist                                                                   NA
## AverageWeeklyWage1                                                       2.081e+00
##                                                                         t value
## (Intercept)                                                              -0.295
## ClaimantAge_at_DOI                                                        3.871
## GenderMale                                                                1.389
## GenderNot Available                                                       7.952
## ClaimantTypeMedical Only                                                -48.261
## ClaimantTypeReport Only                                                 -19.300
## InjuryNatureAll Other Specific Injuries, Noc                              0.707
## InjuryNatureAmputation                                                    0.468
## InjuryNatureAngina Pectoris                                              -0.034
## InjuryNatureAsbestosis                                                    0.783
## InjuryNatureAsphyxiation                                                  0.538
## InjuryNatureBlack Lung                                                    0.530
## InjuryNatureBurn                                                          0.725
## InjuryNatureCancer                                                        0.753
## InjuryNatureCarpal Tunnel Syndrome                                        0.494
## InjuryNatureConcussion                                                    1.057
## InjuryNatureContagious Disease                                            0.915
## InjuryNatureContusion                                                     0.662
## InjuryNatureCrushing                                                      0.706
## InjuryNatureDermatitis                                                    0.636
## InjuryNatureDislocation                                                   0.476
## InjuryNatureDust Disease, NOC                                             0.645
## InjuryNatureElectric Shock                                                0.788
## InjuryNatureForeign Body                                                  0.654
## InjuryNatureFracture                                                      0.624
## InjuryNatureFreezing                                                      0.512
## InjuryNatureHearing Loss Or Impairment                                    0.563
## InjuryNatureHeat Prostration                                              0.565
## InjuryNatureHernia                                                        0.285
## InjuryNatureInfection                                                     0.582
## InjuryNatureInflammation                                                  0.762
## InjuryNatureLaceration                                                    0.659
## InjuryNatureLoss of Hearing                                               0.513
## InjuryNatureMental Disorder                                              -0.435
## InjuryNatureMental Stress                                                 0.621
## InjuryNatureMultiple Injuries Including Both Physical and Psychological   0.478
## InjuryNatureMultiple Physical Injuries Only                               0.740
## InjuryNatureMyocardial Infarction                                         0.370
## InjuryNatureNo Physical Injury                                            0.598
## InjuryNatureNon-Standard Code                                             0.462
## InjuryNatureNot Available                                                 0.467
## InjuryNaturePoisoning?Chemical (Other Than Metals)                        0.715
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)               0.562
## InjuryNaturePuncture                                                      0.666
## InjuryNatureRadiation                                                     0.661
## InjuryNatureRespiratory Disorders                                         0.633
## InjuryNatureRupture                                                       0.771
## InjuryNatureSeverance                                                     1.044
## InjuryNatureSprain                                                        0.653
## InjuryNatureStrain                                                        0.591
## InjuryNatureSyncope                                                       0.575
## InjuryNatureVascular                                                      0.002
## InjuryNatureVDT-Related Disease                                           0.005
## InjuryNatureVision Loss                                                   0.652
## BodyPartRegionLower Extremities                                           1.778
## BodyPartRegionMultiple Body Parts                                         9.277
## BodyPartRegionNeck                                                        1.247
## BodyPartRegionNon-Standard Code                                           0.421
## BodyPartRegionTrunk                                                       0.892
## BodyPartRegionUpper Extremities                                           1.491
## BodyPartAnkle                                                            -1.210
## BodyPartArtificial Appliance                                             -6.068
## BodyPartBody Systems and Multiple Body Systems                           -8.871
## BodyPartBrain                                                            10.951
## BodyPartButtocks                                                          2.030
## BodyPartChest                                                             0.658
## BodyPartDisc-Trunk                                                        2.412
## BodyPartEar(S)                                                            0.850
## BodyPartElbow                                                            -0.042
## BodyPartEyes                                                              1.534
## BodyPartFacial Bones                                                      1.392
## BodyPartFinger(S)                                                        -0.954
## BodyPartFoot                                                             -1.488
## BodyPartGreat Toe                                                        -0.808
## BodyPartHand                                                             -0.967
## BodyPartHeart                                                             0.174
## BodyPartHip                                                               1.014
## BodyPartInsufficient Info to Properly Identify?Unclassified              -9.218
## BodyPartInternal Organs                                                   0.964
## BodyPartKnee                                                             -0.227
## BodyPartLarynx                                                           -0.954
## BodyPartLower Arm                                                        -0.719
## BodyPartLower Back Area                                                   5.080
## BodyPartLower Leg                                                        -0.010
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               2.985
## BodyPartLungs                                                            -0.054
## BodyPartMouth                                                             1.281
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      -8.957
## BodyPartMultiple Head Injury                                              1.869
## BodyPartMultiple Lower Extremities                                        0.292
## BodyPartMultiple Neck Injury                                             -0.793
## BodyPartMultiple Trunk                                                    0.508
## BodyPartMultiple Upper Extremities                                        0.976
## BodyPartNo Physical Injury                                               -8.930
## BodyPartNon-Standard Code                                                    NA
## BodyPartNose                                                              0.929
## BodyPartPelvis                                                            0.066
## BodyPartSacrum And Coccyx                                                 1.201
## BodyPartShoulder(S)                                                       2.162
## BodyPartSkull                                                             2.868
## BodyPartSoft Tissue-Head                                                 -0.218
## BodyPartSoft Tissue-Neck                                                 -0.448
## BodyPartSpinal Cord-Trunk                                                 6.495
## BodyPartTeeth                                                                NA
## BodyPartThumb                                                            -0.737
## BodyPartToes                                                             -1.068
## BodyPartTrachea                                                          -1.112
## BodyPartUpper Arm                                                         0.718
## BodyPartUpper Back Area                                                   0.988
## BodyPartUpper Leg                                                            NA
## BodyPartVertebrae                                                            NA
## BodyPartWhole Body                                                           NA
## BodyPartWrist                                                                NA
## AverageWeeklyWage1                                                        3.860
##                                                                         Pr(>|t|)
## (Intercept)                                                             0.768018
## ClaimantAge_at_DOI                                                      0.000109
## GenderMale                                                              0.164980
## GenderNot Available                                                     1.90e-15
## ClaimantTypeMedical Only                                                 < 2e-16
## ClaimantTypeReport Only                                                  < 2e-16
## InjuryNatureAll Other Specific Injuries, Noc                            0.479316
## InjuryNatureAmputation                                                  0.639614
## InjuryNatureAngina Pectoris                                             0.972499
## InjuryNatureAsbestosis                                                  0.433548
## InjuryNatureAsphyxiation                                                0.590606
## InjuryNatureBlack Lung                                                  0.595936
## InjuryNatureBurn                                                        0.468425
## InjuryNatureCancer                                                      0.451230
## InjuryNatureCarpal Tunnel Syndrome                                      0.621353
## InjuryNatureConcussion                                                  0.290675
## InjuryNatureContagious Disease                                          0.360437
## InjuryNatureContusion                                                   0.507791
## InjuryNatureCrushing                                                    0.480165
## InjuryNatureDermatitis                                                  0.524685
## InjuryNatureDislocation                                                 0.634034
## InjuryNatureDust Disease, NOC                                           0.518712
## InjuryNatureElectric Shock                                              0.430906
## InjuryNatureForeign Body                                                0.513297
## InjuryNatureFracture                                                    0.532576
## InjuryNatureFreezing                                                    0.608538
## InjuryNatureHearing Loss Or Impairment                                  0.573195
## InjuryNatureHeat Prostration                                            0.572386
## InjuryNatureHernia                                                      0.775742
## InjuryNatureInfection                                                   0.560845
## InjuryNatureInflammation                                                0.446283
## InjuryNatureLaceration                                                  0.509641
## InjuryNatureLoss of Hearing                                             0.607631
## InjuryNatureMental Disorder                                             0.663656
## InjuryNatureMental Stress                                               0.534599
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.632666
## InjuryNatureMultiple Physical Injuries Only                             0.459316
## InjuryNatureMyocardial Infarction                                       0.711606
## InjuryNatureNo Physical Injury                                          0.549606
## InjuryNatureNon-Standard Code                                           0.643982
## InjuryNatureNot Available                                               0.640612
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      0.474557
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)             0.573890
## InjuryNaturePuncture                                                    0.505543
## InjuryNatureRadiation                                                   0.508337
## InjuryNatureRespiratory Disorders                                       0.526623
## InjuryNatureRupture                                                     0.440943
## InjuryNatureSeverance                                                   0.296341
## InjuryNatureSprain                                                      0.513860
## InjuryNatureStrain                                                      0.554392
## InjuryNatureSyncope                                                     0.565167
## InjuryNatureVascular                                                    0.998477
## InjuryNatureVDT-Related Disease                                         0.995749
## InjuryNatureVision Loss                                                 0.514091
## BodyPartRegionLower Extremities                                         0.075477
## BodyPartRegionMultiple Body Parts                                        < 2e-16
## BodyPartRegionNeck                                                      0.212527
## BodyPartRegionNon-Standard Code                                         0.673656
## BodyPartRegionTrunk                                                     0.372556
## BodyPartRegionUpper Extremities                                         0.135999
## BodyPartAnkle                                                           0.226456
## BodyPartArtificial Appliance                                            1.31e-09
## BodyPartBody Systems and Multiple Body Systems                           < 2e-16
## BodyPartBrain                                                            < 2e-16
## BodyPartButtocks                                                        0.042366
## BodyPartChest                                                           0.510385
## BodyPartDisc-Trunk                                                      0.015884
## BodyPartEar(S)                                                          0.395371
## BodyPartElbow                                                           0.966846
## BodyPartEyes                                                            0.125140
## BodyPartFacial Bones                                                    0.164062
## BodyPartFinger(S)                                                       0.339968
## BodyPartFoot                                                            0.136747
## BodyPartGreat Toe                                                       0.419364
## BodyPartHand                                                            0.333304
## BodyPartHeart                                                           0.861813
## BodyPartHip                                                             0.310615
## BodyPartInsufficient Info to Properly Identify?Unclassified              < 2e-16
## BodyPartInternal Organs                                                 0.335180
## BodyPartKnee                                                            0.820407
## BodyPartLarynx                                                          0.340075
## BodyPartLower Arm                                                       0.472158
## BodyPartLower Back Area                                                 3.80e-07
## BodyPartLower Leg                                                       0.992390
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             0.002835
## BodyPartLungs                                                           0.956579
## BodyPartMouth                                                           0.200318
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      < 2e-16
## BodyPartMultiple Head Injury                                            0.061608
## BodyPartMultiple Lower Extremities                                      0.770137
## BodyPartMultiple Neck Injury                                            0.427779
## BodyPartMultiple Trunk                                                  0.611717
## BodyPartMultiple Upper Extremities                                      0.328914
## BodyPartNo Physical Injury                                               < 2e-16
## BodyPartNon-Standard Code                                                     NA
## BodyPartNose                                                            0.353155
## BodyPartPelvis                                                          0.947456
## BodyPartSacrum And Coccyx                                               0.229765
## BodyPartShoulder(S)                                                     0.030656
## BodyPartSkull                                                           0.004132
## BodyPartSoft Tissue-Head                                                0.827415
## BodyPartSoft Tissue-Neck                                                0.654345
## BodyPartSpinal Cord-Trunk                                               8.40e-11
## BodyPartTeeth                                                                 NA
## BodyPartThumb                                                           0.460854
## BodyPartToes                                                            0.285566
## BodyPartTrachea                                                         0.266149
## BodyPartUpper Arm                                                       0.472978
## BodyPartUpper Back Area                                                 0.323337
## BodyPartUpper Leg                                                             NA
## BodyPartVertebrae                                                             NA
## BodyPartWhole Body                                                            NA
## BodyPartWrist                                                                 NA
## AverageWeeklyWage1                                                      0.000114
##                                                                            
## (Intercept)                                                                
## ClaimantAge_at_DOI                                                      ***
## GenderMale                                                                 
## GenderNot Available                                                     ***
## ClaimantTypeMedical Only                                                ***
## ClaimantTypeReport Only                                                 ***
## InjuryNatureAll Other Specific Injuries, Noc                               
## InjuryNatureAmputation                                                     
## InjuryNatureAngina Pectoris                                                
## InjuryNatureAsbestosis                                                     
## InjuryNatureAsphyxiation                                                   
## InjuryNatureBlack Lung                                                     
## InjuryNatureBurn                                                           
## InjuryNatureCancer                                                         
## InjuryNatureCarpal Tunnel Syndrome                                         
## InjuryNatureConcussion                                                     
## InjuryNatureContagious Disease                                             
## InjuryNatureContusion                                                      
## InjuryNatureCrushing                                                       
## InjuryNatureDermatitis                                                     
## InjuryNatureDislocation                                                    
## InjuryNatureDust Disease, NOC                                              
## InjuryNatureElectric Shock                                                 
## InjuryNatureForeign Body                                                   
## InjuryNatureFracture                                                       
## InjuryNatureFreezing                                                       
## InjuryNatureHearing Loss Or Impairment                                     
## InjuryNatureHeat Prostration                                               
## InjuryNatureHernia                                                         
## InjuryNatureInfection                                                      
## InjuryNatureInflammation                                                   
## InjuryNatureLaceration                                                     
## InjuryNatureLoss of Hearing                                                
## InjuryNatureMental Disorder                                                
## InjuryNatureMental Stress                                                  
## InjuryNatureMultiple Injuries Including Both Physical and Psychological    
## InjuryNatureMultiple Physical Injuries Only                                
## InjuryNatureMyocardial Infarction                                          
## InjuryNatureNo Physical Injury                                             
## InjuryNatureNon-Standard Code                                              
## InjuryNatureNot Available                                                  
## InjuryNaturePoisoning?Chemical (Other Than Metals)                         
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)                
## InjuryNaturePuncture                                                       
## InjuryNatureRadiation                                                      
## InjuryNatureRespiratory Disorders                                          
## InjuryNatureRupture                                                        
## InjuryNatureSeverance                                                      
## InjuryNatureSprain                                                         
## InjuryNatureStrain                                                         
## InjuryNatureSyncope                                                        
## InjuryNatureVascular                                                       
## InjuryNatureVDT-Related Disease                                            
## InjuryNatureVision Loss                                                    
## BodyPartRegionLower Extremities                                         .  
## BodyPartRegionMultiple Body Parts                                       ***
## BodyPartRegionNeck                                                         
## BodyPartRegionNon-Standard Code                                            
## BodyPartRegionTrunk                                                        
## BodyPartRegionUpper Extremities                                            
## BodyPartAnkle                                                              
## BodyPartArtificial Appliance                                            ***
## BodyPartBody Systems and Multiple Body Systems                          ***
## BodyPartBrain                                                           ***
## BodyPartButtocks                                                        *  
## BodyPartChest                                                              
## BodyPartDisc-Trunk                                                      *  
## BodyPartEar(S)                                                             
## BodyPartElbow                                                              
## BodyPartEyes                                                               
## BodyPartFacial Bones                                                       
## BodyPartFinger(S)                                                          
## BodyPartFoot                                                               
## BodyPartGreat Toe                                                          
## BodyPartHand                                                               
## BodyPartHeart                                                              
## BodyPartHip                                                                
## BodyPartInsufficient Info to Properly Identify?Unclassified             ***
## BodyPartInternal Organs                                                    
## BodyPartKnee                                                               
## BodyPartLarynx                                                             
## BodyPartLower Arm                                                          
## BodyPartLower Back Area                                                 ***
## BodyPartLower Leg                                                          
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             ** 
## BodyPartLungs                                                              
## BodyPartMouth                                                              
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)     ***
## BodyPartMultiple Head Injury                                            .  
## BodyPartMultiple Lower Extremities                                         
## BodyPartMultiple Neck Injury                                               
## BodyPartMultiple Trunk                                                     
## BodyPartMultiple Upper Extremities                                         
## BodyPartNo Physical Injury                                              ***
## BodyPartNon-Standard Code                                                  
## BodyPartNose                                                               
## BodyPartPelvis                                                             
## BodyPartSacrum And Coccyx                                                  
## BodyPartShoulder(S)                                                     *  
## BodyPartSkull                                                           ** 
## BodyPartSoft Tissue-Head                                                   
## BodyPartSoft Tissue-Neck                                                   
## BodyPartSpinal Cord-Trunk                                               ***
## BodyPartTeeth                                                              
## BodyPartThumb                                                              
## BodyPartToes                                                               
## BodyPartTrachea                                                            
## BodyPartUpper Arm                                                          
## BodyPartUpper Back Area                                                    
## BodyPartUpper Leg                                                          
## BodyPartVertebrae                                                          
## BodyPartWhole Body                                                         
## BodyPartWrist                                                              
## AverageWeeklyWage1                                                      ***
## ---
## 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

datos_nuevos <- data.frame(ClaimantAge_at_DOI = c(20,30,40,50,60,70,80,90), Gender = "Male", ClaimantType = "Medical Only", InjuryNature = "Amputation", BodyPartRegion = "Multiple Body Parts", BodyPart = "Brain", AverageWeeklyWage1 = 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 674677.3 676239.3 677801.3 679363.3 680925.3 682487.3 684049.4
LS0tCnRpdGxlOiAiTW9kZWxvIFByZWRpY3Rpdm86IFNlZ3Vyb3MiCmF1dGhvcjogIkVtaWxpbyBPbHZlcmEgLSBBMDE2MjUyMDAiCmRhdGU6ICIyMDIyLTA5LTA2IgpvdXRwdXQ6IAogIGh0bWxfZG9jdW1lbnQ6CiAgICB0b2M6IHRydWUKICAgIHRvY19mbG9hdDogdHJ1ZQogICAgY29kZV9kb3dubG9hZDogdHJ1ZQotLS0KCiMjIDxpbWcgc3JjPSAiL1VzZXJzL2VtaWxpb29sdmVyYS9EZXNrdG9wL1BvcnRhZm9saW8gZGVsIG1vZHVsby9zZWd1cm9zLmpwZWciPgoKIyMgPHNwYW4gc3R5bGU9ImNvbG9yOiBkZWVwc2t5Ymx1ZSIgPiAqKk1vZGVsbyBQcmVkaWN0aXZvOiBTZWd1cm9zKiogPC9zcGFuPgoKIyMjIDxzcGFuIHN0eWxlPSJjb2xvcjogYmx1ZSIgPiBJbXBvcnRhciBCYXNlIGRlIERhdG9zIDwvc3Bhbj4KYGBge3J9CiNmaWxlLmNob29zZSgpCgpiZCA8LSByZWFkLmNzdigiL1VzZXJzL2VtaWxpb29sdmVyYS9Eb3dubG9hZHMvc2VndXJvcy5jc3YiKQpgYGAKCiMjIyA8c3BhbiBzdHlsZT0iY29sb3I6IGJsdWUiID4gR2VuZXJhciBSZXN1bWVuIDwvc3Bhbj4KYGBge3J9CnJlc3VtZW4gPC0gc3VtbWFyeShiZCkKcmVzdW1lbgpgYGAKCiMjIyA8c3BhbiBzdHlsZT0iY29sb3I6IGJsdWUiID4gSWRlbnRpZmljYXIgcHJpbmNpcGFsZXMgZmFjdG9yZXMgcXVlIGltcHVsc2FuIGxvcyBjb3N0b3MgZGUgbG9zIHJlY2xhbW9zIHkgZWwgdGllbXBvIHBhcmEgcHJvY2VzYXJsb3MuIDwvc3Bhbj4KRXN0YXR1czogbyA9IG9wZW4sIGMgPSBjbG9zZWQsIHIgPSByZW9wZW4gIApBZ3JlZ2FyIHVuYSBjb2x1bW5hIGRlIGTDrWFzIGRlIGluY2FwYWNpZGFkIChSZXR1cm5Ub1dvcmtEYXRlIC0gSW5jaWRlbnREYXRlKQoKIyMjIDxzcGFuIHN0eWxlPSJjb2xvcjogYmx1ZSIgPiBHZW5lcmFyIHJlZ3Jlc2nDs24gbGluZWFsIDwvc3Bhbj4KYGBge3J9CnJlZ3Jlc2lvbiA8LSBsbSAoVG90YWxJbmN1cnJlZENvc3QgfiBUb3RhbFBhaWQgKyBUb3RhbFJlc2VydmVzICsgVG90YWxSZWNvdmVyeSArIEluZGVtbml0eVBhaWQgKyBPdGhlclBhaWQgKyBJc0RlbmllZCArIFRyYW5zYWN0aW9uX1RpbWUgKyBQcm9jZXNpbmdfVGltZSArIENsYWltYW50VHlwZSArIEluanVyeU5hdHVyZSArIEJvZHlQYXJ0UmVnaW9uICsgQm9keVBhcnQgKyBBdmVyYWdlV2Vla2x5V2FnZTEgKyBCaWxsUmV2aWV3QUxFICsgSG9zcGl0YWwgKyBQaHlzaWNpYW5PdXRwYXRpZW50ICsgUngsIGRhdGE9YmQpCnN1bW1hcnkgKHJlZ3Jlc2lvbikKYGBgCgojIyMgPHNwYW4gc3R5bGU9ImNvbG9yOiBibHVlIiA+IEluc3RhbGFyIFBhcXVldGVzIDwvc3Bhbj4KaW5zdGFsbC5wYWNrYWdlcygiZHBseXIiKSAgCmxpYnJhcnkoZHBseXIpICAKY291bnQoYmQsIEluY2lkZW50RGVzY3JpcHRpb24sIHNvcnQgPSBUUlVFKSAgCmNvdW50KGJkLCBDbGFpbWFudFR5cGUsIHNvcnQgPVRSVUUpICAKY291bnQoYmQsIEluanVyeU5hdHVyZSwgc29ydCA9IFRSVUUpICAKY291bnQoYmQsIEJvZHlQYXJ0UmVnaW9uLCBzb3J0ID0gVFJVRSkgIApjb3VudChiZCwgQm9keVBhcnQsIHNvcnQgPSBUUlVFKSAKCiMjIyA8c3BhbiBzdHlsZT0iY29sb3I6IGJsdWUiID4gR2VuZXJhciBNb2RlbG8gUHJlZGljdGl2byA8L3NwYW4+CmBgYHtyfQpyZWdyZXNpb24gPC0gbG0gKFRvdGFsSW5jdXJyZWRDb3N0IH4gQ2xhaW1hbnRBZ2VfYXRfRE9JICsgR2VuZGVyICsgQ2xhaW1hbnRUeXBlICsgSW5qdXJ5TmF0dXJlICsgQm9keVBhcnRSZWdpb24gKyBCb2R5UGFydCArIEF2ZXJhZ2VXZWVrbHlXYWdlMSwgZGF0YSA9IGJkKQpzdW1tYXJ5KHJlZ3Jlc2lvbikKYGBgCgojIyMgPHNwYW4gc3R5bGU9ImNvbG9yOiBibHVlIiA+IEV2YWx1YXIsIHkgZW4gY2FzbyBuZWNlc2FyaW8gYWp1c3RhciwgbGEgcmVncmVzacOzbiBsaW5lYWwgPC9zcGFuPgpgYGB7cn0KZGF0b3NfbnVldm9zIDwtIGRhdGEuZnJhbWUoQ2xhaW1hbnRBZ2VfYXRfRE9JID0gYygyMCwzMCw0MCw1MCw2MCw3MCw4MCw5MCksIEdlbmRlciA9ICJNYWxlIiwgQ2xhaW1hbnRUeXBlID0gIk1lZGljYWwgT25seSIsIEluanVyeU5hdHVyZSA9ICJBbXB1dGF0aW9uIiwgQm9keVBhcnRSZWdpb24gPSAiTXVsdGlwbGUgQm9keSBQYXJ0cyIsIEJvZHlQYXJ0ID0gIkJyYWluIiwgQXZlcmFnZVdlZWtseVdhZ2UxID0gNTM3KQpwcmVkaWN0ICggcmVncmVzaW9uLCBkYXRvc19udWV2b3MpCmBgYAoKCgoK