Modelo predictivo

Importar la base de datos

bd<-read.csv("C:\\Users\\AVRIL\\Downloads\\seguros.csv")

Entender la base de datos

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

Instalar y leer librerías

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Convertir tipos de datos

#count(bd,ClaimStatus, sort=TRUE)
#count(bd,IncidentDate, sort=TRUE)
#count(bd,IncidentDescription, sort=TRUE)
#count(bd,ReturnToworkDate, sort=TRUE)
#count(bd,ClaimantOpenedDate, sort=TRUE)
#count(bd,ClaimStatus, sort=TRUE)
#count(bd,ClaimClosedDate, sort=TRUE)
#count(bd,EmployerNotificationDate, sort=TRUE)
#count(bd,ReceivedDate, sort=TRUE)
#count(bd,Gender, sort=TRUE)
#count(bd,ClaimantType, sort=TRUE)
#count(bd,InjuryNature, sort=TRUE)
#count(bd,BodyPartRegion, sort=TRUE)
#count(bd,BodyPart, sort=TRUE)

Observaciones
#1. Cambiar y generar el 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

#2. Ajustar la regresion

regresion_ajustada<-lm(TotalIncurredCost~ClaimantAge_at_DOI+Gender+ClaimantType+BodyPartRegion+BodyPart+AverageWeeklyWage1, data=bd)
summary(regresion_ajustada)
## 
## Call:
## lm(formula = TotalIncurredCost ~ ClaimantAge_at_DOI + Gender + 
##     ClaimantType + BodyPartRegion + BodyPart + AverageWeeklyWage1, 
##     data = bd)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -450567  -12736    -580    5092 4678170 
## 
## Coefficients: (6 not defined because of singularities)
##                                                                       Estimate
## (Intercept)                                                          2.857e+04
## ClaimantAge_at_DOI                                                   1.518e+02
## GenderMale                                                           1.225e+03
## GenderNot Available                                                  6.818e+04
## ClaimantTypeMedical Only                                            -5.519e+04
## ClaimantTypeReport Only                                             -4.955e+04
## BodyPartRegionLower Extremities                                      1.674e+04
## BodyPartRegionMultiple Body Parts                                    2.883e+05
## BodyPartRegionNeck                                                   4.859e+04
## BodyPartRegionNon-Standard Code                                     -9.270e+03
## BodyPartRegionTrunk                                                  3.303e+03
## BodyPartRegionUpper Extremities                                      1.047e+04
## BodyPartAnkle                                                       -7.020e+03
## BodyPartArtificial Appliance                                        -2.826e+05
## BodyPartBody Systems and Multiple Body Systems                      -2.720e+05
## BodyPartBrain                                                        4.070e+05
## BodyPartButtocks                                                     2.449e+04
## BodyPartChest                                                        8.235e+03
## BodyPartDisc-Trunk                                                   1.957e+04
## BodyPartEar(S)                                                       8.287e+03
## BodyPartElbow                                                        1.819e+03
## BodyPartEyes                                                         1.521e+04
## BodyPartFacial Bones                                                 1.486e+04
## BodyPartFinger(S)                                                    1.015e+02
## BodyPartFoot                                                        -7.970e+03
## BodyPartGreat Toe                                                   -7.687e+03
## BodyPartHand                                                        -2.855e+02
## BodyPartHeart                                                       -9.176e+03
## BodyPartHip                                                          6.602e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified         -2.790e+05
## BodyPartInternal Organs                                              1.037e+04
## BodyPartKnee                                                        -1.508e+03
## BodyPartLarynx                                                      -8.191e+04
## BodyPartLower Arm                                                   -3.781e+02
## BodyPartLower Back Area                                              2.678e+04
## BodyPartLower Leg                                                    6.323e+02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          1.931e+04
## BodyPartLungs                                                        5.695e+03
## BodyPartMouth                                                        1.490e+04
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -2.676e+05
## BodyPartMultiple Head Injury                                         1.908e+04
## BodyPartMultiple Lower Extremities                                   2.444e+03
## BodyPartMultiple Neck Injury                                        -3.221e+04
## BodyPartMultiple Trunk                                               9.063e+03
## BodyPartMultiple Upper Extremities                                   5.885e+03
## BodyPartNo Physical Injury                                          -2.756e+05
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                         9.969e+03
## BodyPartPelvis                                                       2.573e+03
## BodyPartSacrum And Coccyx                                            2.383e+04
## BodyPartShoulder(S)                                                  6.237e+03
## BodyPartSkull                                                        4.900e+04
## BodyPartSoft Tissue-Head                                            -1.283e+04
## BodyPartSoft Tissue-Neck                                            -1.506e+04
## BodyPartSpinal Cord-Trunk                                            9.452e+04
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                       -5.342e+02
## BodyPartToes                                                        -7.005e+03
## BodyPartTrachea                                                     -4.832e+04
## BodyPartUpper Arm                                                    4.822e+03
## BodyPartUpper Back Area                                              8.849e+03
## BodyPartUpper Leg                                                           NA
## BodyPartVertebrae                                                           NA
## BodyPartWhole Body                                                          NA
## BodyPartWrist                                                               NA
## AverageWeeklyWage1                                                   7.943e+00
##                                                                     Std. Error
## (Intercept)                                                          8.643e+03
## ClaimantAge_at_DOI                                                   4.024e+01
## GenderMale                                                           9.170e+02
## GenderNot Available                                                  8.408e+03
## ClaimantTypeMedical Only                                             1.119e+03
## ClaimantTypeReport Only                                              2.577e+03
## BodyPartRegionLower Extremities                                      9.729e+03
## BodyPartRegionMultiple Body Parts                                    3.137e+04
## BodyPartRegionNeck                                                   4.091e+04
## BodyPartRegionNon-Standard Code                                      9.015e+03
## BodyPartRegionTrunk                                                  9.497e+03
## BodyPartRegionUpper Extremities                                      8.636e+03
## BodyPartAnkle                                                        5.460e+03
## BodyPartArtificial Appliance                                         4.684e+04
## BodyPartBody Systems and Multiple Body Systems                       3.106e+04
## BodyPartBrain                                                        3.674e+04
## BodyPartButtocks                                                     9.133e+03
## BodyPartChest                                                        5.719e+03
## BodyPartDisc-Trunk                                                   7.170e+03
## BodyPartEar(S)                                                       1.113e+04
## BodyPartElbow                                                        4.197e+03
## BodyPartEyes                                                         8.642e+03
## BodyPartFacial Bones                                                 9.762e+03
## BodyPartFinger(S)                                                    2.797e+03
## BodyPartFoot                                                         5.672e+03
## BodyPartGreat Toe                                                    1.079e+04
## BodyPartHand                                                         2.900e+03
## BodyPartHeart                                                        2.354e+04
## BodyPartHip                                                          6.743e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified          3.065e+04
## BodyPartInternal Organs                                              1.264e+04
## BodyPartKnee                                                         5.228e+03
## BodyPartLarynx                                                       8.945e+04
## BodyPartLower Arm                                                    3.665e+03
## BodyPartLower Back Area                                              4.749e+03
## BodyPartLower Leg                                                    5.880e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          5.745e+03
## BodyPartLungs                                                        7.384e+03
## BodyPartMouth                                                        1.044e+04
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  3.027e+04
## BodyPartMultiple Head Injury                                         8.703e+03
## BodyPartMultiple Lower Extremities                                   6.534e+03
## BodyPartMultiple Neck Injury                                         4.017e+04
## BodyPartMultiple Trunk                                               1.180e+04
## BodyPartMultiple Upper Extremities                                   4.222e+03
## BodyPartNo Physical Injury                                           3.060e+04
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                         1.055e+04
## BodyPartPelvis                                                       1.136e+04
## BodyPartSacrum And Coccyx                                            1.605e+04
## BodyPartShoulder(S)                                                  3.020e+03
## BodyPartSkull                                                        1.623e+04
## BodyPartSoft Tissue-Head                                             8.043e+04
## BodyPartSoft Tissue-Neck                                             4.032e+04
## BodyPartSpinal Cord-Trunk                                            1.410e+04
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                        3.716e+03
## BodyPartToes                                                         7.763e+03
## BodyPartTrachea                                                      5.018e+04
## BodyPartUpper Arm                                                    4.449e+03
## BodyPartUpper Back Area                                              6.778e+03
## BodyPartUpper Leg                                                           NA
## BodyPartVertebrae                                                           NA
## BodyPartWhole Body                                                          NA
## BodyPartWrist                                                               NA
## AverageWeeklyWage1                                                   2.074e+00
##                                                                     t value
## (Intercept)                                                           3.306
## ClaimantAge_at_DOI                                                    3.772
## GenderMale                                                            1.336
## GenderNot Available                                                   8.109
## ClaimantTypeMedical Only                                            -49.337
## ClaimantTypeReport Only                                             -19.231
## BodyPartRegionLower Extremities                                       1.720
## BodyPartRegionMultiple Body Parts                                     9.190
## BodyPartRegionNeck                                                    1.188
## BodyPartRegionNon-Standard Code                                      -1.028
## BodyPartRegionTrunk                                                   0.348
## BodyPartRegionUpper Extremities                                       1.212
## BodyPartAnkle                                                        -1.286
## BodyPartArtificial Appliance                                         -6.032
## BodyPartBody Systems and Multiple Body Systems                       -8.760
## BodyPartBrain                                                        11.079
## BodyPartButtocks                                                      2.682
## BodyPartChest                                                         1.440
## BodyPartDisc-Trunk                                                    2.729
## BodyPartEar(S)                                                        0.745
## BodyPartElbow                                                         0.434
## BodyPartEyes                                                          1.760
## BodyPartFacial Bones                                                  1.522
## BodyPartFinger(S)                                                     0.036
## BodyPartFoot                                                         -1.405
## BodyPartGreat Toe                                                    -0.712
## BodyPartHand                                                         -0.098
## BodyPartHeart                                                        -0.390
## BodyPartHip                                                           0.979
## BodyPartInsufficient Info to Properly Identify?Unclassified          -9.104
## BodyPartInternal Organs                                               0.821
## BodyPartKnee                                                         -0.288
## BodyPartLarynx                                                       -0.916
## BodyPartLower Arm                                                    -0.103
## BodyPartLower Back Area                                               5.640
## BodyPartLower Leg                                                     0.108
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)           3.362
## BodyPartLungs                                                         0.771
## BodyPartMouth                                                         1.426
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  -8.840
## BodyPartMultiple Head Injury                                          2.193
## BodyPartMultiple Lower Extremities                                    0.374
## BodyPartMultiple Neck Injury                                         -0.802
## BodyPartMultiple Trunk                                                0.768
## BodyPartMultiple Upper Extremities                                    1.394
## BodyPartNo Physical Injury                                           -9.004
## BodyPartNon-Standard Code                                                NA
## BodyPartNose                                                          0.945
## BodyPartPelvis                                                        0.226
## BodyPartSacrum And Coccyx                                             1.485
## BodyPartShoulder(S)                                                   2.065
## BodyPartSkull                                                         3.019
## BodyPartSoft Tissue-Head                                             -0.160
## BodyPartSoft Tissue-Neck                                             -0.374
## BodyPartSpinal Cord-Trunk                                             6.704
## BodyPartTeeth                                                            NA
## BodyPartThumb                                                        -0.144
## BodyPartToes                                                         -0.902
## BodyPartTrachea                                                      -0.963
## BodyPartUpper Arm                                                     1.084
## BodyPartUpper Back Area                                               1.306
## BodyPartUpper Leg                                                        NA
## BodyPartVertebrae                                                        NA
## BodyPartWhole Body                                                       NA
## BodyPartWrist                                                            NA
## AverageWeeklyWage1                                                    3.829
##                                                                     Pr(>|t|)
## (Intercept)                                                         0.000948
## ClaimantAge_at_DOI                                                  0.000162
## GenderMale                                                          0.181507
## GenderNot Available                                                 5.29e-16
## ClaimantTypeMedical Only                                             < 2e-16
## ClaimantTypeReport Only                                              < 2e-16
## BodyPartRegionLower Extremities                                     0.085403
## BodyPartRegionMultiple Body Parts                                    < 2e-16
## BodyPartRegionNeck                                                  0.234896
## BodyPartRegionNon-Standard Code                                     0.303834
## BodyPartRegionTrunk                                                 0.727996
## BodyPartRegionUpper Extremities                                     0.225378
## BodyPartAnkle                                                       0.198534
## BodyPartArtificial Appliance                                        1.64e-09
## BodyPartBody Systems and Multiple Body Systems                       < 2e-16
## BodyPartBrain                                                        < 2e-16
## BodyPartButtocks                                                    0.007325
## BodyPartChest                                                       0.149887
## BodyPartDisc-Trunk                                                  0.006349
## BodyPartEar(S)                                                      0.456362
## BodyPartElbow                                                       0.664637
## BodyPartEyes                                                        0.078417
## BodyPartFacial Bones                                                0.128074
## BodyPartFinger(S)                                                   0.971047
## BodyPartFoot                                                        0.160000
## BodyPartGreat Toe                                                   0.476334
## BodyPartHand                                                        0.921572
## BodyPartHeart                                                       0.696661
## BodyPartHip                                                         0.327556
## BodyPartInsufficient Info to Properly Identify?Unclassified          < 2e-16
## BodyPartInternal Organs                                             0.411798
## BodyPartKnee                                                        0.773028
## BodyPartLarynx                                                      0.359853
## BodyPartLower Arm                                                   0.917818
## BodyPartLower Back Area                                             1.71e-08
## BodyPartLower Leg                                                   0.914363
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)         0.000775
## BodyPartLungs                                                       0.440541
## BodyPartMouth                                                       0.153833
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  < 2e-16
## BodyPartMultiple Head Injury                                        0.028333
## BodyPartMultiple Lower Extremities                                  0.708377
## BodyPartMultiple Neck Injury                                        0.422687
## BodyPartMultiple Trunk                                              0.442326
## BodyPartMultiple Upper Extremities                                  0.163291
## BodyPartNo Physical Injury                                           < 2e-16
## BodyPartNon-Standard Code                                                 NA
## BodyPartNose                                                        0.344904
## BodyPartPelvis                                                      0.820847
## BodyPartSacrum And Coccyx                                           0.137635
## BodyPartShoulder(S)                                                 0.038919
## BodyPartSkull                                                       0.002541
## BodyPartSoft Tissue-Head                                            0.873264
## BodyPartSoft Tissue-Neck                                            0.708706
## BodyPartSpinal Cord-Trunk                                           2.07e-11
## BodyPartTeeth                                                             NA
## BodyPartThumb                                                       0.885687
## BodyPartToes                                                        0.366862
## BodyPartTrachea                                                     0.335587
## BodyPartUpper Arm                                                   0.278439
## BodyPartUpper Back Area                                             0.191720
## BodyPartUpper Leg                                                         NA
## BodyPartVertebrae                                                         NA
## BodyPartWhole Body                                                        NA
## BodyPartWrist                                                             NA
## AverageWeeklyWage1                                                  0.000129
##                                                                        
## (Intercept)                                                         ***
## ClaimantAge_at_DOI                                                  ***
## GenderMale                                                             
## GenderNot Available                                                 ***
## ClaimantTypeMedical Only                                            ***
## ClaimantTypeReport Only                                             ***
## 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: 79980 on 31559 degrees of freedom
## Multiple R-squared:  0.1008, Adjusted R-squared:  0.09914 
## F-statistic: 59.98 on 59 and 31559 DF,  p-value: < 2.2e-16

#3. Construir un modelo predictivo

datos_nuevos<-data.frame(ClaimantAge_at_DOI=c(10,20,30,40,50,60,70,80,90), Gender="Male", ClaimantType="Medical Only", BodyPartRegion="Head", BodyPart="Brain", AverageWeeklyWage1=550)
predict(regresion_ajustada,datos_nuevos)
## Warning in predict.lm(regresion_ajustada, datos_nuevos): prediction from a
## rank-deficient fit may be misleading
##        1        2        3        4        5        6        7        8 
## 387509.7 389027.8 390545.9 392064.0 393582.1 395100.3 396618.4 398136.5 
##        9 
## 399654.6
LS0tDQp0aXRsZTogIlNlZ3Vyb3MiDQphdXRob3I6ICJBdnJpbCBMb2JhdG8gLSBBMDA4MzMxMTMiDQpkYXRlOiAiMjAyMy0wMy0xNyINCm91dHB1dDogDQogIGh0bWxfZG9jdW1lbnQ6DQogICAgdG9jOiB0cnVlDQogICAgdG9jX2Zsb2F0OiB0cnVlDQogICAgY29kZV9kb3dubG9hZDogdHJ1ZQ0KLS0tDQoqKk1vZGVsbyBwcmVkaWN0aXZvKiogIA0KPGltZyBzcmM9IkM6XFxVc2Vyc1xcQVZSSUxcXFBpY3R1cmVzXFxJTUFHRU5fU09MSUNJVEFEQV9NZXNhX2RlX3RyYWJham9fMS5qcGciPg0KDQpfSW1wb3J0YXIgbGEgYmFzZSBkZSBkYXRvc18NCmBgYHtyfQ0KYmQ8LXJlYWQuY3N2KCJDOlxcVXNlcnNcXEFWUklMXFxEb3dubG9hZHNcXHNlZ3Vyb3MuY3N2IikNCmBgYA0KDQpfRW50ZW5kZXIgbGEgYmFzZSBkZSBkYXRvc18NCmBgYHtyfQ0Kc3VtbWFyeShiZCkNCi5saWJQYXRocygpICANCmBgYA0KDQpfSW5zdGFsYXIgeSBsZWVyIGxpYnJlcsOtYXNfDQpgYGB7cn0NCmxpYnJhcnkoZHBseXIpDQpgYGANCg0KX0NvbnZlcnRpciB0aXBvcyBkZSBkYXRvc18NCmBgYHtyfQ0KI2NvdW50KGJkLENsYWltU3RhdHVzLCBzb3J0PVRSVUUpDQojY291bnQoYmQsSW5jaWRlbnREYXRlLCBzb3J0PVRSVUUpDQojY291bnQoYmQsSW5jaWRlbnREZXNjcmlwdGlvbiwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLFJldHVyblRvd29ya0RhdGUsIHNvcnQ9VFJVRSkNCiNjb3VudChiZCxDbGFpbWFudE9wZW5lZERhdGUsIHNvcnQ9VFJVRSkNCiNjb3VudChiZCxDbGFpbVN0YXR1cywgc29ydD1UUlVFKQ0KI2NvdW50KGJkLENsYWltQ2xvc2VkRGF0ZSwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLEVtcGxveWVyTm90aWZpY2F0aW9uRGF0ZSwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLFJlY2VpdmVkRGF0ZSwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLEdlbmRlciwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLENsYWltYW50VHlwZSwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLEluanVyeU5hdHVyZSwgc29ydD1UUlVFKQ0KI2NvdW50KGJkLEJvZHlQYXJ0UmVnaW9uLCBzb3J0PVRSVUUpDQojY291bnQoYmQsQm9keVBhcnQsIHNvcnQ9VFJVRSkNCmBgYA0KDQpfT2JzZXJ2YWNpb25lc18gIA0KIzEuIENhbWJpYXIgeSBnZW5lcmFyIGVsIG1vZGVsbyBwcmVkaWN0aXZvDQpgYGB7cn0NCnJlZ3Jlc2lvbjwtbG0oVG90YWxJbmN1cnJlZENvc3R+Q2xhaW1hbnRBZ2VfYXRfRE9JK0dlbmRlcitDbGFpbWFudFR5cGUrSW5qdXJ5TmF0dXJlK0JvZHlQYXJ0UmVnaW9uK0JvZHlQYXJ0K0F2ZXJhZ2VXZWVrbHlXYWdlMSwgZGF0YT1iZCkNCnN1bW1hcnkocmVncmVzaW9uKQ0KYGBgDQoNCiMyLiBBanVzdGFyIGxhIHJlZ3Jlc2lvbg0KYGBge3J9DQpyZWdyZXNpb25fYWp1c3RhZGE8LWxtKFRvdGFsSW5jdXJyZWRDb3N0fkNsYWltYW50QWdlX2F0X0RPSStHZW5kZXIrQ2xhaW1hbnRUeXBlK0JvZHlQYXJ0UmVnaW9uK0JvZHlQYXJ0K0F2ZXJhZ2VXZWVrbHlXYWdlMSwgZGF0YT1iZCkNCnN1bW1hcnkocmVncmVzaW9uX2FqdXN0YWRhKQ0KYGBgDQoNCiMzLiBDb25zdHJ1aXIgdW4gbW9kZWxvIHByZWRpY3Rpdm8NCmBgYHtyfQ0KZGF0b3NfbnVldm9zPC1kYXRhLmZyYW1lKENsYWltYW50QWdlX2F0X0RPST1jKDEwLDIwLDMwLDQwLDUwLDYwLDcwLDgwLDkwKSwgR2VuZGVyPSJNYWxlIiwgQ2xhaW1hbnRUeXBlPSJNZWRpY2FsIE9ubHkiLCBCb2R5UGFydFJlZ2lvbj0iSGVhZCIsIEJvZHlQYXJ0PSJCcmFpbiIsIEF2ZXJhZ2VXZWVrbHlXYWdlMT01NTApDQpwcmVkaWN0KHJlZ3Jlc2lvbl9hanVzdGFkYSxkYXRvc19udWV2b3MpDQpgYGANCg==