Librerías

install.packages("stats")
## Warning: package 'stats' is in use and will not be installed
library(stats)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.1
## 
## 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

Importar base de datos

df <- read.csv("C:\\Users\\aldof\\Documents\\1 Tec\\Semana Tec 1 - Bootcamp de Programación\\Tercera Clase\\seguros.csv")

Grafica

Para comprender el impacto que tiene la edad de los pacientes con el costo total que tuvo que pagar el seguro por accidentes laborales, esto nos permitirá conocer en qué rango de edad surgen más lesiones y por ende se debería de poner más atención a esos grupos de empleados.

plot(df$ClaimantAge_at_DOI, df$TotalIncurredCost, main="Gráfica seguros", xlab="Age of the pacient", ylab="Total incurred cost")

También se harán diagramas de caja y bigotes para ver la dispersión de los datos en las entradas de edad, horario de transacción y tiempo de procesamiento.

boxplot(df$ClaimantAge_at_DOI, horizontal=TRUE)

boxplot(df$Procesing_Time, horizontal=TRUE)

boxplot(df$Transaction_Time, horizontal=TRUE)

Generar modelo predictivo

Para poder predecir los valores se hará una regresión y se determinará la veracidad de los valores.

regression <- lm(TotalIncurredCost ~ ClaimantAge_at_DOI + Gender + ClaimantType + InjuryNature + BodyPart + AverageWeeklyWage1, data=df)
summary(regression)
## 
## Call:
## lm(formula = TotalIncurredCost ~ ClaimantAge_at_DOI + Gender + 
##     ClaimantType + InjuryNature + BodyPart + AverageWeeklyWage1, 
##     data = df)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -477362  -12697    -550    5168 4673472 
## 
## Coefficients:
##                                                                           Estimate
## (Intercept)                                                             -15117.925
## ClaimantAge_at_DOI                                                         156.201
## GenderMale                                                                1283.535
## GenderNot Available                                                      66890.306
## ClaimantTypeMedical Only                                                -55583.540
## ClaimantTypeReport Only                                                 -50111.774
## InjuryNatureAll Other Specific Injuries, Noc                             56729.450
## InjuryNatureAmputation                                                   39809.568
## InjuryNatureAngina Pectoris                                              -3435.389
## InjuryNatureAsbestosis                                                   64140.845
## InjuryNatureAsphyxiation                                                 61025.272
## InjuryNatureBlack Lung                                                   60151.324
## InjuryNatureBurn                                                         58215.040
## InjuryNatureCancer                                                       67514.465
## InjuryNatureCarpal Tunnel Syndrome                                       39691.434
## InjuryNatureConcussion                                                   85126.039
## InjuryNatureContagious Disease                                           73771.904
## InjuryNatureContusion                                                    53100.588
## InjuryNatureCrushing                                                     56802.086
## InjuryNatureDermatitis                                                   51055.892
## InjuryNatureDislocation                                                  38289.619
## InjuryNatureDust Disease, NOC                                            59879.110
## InjuryNatureElectric Shock                                               63927.752
## InjuryNatureForeign Body                                                 52452.472
## InjuryNatureFracture                                                     50062.584
## InjuryNatureFreezing                                                     47385.253
## InjuryNatureHearing Loss Or Impairment                                   46536.000
## InjuryNatureHeat Prostration                                             45738.671
## InjuryNatureHernia                                                       23040.850
## InjuryNatureInfection                                                    46857.682
## InjuryNatureInflammation                                                 61150.549
## InjuryNatureLaceration                                                   52880.029
## InjuryNatureLoss of Hearing                                              42662.954
## InjuryNatureMental Disorder                                             -38266.143
## InjuryNatureMental Stress                                                50157.875
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  39570.100
## InjuryNatureMultiple Physical Injuries Only                              59381.890
## InjuryNatureMyocardial Infarction                                        32031.386
## InjuryNatureNo Physical Injury                                           47932.934
## InjuryNatureNon-Standard Code                                            37348.838
## InjuryNatureNot Available                                                52871.739
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       57784.529
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              46452.650
## InjuryNaturePuncture                                                     53399.445
## InjuryNatureRadiation                                                    54882.303
## InjuryNatureRespiratory Disorders                                        50894.022
## InjuryNatureRupture                                                      62566.090
## InjuryNatureSeverance                                                    86899.253
## InjuryNatureSprain                                                       52354.558
## InjuryNatureStrain                                                       47401.947
## InjuryNatureSyncope                                                      46550.571
## InjuryNatureVascular                                                       216.156
## InjuryNatureVDT-Related Disease                                            603.490
## InjuryNatureVision Loss                                                  54462.656
## BodyPartAnkle                                                             2055.183
## BodyPartArtificial Appliance                                             -1667.180
## BodyPartBody Systems and Multiple Body Systems                            6146.288
## BodyPartBrain                                                           403968.626
## BodyPartButtocks                                                         18792.688
## BodyPartChest                                                             3892.208
## BodyPartDisc-Trunk                                                       17611.324
## BodyPartEar(S)                                                            1761.862
## BodyPartElbow                                                             4193.443
## BodyPartEyes                                                              5024.719
## BodyPartFacial Bones                                                      5050.345
## BodyPartFinger(S)                                                         1570.299
## BodyPartFoot                                                               334.724
## BodyPartGreat Toe                                                           82.162
## BodyPartHand                                                              1505.421
## BodyPartHeart                                                             6143.981
## BodyPartHip                                                              15669.260
## BodyPartInsufficient Info to Properly Identify?Unclassified                 56.308
## BodyPartInternal Organs                                                  12283.964
## BodyPartKnee                                                              7620.963
## BodyPartLarynx                                                          -42988.950
## BodyPartLower Arm                                                         1695.701
## BodyPartLower Back Area                                                  25315.647
## BodyPartLower Leg                                                         8758.653
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              17722.928
## BodyPartLungs                                                             -496.438
## BodyPartMouth                                                             4835.459
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      11600.871
## BodyPartMultiple Head Injury                                              7849.674
## BodyPartMultiple Lower Extremities                                       10726.254
## BodyPartMultiple Neck Injury                                             10454.079
## BodyPartMultiple Trunk                                                    6008.353
## BodyPartMultiple Upper Extremities                                        8523.685
## BodyPartNo Physical Injury                                                7051.571
## BodyPartNon-Standard Code                                                -2907.166
## BodyPartNose                                                              1172.980
## BodyPartPelvis                                                             750.706
## BodyPartSacrum And Coccyx                                                19356.594
## BodyPartShoulder(S)                                                      11022.959
## BodyPartSkull                                                            38325.730
## BodyPartSoft Tissue-Head                                                -26251.510
## BodyPartSoft Tissue-Neck                                                 24249.548
## BodyPartSpinal Cord-Trunk                                                92075.318
## BodyPartTeeth                                                            -8665.901
## BodyPartThumb                                                             1568.026
## BodyPartToes                                                               493.196
## BodyPartTrachea                                                         -13692.364
## BodyPartUpper Arm                                                         7587.157
## BodyPartUpper Back Area                                                   6851.204
## BodyPartUpper Leg                                                         8814.775
## BodyPartVertebrae                                                        42303.598
## BodyPartWhole Body                                                      282651.303
## BodyPartWrist                                                             4369.414
## AverageWeeklyWage1                                                           8.033
##                                                                         Std. Error
## (Intercept)                                                              80324.302
## ClaimantAge_at_DOI                                                          40.356
## GenderMale                                                                 924.372
## GenderNot Available                                                       8412.029
## ClaimantTypeMedical Only                                                  1151.718
## ClaimantTypeReport Only                                                   2596.461
## InjuryNatureAll Other Specific Injuries, Noc                             80193.009
## InjuryNatureAmputation                                                   85019.038
## InjuryNatureAngina Pectoris                                              99649.060
## InjuryNatureAsbestosis                                                   81901.691
## InjuryNatureAsphyxiation                                                113437.609
## InjuryNatureBlack Lung                                                  113437.622
## InjuryNatureBurn                                                         80290.802
## InjuryNatureCancer                                                       89616.031
## InjuryNatureCarpal Tunnel Syndrome                                       80356.956
## InjuryNatureConcussion                                                   80561.498
## InjuryNatureContagious Disease                                           80665.081
## InjuryNatureContusion                                                    80177.419
## InjuryNatureCrushing                                                     80451.056
## InjuryNatureDermatitis                                                   80257.987
## InjuryNatureDislocation                                                  80430.024
## InjuryNatureDust Disease, NOC                                            92786.994
## InjuryNatureElectric Shock                                               81162.354
## InjuryNatureForeign Body                                                 80236.920
## InjuryNatureFracture                                                     80217.587
## InjuryNatureFreezing                                                     92519.290
## InjuryNatureHearing Loss Or Impairment                                   82604.643
## InjuryNatureHeat Prostration                                             81018.386
## InjuryNatureHernia                                                       80880.627
## InjuryNatureInfection                                                    80567.878
## InjuryNatureInflammation                                                 80288.393
## InjuryNatureLaceration                                                   80193.659
## InjuryNatureLoss of Hearing                                              83088.657
## InjuryNatureMental Disorder                                              87993.511
## InjuryNatureMental Stress                                                80768.537
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  82785.600
## InjuryNatureMultiple Physical Injuries Only                              80247.728
## InjuryNatureMyocardial Infarction                                        86640.620
## InjuryNatureNo Physical Injury                                           80107.589
## InjuryNatureNon-Standard Code                                            80816.517
## InjuryNatureNot Available                                               113252.781
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       80807.053
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              82606.363
## InjuryNaturePuncture                                                     80203.305
## InjuryNatureRadiation                                                    82974.295
## InjuryNatureRespiratory Disorders                                        80378.882
## InjuryNatureRupture                                                      81190.230
## InjuryNatureSeverance                                                    83210.635
## InjuryNatureSprain                                                       80194.196
## InjuryNatureStrain                                                       80179.556
## InjuryNatureSyncope                                                      80930.719
## InjuryNatureVascular                                                    113234.493
## InjuryNatureVDT-Related Disease                                         113271.033
## InjuryNatureVision Loss                                                  83469.116
## BodyPartAnkle                                                             5363.611
## BodyPartArtificial Appliance                                             36109.260
## BodyPartBody Systems and Multiple Body Systems                            8915.885
## BodyPartBrain                                                            37047.195
## BodyPartButtocks                                                          9257.517
## BodyPartChest                                                             5913.003
## BodyPartDisc-Trunk                                                        7302.433
## BodyPartEar(S)                                                           10089.847
## BodyPartElbow                                                             5954.787
## BodyPartEyes                                                              5576.578
## BodyPartFacial Bones                                                      6985.219
## BodyPartFinger(S)                                                         5125.158
## BodyPartFoot                                                              5489.081
## BodyPartGreat Toe                                                        10707.246
## BodyPartHand                                                              5144.975
## BodyPartHeart                                                            35296.384
## BodyPartHip                                                               6568.031
## BodyPartInsufficient Info to Properly Identify?Unclassified               6942.928
## BodyPartInternal Organs                                                  12746.028
## BodyPartKnee                                                              5009.786
## BodyPartLarynx                                                           80079.382
## BodyPartLower Arm                                                         5602.695
## BodyPartLower Back Area                                                   4983.513
## BodyPartLower Leg                                                         5682.327
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               5936.735
## BodyPartLungs                                                             9117.679
## BodyPartMouth                                                             7913.095
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)       4979.780
## BodyPartMultiple Head Injury                                              5437.437
## BodyPartMultiple Lower Extremities                                        6354.356
## BodyPartMultiple Neck Injury                                              5687.546
## BodyPartMultiple Trunk                                                   11836.092
## BodyPartMultiple Upper Extremities                                        5970.774
## BodyPartNo Physical Injury                                                7767.692
## BodyPartNon-Standard Code                                                11723.829
## BodyPartNose                                                              8075.992
## BodyPartPelvis                                                           11391.171
## BodyPartSacrum And Coccyx                                                16117.229
## BodyPartShoulder(S)                                                       5192.739
## BodyPartSkull                                                            14830.954
## BodyPartSoft Tissue-Head                                                 80358.338
## BodyPartSoft Tissue-Neck                                                  6718.384
## BodyPartSpinal Cord-Trunk                                                14175.428
## BodyPartTeeth                                                             9718.313
## BodyPartThumb                                                             5668.312
## BodyPartToes                                                              7646.666
## BodyPartTrachea                                                          30891.755
## BodyPartUpper Arm                                                         6128.186
## BodyPartUpper Back Area                                                   6936.952
## BodyPartUpper Leg                                                         6912.065
## BodyPartVertebrae                                                        40327.577
## BodyPartWhole Body                                                       30599.198
## BodyPartWrist                                                             5292.863
## AverageWeeklyWage1                                                           2.081
##                                                                         t value
## (Intercept)                                                              -0.188
## 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
## BodyPartAnkle                                                             0.383
## BodyPartArtificial Appliance                                             -0.046
## BodyPartBody Systems and Multiple Body Systems                            0.689
## BodyPartBrain                                                            10.904
## BodyPartButtocks                                                          2.030
## BodyPartChest                                                             0.658
## BodyPartDisc-Trunk                                                        2.412
## BodyPartEar(S)                                                            0.175
## BodyPartElbow                                                             0.704
## BodyPartEyes                                                              0.901
## BodyPartFacial Bones                                                      0.723
## BodyPartFinger(S)                                                         0.306
## BodyPartFoot                                                              0.061
## BodyPartGreat Toe                                                         0.008
## BodyPartHand                                                              0.293
## BodyPartHeart                                                             0.174
## BodyPartHip                                                               2.386
## BodyPartInsufficient Info to Properly Identify?Unclassified               0.008
## BodyPartInternal Organs                                                   0.964
## BodyPartKnee                                                              1.521
## BodyPartLarynx                                                           -0.537
## BodyPartLower Arm                                                         0.303
## BodyPartLower Back Area                                                   5.080
## BodyPartLower Leg                                                         1.541
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               2.985
## BodyPartLungs                                                            -0.054
## BodyPartMouth                                                             0.611
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)       2.330
## BodyPartMultiple Head Injury                                              1.444
## BodyPartMultiple Lower Extremities                                        1.688
## BodyPartMultiple Neck Injury                                              1.838
## BodyPartMultiple Trunk                                                    0.508
## BodyPartMultiple Upper Extremities                                        1.428
## BodyPartNo Physical Injury                                                0.908
## BodyPartNon-Standard Code                                                -0.248
## BodyPartNose                                                              0.145
## BodyPartPelvis                                                            0.066
## BodyPartSacrum And Coccyx                                                 1.201
## BodyPartShoulder(S)                                                       2.123
## BodyPartSkull                                                             2.584
## BodyPartSoft Tissue-Head                                                 -0.327
## BodyPartSoft Tissue-Neck                                                  3.609
## BodyPartSpinal Cord-Trunk                                                 6.495
## BodyPartTeeth                                                            -0.892
## BodyPartThumb                                                             0.277
## BodyPartToes                                                              0.064
## BodyPartTrachea                                                          -0.443
## BodyPartUpper Arm                                                         1.238
## BodyPartUpper Back Area                                                   0.988
## BodyPartUpper Leg                                                         1.275
## BodyPartVertebrae                                                         1.049
## BodyPartWhole Body                                                        9.237
## BodyPartWrist                                                             0.826
## AverageWeeklyWage1                                                        3.860
##                                                                         Pr(>|t|)
## (Intercept)                                                             0.850712
## ClaimantAge_at_DOI                                                      0.000109
## GenderMale                                                              0.164980
## GenderNot Available                                                      1.9e-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
## BodyPartAnkle                                                           0.701595
## BodyPartArtificial Appliance                                            0.963175
## BodyPartBody Systems and Multiple Body Systems                          0.490599
## BodyPartBrain                                                            < 2e-16
## BodyPartButtocks                                                        0.042366
## BodyPartChest                                                           0.510385
## BodyPartDisc-Trunk                                                      0.015884
## BodyPartEar(S)                                                          0.861381
## BodyPartElbow                                                           0.481305
## BodyPartEyes                                                            0.367574
## BodyPartFacial Bones                                                    0.469682
## BodyPartFinger(S)                                                       0.759310
## BodyPartFoot                                                            0.951376
## BodyPartGreat Toe                                                       0.993878
## BodyPartHand                                                            0.769830
## BodyPartHeart                                                           0.861813
## BodyPartHip                                                             0.017053
## BodyPartInsufficient Info to Properly Identify?Unclassified             0.993529
## BodyPartInternal Organs                                                 0.335180
## BodyPartKnee                                                            0.128216
## BodyPartLarynx                                                          0.591389
## BodyPartLower Arm                                                       0.762152
## BodyPartLower Back Area                                                  3.8e-07
## BodyPartLower Leg                                                       0.123233
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             0.002835
## BodyPartLungs                                                           0.956579
## BodyPartMouth                                                           0.541157
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)     0.019834
## BodyPartMultiple Head Injury                                            0.148852
## BodyPartMultiple Lower Extremities                                      0.091418
## BodyPartMultiple Neck Injury                                            0.066062
## BodyPartMultiple Trunk                                                  0.611717
## BodyPartMultiple Upper Extremities                                      0.153426
## BodyPartNo Physical Injury                                              0.363987
## BodyPartNon-Standard Code                                               0.804159
## BodyPartNose                                                            0.884520
## BodyPartPelvis                                                          0.947456
## BodyPartSacrum And Coccyx                                               0.229765
## BodyPartShoulder(S)                                                     0.033781
## BodyPartSkull                                                           0.009766
## BodyPartSoft Tissue-Head                                                0.743912
## BodyPartSoft Tissue-Neck                                                0.000307
## BodyPartSpinal Cord-Trunk                                                8.4e-11
## BodyPartTeeth                                                           0.372556
## BodyPartThumb                                                           0.782066
## BodyPartToes                                                            0.948574
## BodyPartTrachea                                                         0.657597
## BodyPartUpper Arm                                                       0.215697
## BodyPartUpper Back Area                                                 0.323337
## BodyPartUpper Leg                                                       0.202222
## BodyPartVertebrae                                                       0.294187
## BodyPartWhole Body                                                       < 2e-16
## BodyPartWrist                                                           0.409077
## 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                                                    
## 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

Después se utilizará la función de predicción para completarla

new_data <- data.frame(ClaimantAge_at_DOI=40, Gender="Male", ClaimantType="Medical Only", InjuryNature="Amputation", BodyPartRegion="Multiple Body Parts", BodyPart="Brain", AverageWeeklyWage1=537)
predict(regression, new_data)
##        1 
## 384922.1

Conclusión

Con el anterior modelo podemos predecir la cantidad que se gastará el seguro en un empleado hombre de 40 años que tiene una amputación en alguna parte de su cuerpo, en este caso en el área del cerebro y teniendo un promedio de ingreso semanal de 537, la predicción da $384,922.1