Teoría

lm() es la función de R para ajustar modelos lineales.
Es el modelo estadístico más básico que existe y más fácil de interpretar.
Para interpretarlo se usa la medida R-cuadrada, que significa qué tan cerca están los datos de la línea de regresión ajustada (va de 0 a 1, donde 1 es que el modelo explica toda la variabilidad).

Importar base de datos

#file.choose()
base_de_datos <- read.csv("C:\\Users\\naila\\OneDrive\\Documentos\\1 TEC\\7MO SEMESTRE\\M2\\seguros.csv")

Entender la base de datos

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

Generar regresion (modelo lineal)

columnas_categoricas <- c("Gender", "ClaimantType", "InjuryNature", "BodyPartRegion", "BodyPart")
base_de_datos[columnas_categoricas] <- lapply(base_de_datos[columnas_categoricas], as.factor)
regresion <- lm(TotalIncurredCost ~ IsDenied + Gender + ClaimantType + InjuryNature + BodyPartRegion + BodyPart + Transaction_Time + Procesing_Time + ClaimantAge_at_DOI +AverageWeeklyWage1, data=base_de_datos)
summary(regresion)
## 
## Call:
## lm(formula = TotalIncurredCost ~ IsDenied + Gender + ClaimantType + 
##     InjuryNature + BodyPartRegion + BodyPart + Transaction_Time + 
##     Procesing_Time + ClaimantAge_at_DOI + AverageWeeklyWage1, 
##     data = base_de_datos)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -218634   -4921    -124    2933 1359517 
## 
## Coefficients: (6 not defined because of singularities)
##                                                                           Estimate
## (Intercept)                                                             -8.297e+03
## IsDenied                                                                -7.719e+03
## GenderMale                                                               3.464e+02
## GenderNot Available                                                      1.910e+04
## ClaimantTypeMedical Only                                                -2.145e+04
## ClaimantTypeReport Only                                                 -2.034e+04
## InjuryNatureAll Other Specific Injuries, Noc                             1.247e+04
## InjuryNatureAmputation                                                   2.060e+04
## InjuryNatureAngina Pectoris                                             -4.732e+03
## InjuryNatureAsbestosis                                                   1.893e+04
## InjuryNatureAsphyxiation                                                 1.144e+04
## InjuryNatureBlack Lung                                                   1.452e+04
## InjuryNatureBurn                                                         1.907e+04
## InjuryNatureCancer                                                       4.086e+04
## InjuryNatureCarpal Tunnel Syndrome                                       1.087e+04
## InjuryNatureConcussion                                                   2.125e+04
## InjuryNatureContagious Disease                                           1.097e+04
## InjuryNatureContusion                                                    1.459e+04
## InjuryNatureCrushing                                                     2.006e+04
## InjuryNatureDermatitis                                                   1.495e+04
## InjuryNatureDislocation                                                  1.439e+04
## InjuryNatureDust Disease, NOC                                            1.660e+04
## InjuryNatureElectric Shock                                               1.222e+04
## InjuryNatureForeign Body                                                 1.327e+04
## InjuryNatureFracture                                                     1.770e+04
## InjuryNatureFreezing                                                     1.055e+04
## InjuryNatureHearing Loss Or Impairment                                   5.991e+03
## InjuryNatureHeat Prostration                                             1.337e+04
## InjuryNatureHernia                                                       1.025e+04
## InjuryNatureInfection                                                    1.262e+04
## InjuryNatureInflammation                                                 1.614e+04
## InjuryNatureLaceration                                                   1.538e+04
## InjuryNatureLoss of Hearing                                              1.026e+04
## InjuryNatureMental Disorder                                              4.663e+03
## InjuryNatureMental Stress                                                9.083e+03
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  2.436e+04
## InjuryNatureMultiple Physical Injuries Only                              1.603e+04
## InjuryNatureMyocardial Infarction                                        1.784e+04
## InjuryNatureNo Physical Injury                                           1.397e+04
## InjuryNatureNon-Standard Code                                            1.260e+04
## InjuryNatureNot Available                                                2.020e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       1.168e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              1.499e+04
## InjuryNaturePuncture                                                     1.554e+04
## InjuryNatureRadiation                                                    1.634e+04
## InjuryNatureRespiratory Disorders                                        1.504e+04
## InjuryNatureRupture                                                      1.978e+04
## InjuryNatureSeverance                                                    4.431e+04
## InjuryNatureSprain                                                       1.603e+04
## InjuryNatureStrain                                                       1.420e+04
## InjuryNatureSyncope                                                      1.878e+04
## InjuryNatureVascular                                                    -5.688e+03
## InjuryNatureVDT-Related Disease                                         -6.460e+03
## InjuryNatureVision Loss                                                  1.726e+04
## BodyPartRegionLower Extremities                                          5.941e+03
## BodyPartRegionMultiple Body Parts                                        1.366e+05
## BodyPartRegionNeck                                                       7.045e+04
## BodyPartRegionNon-Standard Code                                         -7.611e+03
## BodyPartRegionTrunk                                                      3.842e+03
## BodyPartRegionUpper Extremities                                          4.280e+03
## BodyPartAnkle                                                           -2.347e+03
## BodyPartArtificial Appliance                                            -1.340e+05
## BodyPartBody Systems and Multiple Body Systems                          -1.328e+05
## BodyPartBrain                                                            7.677e+04
## BodyPartButtocks                                                         1.310e+03
## BodyPartChest                                                            1.935e+03
## BodyPartDisc-Trunk                                                       7.338e+03
## BodyPartEar(S)                                                           4.185e+03
## BodyPartElbow                                                            1.559e+03
## BodyPartEyes                                                             5.604e+03
## BodyPartFacial Bones                                                     4.260e+03
## BodyPartFinger(S)                                                       -1.706e+03
## BodyPartFoot                                                            -2.774e+03
## BodyPartGreat Toe                                                       -2.750e+03
## BodyPartHand                                                            -5.760e+02
## BodyPartHeart                                                            9.103e+03
## BodyPartHip                                                              1.086e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified             -1.318e+05
## BodyPartInternal Organs                                                 -7.432e+03
## BodyPartKnee                                                             7.782e+02
## BodyPartLarynx                                                          -8.151e+04
## BodyPartLower Arm                                                        4.965e+02
## BodyPartLower Back Area                                                  3.649e+03
## BodyPartLower Leg                                                       -1.822e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              4.508e+03
## BodyPartLungs                                                            1.540e+03
## BodyPartMouth                                                            4.116e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)     -1.301e+05
## BodyPartMultiple Head Injury                                             6.054e+03
## BodyPartMultiple Lower Extremities                                       3.767e+03
## BodyPartMultiple Neck Injury                                            -6.422e+04
## BodyPartMultiple Trunk                                                  -2.386e+03
## BodyPartMultiple Upper Extremities                                       7.155e+01
## BodyPartNo Physical Injury                                              -1.319e+05
## BodyPartNon-Standard Code                                                       NA
## BodyPartNose                                                             4.563e+03
## BodyPartPelvis                                                           4.726e+03
## BodyPartSacrum And Coccyx                                               -1.220e+03
## BodyPartShoulder(S)                                                      3.910e+03
## BodyPartSkull                                                            3.982e+03
## BodyPartSoft Tissue-Head                                                -4.966e+03
## BodyPartSoft Tissue-Neck                                                -6.540e+04
## BodyPartSpinal Cord-Trunk                                                6.031e+03
## BodyPartTeeth                                                                   NA
## BodyPartThumb                                                           -7.054e+02
## BodyPartToes                                                            -2.594e+03
## BodyPartTrachea                                                         -7.360e+04
## BodyPartUpper Arm                                                       -5.681e+02
## BodyPartUpper Back Area                                                  1.986e+03
## BodyPartUpper Leg                                                               NA
## BodyPartVertebrae                                                               NA
## BodyPartWhole Body                                                              NA
## BodyPartWrist                                                                   NA
## Transaction_Time                                                         3.790e+00
## Procesing_Time                                                           2.684e+01
## ClaimantAge_at_DOI                                                       7.796e+01
## AverageWeeklyWage1                                                       4.747e+00
##                                                                         Std. Error
## (Intercept)                                                              2.535e+04
## IsDenied                                                                 7.199e+02
## GenderMale                                                               2.937e+02
## GenderNot Available                                                      2.818e+03
## ClaimantTypeMedical Only                                                 3.762e+02
## ClaimantTypeReport Only                                                  8.225e+02
## InjuryNatureAll Other Specific Injuries, Noc                             2.522e+04
## InjuryNatureAmputation                                                   2.694e+04
## InjuryNatureAngina Pectoris                                              3.133e+04
## InjuryNatureAsbestosis                                                   2.576e+04
## InjuryNatureAsphyxiation                                                 3.567e+04
## InjuryNatureBlack Lung                                                   3.567e+04
## InjuryNatureBurn                                                         2.524e+04
## InjuryNatureCancer                                                       2.818e+04
## InjuryNatureCarpal Tunnel Syndrome                                       2.527e+04
## InjuryNatureConcussion                                                   2.534e+04
## InjuryNatureContagious Disease                                           2.537e+04
## InjuryNatureContusion                                                    2.521e+04
## InjuryNatureCrushing                                                     2.530e+04
## InjuryNatureDermatitis                                                   2.523e+04
## InjuryNatureDislocation                                                  2.529e+04
## InjuryNatureDust Disease, NOC                                            2.917e+04
## InjuryNatureElectric Shock                                               2.554e+04
## InjuryNatureForeign Body                                                 2.523e+04
## InjuryNatureFracture                                                     2.522e+04
## InjuryNatureFreezing                                                     2.909e+04
## InjuryNatureHearing Loss Or Impairment                                   2.600e+04
## InjuryNatureHeat Prostration                                             2.547e+04
## InjuryNatureHernia                                                       2.543e+04
## InjuryNatureInfection                                                    2.533e+04
## InjuryNatureInflammation                                                 2.525e+04
## InjuryNatureLaceration                                                   2.521e+04
## InjuryNatureLoss of Hearing                                              2.613e+04
## InjuryNatureMental Disorder                                              2.774e+04
## InjuryNatureMental Stress                                                2.543e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  2.603e+04
## InjuryNatureMultiple Physical Injuries Only                              2.523e+04
## InjuryNatureMyocardial Infarction                                        2.725e+04
## InjuryNatureNo Physical Injury                                           2.519e+04
## InjuryNatureNon-Standard Code                                            2.541e+04
## InjuryNatureNot Available                                                3.561e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       2.541e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              2.597e+04
## InjuryNaturePuncture                                                     2.522e+04
## InjuryNatureRadiation                                                    2.609e+04
## InjuryNatureRespiratory Disorders                                        2.527e+04
## InjuryNatureRupture                                                      2.556e+04
## InjuryNatureSeverance                                                    2.624e+04
## InjuryNatureSprain                                                       2.521e+04
## InjuryNatureStrain                                                       2.521e+04
## InjuryNatureSyncope                                                      2.545e+04
## InjuryNatureVascular                                                     3.560e+04
## InjuryNatureVDT-Related Disease                                          3.561e+04
## InjuryNatureVision Loss                                                  2.624e+04
## BodyPartRegionLower Extremities                                          3.099e+03
## BodyPartRegionMultiple Body Parts                                        1.476e+04
## BodyPartRegionNeck                                                       1.286e+04
## BodyPartRegionNon-Standard Code                                          4.346e+03
## BodyPartRegionTrunk                                                      3.057e+03
## BodyPartRegionUpper Extremities                                          2.752e+03
## BodyPartAnkle                                                            1.770e+03
## BodyPartArtificial Appliance                                             1.837e+04
## BodyPartBody Systems and Multiple Body Systems                           1.471e+04
## BodyPartBrain                                                            1.536e+04
## BodyPartButtocks                                                         2.965e+03
## BodyPartChest                                                            1.861e+03
## BodyPartDisc-Trunk                                                       2.326e+03
## BodyPartEar(S)                                                           3.859e+03
## BodyPartElbow                                                            1.336e+03
## BodyPartEyes                                                             2.810e+03
## BodyPartFacial Bones                                                     3.104e+03
## BodyPartFinger(S)                                                        9.262e+02
## BodyPartFoot                                                             1.802e+03
## BodyPartGreat Toe                                                        3.405e+03
## BodyPartHand                                                             9.348e+02
## BodyPartHeart                                                            1.110e+04
## BodyPartHip                                                              2.142e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified              1.460e+04
## BodyPartInternal Organs                                                  4.093e+03
## BodyPartKnee                                                             1.665e+03
## BodyPartLarynx                                                           2.811e+04
## BodyPartLower Arm                                                        1.174e+03
## BodyPartLower Back Area                                                  1.571e+03
## BodyPartLower Leg                                                        1.861e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              1.881e+03
## BodyPartLungs                                                            2.868e+03
## BodyPartMouth                                                            3.320e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      1.452e+04
## BodyPartMultiple Head Injury                                             2.782e+03
## BodyPartMultiple Lower Extremities                                       2.073e+03
## BodyPartMultiple Neck Injury                                             1.263e+04
## BodyPartMultiple Trunk                                                   3.752e+03
## BodyPartMultiple Upper Extremities                                       1.351e+03
## BodyPartNo Physical Injury                                               1.465e+04
## BodyPartNon-Standard Code                                                       NA
## BodyPartNose                                                             3.333e+03
## BodyPartPelvis                                                           3.582e+03
## BodyPartSacrum And Coccyx                                                5.156e+03
## BodyPartShoulder(S)                                                      9.792e+02
## BodyPartSkull                                                            5.215e+03
## BodyPartSoft Tissue-Head                                                 2.537e+04
## BodyPartSoft Tissue-Neck                                                 1.269e+04
## BodyPartSpinal Cord-Trunk                                                4.695e+03
## BodyPartTeeth                                                                   NA
## BodyPartThumb                                                            1.198e+03
## BodyPartToes                                                             2.460e+03
## BodyPartTrachea                                                          1.584e+04
## BodyPartUpper Arm                                                        1.418e+03
## BodyPartUpper Back Area                                                  2.188e+03
## BodyPartUpper Leg                                                               NA
## BodyPartVertebrae                                                               NA
## BodyPartWhole Body                                                              NA
## BodyPartWrist                                                                   NA
## Transaction_Time                                                         1.631e-01
## Procesing_Time                                                           7.794e-01
## ClaimantAge_at_DOI                                                       1.284e+01
## AverageWeeklyWage1                                                       6.648e-01
##                                                                         t value
## (Intercept)                                                              -0.327
## IsDenied                                                                -10.723
## GenderMale                                                                1.179
## GenderNot Available                                                       6.779
## ClaimantTypeMedical Only                                                -57.011
## ClaimantTypeReport Only                                                 -24.731
## InjuryNatureAll Other Specific Injuries, Noc                              0.495
## InjuryNatureAmputation                                                    0.765
## InjuryNatureAngina Pectoris                                              -0.151
## InjuryNatureAsbestosis                                                    0.735
## InjuryNatureAsphyxiation                                                  0.321
## InjuryNatureBlack Lung                                                    0.407
## InjuryNatureBurn                                                          0.755
## InjuryNatureCancer                                                        1.450
## InjuryNatureCarpal Tunnel Syndrome                                        0.430
## InjuryNatureConcussion                                                    0.839
## InjuryNatureContagious Disease                                            0.432
## InjuryNatureContusion                                                     0.579
## InjuryNatureCrushing                                                      0.793
## InjuryNatureDermatitis                                                    0.593
## InjuryNatureDislocation                                                   0.569
## InjuryNatureDust Disease, NOC                                             0.569
## InjuryNatureElectric Shock                                                0.478
## InjuryNatureForeign Body                                                  0.526
## InjuryNatureFracture                                                      0.702
## InjuryNatureFreezing                                                      0.363
## InjuryNatureHearing Loss Or Impairment                                    0.230
## InjuryNatureHeat Prostration                                              0.525
## InjuryNatureHernia                                                        0.403
## InjuryNatureInfection                                                     0.498
## InjuryNatureInflammation                                                  0.639
## InjuryNatureLaceration                                                    0.610
## InjuryNatureLoss of Hearing                                               0.393
## InjuryNatureMental Disorder                                               0.168
## InjuryNatureMental Stress                                                 0.357
## InjuryNatureMultiple Injuries Including Both Physical and Psychological   0.936
## InjuryNatureMultiple Physical Injuries Only                               0.635
## InjuryNatureMyocardial Infarction                                         0.655
## InjuryNatureNo Physical Injury                                            0.555
## InjuryNatureNon-Standard Code                                             0.496
## InjuryNatureNot Available                                                 0.567
## InjuryNaturePoisoning?Chemical (Other Than Metals)                        0.460
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)               0.577
## InjuryNaturePuncture                                                      0.616
## InjuryNatureRadiation                                                     0.626
## InjuryNatureRespiratory Disorders                                         0.595
## InjuryNatureRupture                                                       0.774
## InjuryNatureSeverance                                                     1.688
## InjuryNatureSprain                                                        0.636
## InjuryNatureStrain                                                        0.563
## InjuryNatureSyncope                                                       0.738
## InjuryNatureVascular                                                     -0.160
## InjuryNatureVDT-Related Disease                                          -0.181
## InjuryNatureVision Loss                                                   0.658
## BodyPartRegionLower Extremities                                           1.917
## BodyPartRegionMultiple Body Parts                                         9.259
## BodyPartRegionNeck                                                        5.479
## BodyPartRegionNon-Standard Code                                          -1.751
## BodyPartRegionTrunk                                                       1.257
## BodyPartRegionUpper Extremities                                           1.555
## BodyPartAnkle                                                            -1.326
## BodyPartArtificial Appliance                                             -7.298
## BodyPartBody Systems and Multiple Body Systems                           -9.029
## BodyPartBrain                                                             4.999
## BodyPartButtocks                                                          0.442
## BodyPartChest                                                             1.040
## BodyPartDisc-Trunk                                                        3.155
## BodyPartEar(S)                                                            1.085
## BodyPartElbow                                                             1.166
## BodyPartEyes                                                              1.995
## BodyPartFacial Bones                                                      1.372
## BodyPartFinger(S)                                                        -1.842
## BodyPartFoot                                                             -1.540
## BodyPartGreat Toe                                                        -0.808
## BodyPartHand                                                             -0.616
## BodyPartHeart                                                             0.820
## BodyPartHip                                                               0.507
## BodyPartInsufficient Info to Properly Identify?Unclassified              -9.024
## BodyPartInternal Organs                                                  -1.816
## BodyPartKnee                                                              0.468
## BodyPartLarynx                                                           -2.900
## BodyPartLower Arm                                                         0.423
## BodyPartLower Back Area                                                   2.323
## BodyPartLower Leg                                                        -0.979
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               2.397
## BodyPartLungs                                                             0.537
## BodyPartMouth                                                             1.240
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      -8.962
## BodyPartMultiple Head Injury                                              2.176
## BodyPartMultiple Lower Extremities                                        1.818
## BodyPartMultiple Neck Injury                                             -5.084
## BodyPartMultiple Trunk                                                   -0.636
## BodyPartMultiple Upper Extremities                                        0.053
## BodyPartNo Physical Injury                                               -9.008
## BodyPartNon-Standard Code                                                    NA
## BodyPartNose                                                              1.369
## BodyPartPelvis                                                            1.319
## BodyPartSacrum And Coccyx                                                -0.237
## BodyPartShoulder(S)                                                       3.993
## BodyPartSkull                                                             0.764
## BodyPartSoft Tissue-Head                                                 -0.196
## BodyPartSoft Tissue-Neck                                                 -5.154
## BodyPartSpinal Cord-Trunk                                                 1.285
## BodyPartTeeth                                                                NA
## BodyPartThumb                                                            -0.589
## BodyPartToes                                                             -1.054
## BodyPartTrachea                                                          -4.647
## BodyPartUpper Arm                                                        -0.400
## BodyPartUpper Back Area                                                   0.908
## BodyPartUpper Leg                                                            NA
## BodyPartVertebrae                                                            NA
## BodyPartWhole Body                                                           NA
## BodyPartWrist                                                                NA
## Transaction_Time                                                         23.241
## Procesing_Time                                                           34.437
## ClaimantAge_at_DOI                                                        6.069
## AverageWeeklyWage1                                                        7.142
##                                                                         Pr(>|t|)
## (Intercept)                                                              0.74347
## IsDenied                                                                 < 2e-16
## GenderMale                                                               0.23833
## GenderNot Available                                                     1.23e-11
## ClaimantTypeMedical Only                                                 < 2e-16
## ClaimantTypeReport Only                                                  < 2e-16
## InjuryNatureAll Other Specific Injuries, Noc                             0.62092
## InjuryNatureAmputation                                                   0.44447
## InjuryNatureAngina Pectoris                                              0.87995
## InjuryNatureAsbestosis                                                   0.46247
## InjuryNatureAsphyxiation                                                 0.74850
## InjuryNatureBlack Lung                                                   0.68385
## InjuryNatureBurn                                                         0.45004
## InjuryNatureCancer                                                       0.14709
## InjuryNatureCarpal Tunnel Syndrome                                       0.66718
## InjuryNatureConcussion                                                   0.40163
## InjuryNatureContagious Disease                                           0.66544
## InjuryNatureContusion                                                    0.56277
## InjuryNatureCrushing                                                     0.42772
## InjuryNatureDermatitis                                                   0.55351
## InjuryNatureDislocation                                                  0.56926
## InjuryNatureDust Disease, NOC                                            0.56929
## InjuryNatureElectric Shock                                               0.63246
## InjuryNatureForeign Body                                                 0.59882
## InjuryNatureFracture                                                     0.48279
## InjuryNatureFreezing                                                     0.71675
## InjuryNatureHearing Loss Or Impairment                                   0.81779
## InjuryNatureHeat Prostration                                             0.59969
## InjuryNatureHernia                                                       0.68692
## InjuryNatureInfection                                                    0.61831
## InjuryNatureInflammation                                                 0.52261
## InjuryNatureLaceration                                                   0.54194
## InjuryNatureLoss of Hearing                                              0.69462
## InjuryNatureMental Disorder                                              0.86649
## InjuryNatureMental Stress                                                0.72095
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  0.34935
## InjuryNatureMultiple Physical Injuries Only                              0.52521
## InjuryNatureMyocardial Infarction                                        0.51254
## InjuryNatureNo Physical Injury                                           0.57920
## InjuryNatureNon-Standard Code                                            0.62017
## InjuryNatureNot Available                                                0.57045
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       0.64576
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              0.56380
## InjuryNaturePuncture                                                     0.53781
## InjuryNatureRadiation                                                    0.53122
## InjuryNatureRespiratory Disorders                                        0.55171
## InjuryNatureRupture                                                      0.43919
## InjuryNatureSeverance                                                    0.09137
## InjuryNatureSprain                                                       0.52498
## InjuryNatureStrain                                                       0.57338
## InjuryNatureSyncope                                                      0.46060
## InjuryNatureVascular                                                     0.87306
## InjuryNatureVDT-Related Disease                                          0.85607
## InjuryNatureVision Loss                                                  0.51072
## BodyPartRegionLower Extremities                                          0.05521
## BodyPartRegionMultiple Body Parts                                        < 2e-16
## BodyPartRegionNeck                                                      4.32e-08
## BodyPartRegionNon-Standard Code                                          0.07990
## BodyPartRegionTrunk                                                      0.20881
## BodyPartRegionUpper Extremities                                          0.11998
## BodyPartAnkle                                                            0.18479
## BodyPartArtificial Appliance                                            2.98e-13
## BodyPartBody Systems and Multiple Body Systems                           < 2e-16
## BodyPartBrain                                                           5.80e-07
## BodyPartButtocks                                                         0.65857
## BodyPartChest                                                            0.29850
## BodyPartDisc-Trunk                                                       0.00161
## BodyPartEar(S)                                                           0.27810
## BodyPartElbow                                                            0.24351
## BodyPartEyes                                                             0.04608
## BodyPartFacial Bones                                                     0.17005
## BodyPartFinger(S)                                                        0.06546
## BodyPartFoot                                                             0.12365
## BodyPartGreat Toe                                                        0.41920
## BodyPartHand                                                             0.53779
## BodyPartHeart                                                            0.41210
## BodyPartHip                                                              0.61203
## BodyPartInsufficient Info to Properly Identify?Unclassified              < 2e-16
## BodyPartInternal Organs                                                  0.06940
## BodyPartKnee                                                             0.64014
## BodyPartLarynx                                                           0.00374
## BodyPartLower Arm                                                        0.67244
## BodyPartLower Back Area                                                  0.02020
## BodyPartLower Leg                                                        0.32750
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              0.01653
## BodyPartLungs                                                            0.59146
## BodyPartMouth                                                            0.21513
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      < 2e-16
## BodyPartMultiple Head Injury                                             0.02956
## BodyPartMultiple Lower Extremities                                       0.06913
## BodyPartMultiple Neck Injury                                            3.72e-07
## BodyPartMultiple Trunk                                                   0.52480
## BodyPartMultiple Upper Extremities                                       0.95777
## BodyPartNo Physical Injury                                               < 2e-16
## BodyPartNon-Standard Code                                                     NA
## BodyPartNose                                                             0.17095
## BodyPartPelvis                                                           0.18702
## BodyPartSacrum And Coccyx                                                0.81288
## BodyPartShoulder(S)                                                     6.55e-05
## BodyPartSkull                                                            0.44510
## BodyPartSoft Tissue-Head                                                 0.84478
## BodyPartSoft Tissue-Neck                                                2.57e-07
## BodyPartSpinal Cord-Trunk                                                0.19893
## BodyPartTeeth                                                                 NA
## BodyPartThumb                                                            0.55583
## BodyPartToes                                                             0.29171
## BodyPartTrachea                                                         3.38e-06
## BodyPartUpper Arm                                                        0.68880
## BodyPartUpper Back Area                                                  0.36399
## BodyPartUpper Leg                                                             NA
## BodyPartVertebrae                                                             NA
## BodyPartWhole Body                                                            NA
## BodyPartWrist                                                                 NA
## Transaction_Time                                                         < 2e-16
## Procesing_Time                                                           < 2e-16
## ClaimantAge_at_DOI                                                      1.30e-09
## AverageWeeklyWage1                                                      9.43e-13
##                                                                            
## (Intercept)                                                                
## IsDenied                                                                ***
## 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                                                              
## Transaction_Time                                                        ***
## Procesing_Time                                                          ***
## ClaimantAge_at_DOI                                                      ***
## AverageWeeklyWage1                                                      ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 25130 on 30894 degrees of freedom
##   (614 observations deleted due to missingness)
## Multiple R-squared:  0.1901, Adjusted R-squared:  0.1872 
## F-statistic: 65.91 on 110 and 30894 DF,  p-value: < 2.2e-16

Evaluar, y en caso necesario, ajustar la regresion

regresion <- lm(TotalIncurredCost ~ IsDenied + ClaimantType + Gender + Transaction_Time + Procesing_Time + ClaimantAge_at_DOI + AverageWeeklyWage1 + BodyPartRegion + BodyPart, data=base_de_datos)
summary(regresion)
## 
## Call:
## lm(formula = TotalIncurredCost ~ IsDenied + ClaimantType + Gender + 
##     Transaction_Time + Procesing_Time + ClaimantAge_at_DOI + 
##     AverageWeeklyWage1 + BodyPartRegion + BodyPart, data = base_de_datos)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -211952   -4723     -58    2848 1363485 
## 
## Coefficients: (6 not defined because of singularities)
##                                                                       Estimate
## (Intercept)                                                          7.605e+03
## IsDenied                                                            -8.093e+03
## ClaimantTypeMedical Only                                            -2.168e+04
## ClaimantTypeReport Only                                             -2.055e+04
## GenderMale                                                           4.058e+02
## GenderNot Available                                                  1.943e+04
## Transaction_Time                                                     3.647e+00
## Procesing_Time                                                       2.667e+01
## ClaimantAge_at_DOI                                                   7.795e+01
## AverageWeeklyWage1                                                   4.883e+00
## BodyPartRegionLower Extremities                                      5.071e+03
## BodyPartRegionMultiple Body Parts                                    1.353e+05
## BodyPartRegionNeck                                                   7.078e+04
## BodyPartRegionNon-Standard Code                                     -1.047e+04
## BodyPartRegionTrunk                                                  2.102e+03
## BodyPartRegionUpper Extremities                                      3.242e+03
## BodyPartAnkle                                                       -1.585e+03
## BodyPartArtificial Appliance                                        -1.336e+05
## BodyPartBody Systems and Multiple Body Systems                      -1.329e+05
## BodyPartBrain                                                        7.279e+04
## BodyPartButtocks                                                     2.312e+03
## BodyPartChest                                                        2.890e+03
## BodyPartDisc-Trunk                                                   7.796e+03
## BodyPartEar(S)                                                       9.774e+02
## BodyPartElbow                                                        1.694e+03
## BodyPartEyes                                                         4.128e+03
## BodyPartFacial Bones                                                 3.456e+03
## BodyPartFinger(S)                                                   -9.207e+02
## BodyPartFoot                                                        -2.234e+03
## BodyPartGreat Toe                                                   -2.222e+03
## BodyPartHand                                                        -2.775e+02
## BodyPartHeart                                                        1.055e+04
## BodyPartHip                                                          9.210e+02
## BodyPartInsufficient Info to Properly Identify?Unclassified         -1.321e+05
## BodyPartInternal Organs                                             -7.673e+03
## BodyPartKnee                                                         6.824e+02
## BodyPartLarynx                                                      -8.310e+04
## BodyPartLower Arm                                                    8.262e+02
## BodyPartLower Back Area                                              4.006e+03
## BodyPartLower Leg                                                   -1.659e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          4.897e+03
## BodyPartLungs                                                        2.671e+03
## BodyPartMouth                                                        3.214e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -1.298e+05
## BodyPartMultiple Head Injury                                         5.441e+03
## BodyPartMultiple Lower Extremities                                   3.841e+03
## BodyPartMultiple Neck Injury                                        -6.572e+04
## BodyPartMultiple Trunk                                              -2.053e+03
## BodyPartMultiple Upper Extremities                                   1.484e+02
## BodyPartNo Physical Injury                                          -1.327e+05
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                         4.166e+03
## BodyPartPelvis                                                       5.104e+03
## BodyPartSacrum And Coccyx                                            1.067e+01
## BodyPartShoulder(S)                                                  3.719e+03
## BodyPartSkull                                                        3.655e+03
## BodyPartSoft Tissue-Head                                            -3.561e+02
## BodyPartSoft Tissue-Neck                                            -6.651e+04
## BodyPartSpinal Cord-Trunk                                            6.399e+03
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                       -5.308e+01
## BodyPartToes                                                        -1.824e+03
## BodyPartTrachea                                                     -6.989e+04
## BodyPartUpper Arm                                                   -4.600e+02
## BodyPartUpper Back Area                                              2.469e+03
## BodyPartUpper Leg                                                           NA
## BodyPartVertebrae                                                           NA
## BodyPartWhole Body                                                          NA
## BodyPartWrist                                                               NA
##                                                                     Std. Error
## (Intercept)                                                          2.727e+03
## IsDenied                                                             7.045e+02
## ClaimantTypeMedical Only                                             3.658e+02
## ClaimantTypeReport Only                                              8.165e+02
## GenderMale                                                           2.914e+02
## GenderNot Available                                                  2.817e+03
## Transaction_Time                                                     1.590e-01
## Procesing_Time                                                       7.749e-01
## ClaimantAge_at_DOI                                                   1.281e+01
## AverageWeeklyWage1                                                   6.630e-01
## BodyPartRegionLower Extremities                                      3.065e+03
## BodyPartRegionMultiple Body Parts                                    1.476e+04
## BodyPartRegionNeck                                                   1.287e+04
## BodyPartRegionNon-Standard Code                                      2.863e+03
## BodyPartRegionTrunk                                                  2.987e+03
## BodyPartRegionUpper Extremities                                      2.718e+03
## BodyPartAnkle                                                        1.728e+03
## BodyPartArtificial Appliance                                         1.837e+04
## BodyPartBody Systems and Multiple Body Systems                       1.470e+04
## BodyPartBrain                                                        1.477e+04
## BodyPartButtocks                                                     2.927e+03
## BodyPartChest                                                        1.800e+03
## BodyPartDisc-Trunk                                                   2.286e+03
## BodyPartEar(S)                                                       3.506e+03
## BodyPartElbow                                                        1.325e+03
## BodyPartEyes                                                         2.718e+03
## BodyPartFacial Bones                                                 3.074e+03
## BodyPartFinger(S)                                                    8.841e+02
## BodyPartFoot                                                         1.794e+03
## BodyPartGreat Toe                                                    3.399e+03
## BodyPartHand                                                         9.161e+02
## BodyPartHeart                                                        7.415e+03
## BodyPartHip                                                          2.137e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified          1.461e+04
## BodyPartInternal Organs                                              4.057e+03
## BodyPartKnee                                                         1.655e+03
## BodyPartLarynx                                                       2.813e+04
## BodyPartLower Arm                                                    1.157e+03
## BodyPartLower Back Area                                              1.497e+03
## BodyPartLower Leg                                                    1.860e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)          1.821e+03
## BodyPartLungs                                                        2.324e+03
## BodyPartMouth                                                        3.289e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  1.453e+04
## BodyPartMultiple Head Injury                                         2.739e+03
## BodyPartMultiple Lower Extremities                                   2.071e+03
## BodyPartMultiple Neck Injury                                         1.264e+04
## BodyPartMultiple Trunk                                               3.740e+03
## BodyPartMultiple Upper Extremities                                   1.341e+03
## BodyPartNo Physical Injury                                           1.460e+04
## BodyPartNon-Standard Code                                                   NA
## BodyPartNose                                                         3.319e+03
## BodyPartPelvis                                                       3.573e+03
## BodyPartSacrum And Coccyx                                            5.135e+03
## BodyPartShoulder(S)                                                  9.611e+02
## BodyPartSkull                                                        5.163e+03
## BodyPartSoft Tissue-Head                                             2.529e+04
## BodyPartSoft Tissue-Neck                                             1.269e+04
## BodyPartSpinal Cord-Trunk                                            4.673e+03
## BodyPartTeeth                                                               NA
## BodyPartThumb                                                        1.172e+03
## BodyPartToes                                                         2.451e+03
## BodyPartTrachea                                                      1.578e+04
## BodyPartUpper Arm                                                    1.408e+03
## BodyPartUpper Back Area                                              2.139e+03
## BodyPartUpper Leg                                                           NA
## BodyPartVertebrae                                                           NA
## BodyPartWhole Body                                                          NA
## BodyPartWrist                                                               NA
##                                                                     t value
## (Intercept)                                                           2.789
## IsDenied                                                            -11.488
## ClaimantTypeMedical Only                                            -59.259
## ClaimantTypeReport Only                                             -25.170
## GenderMale                                                            1.392
## GenderNot Available                                                   6.897
## Transaction_Time                                                     22.937
## Procesing_Time                                                       34.424
## ClaimantAge_at_DOI                                                    6.083
## AverageWeeklyWage1                                                    7.366
## BodyPartRegionLower Extremities                                       1.655
## BodyPartRegionMultiple Body Parts                                     9.166
## BodyPartRegionNeck                                                    5.500
## BodyPartRegionNon-Standard Code                                      -3.657
## BodyPartRegionTrunk                                                   0.704
## BodyPartRegionUpper Extremities                                       1.193
## BodyPartAnkle                                                        -0.917
## BodyPartArtificial Appliance                                         -7.271
## BodyPartBody Systems and Multiple Body Systems                       -9.045
## BodyPartBrain                                                         4.929
## BodyPartButtocks                                                      0.790
## BodyPartChest                                                         1.605
## BodyPartDisc-Trunk                                                    3.410
## BodyPartEar(S)                                                        0.279
## BodyPartElbow                                                         1.278
## BodyPartEyes                                                          1.518
## BodyPartFacial Bones                                                  1.124
## BodyPartFinger(S)                                                    -1.041
## BodyPartFoot                                                         -1.245
## BodyPartGreat Toe                                                    -0.654
## BodyPartHand                                                         -0.303
## BodyPartHeart                                                         1.423
## BodyPartHip                                                           0.431
## BodyPartInsufficient Info to Properly Identify?Unclassified          -9.042
## BodyPartInternal Organs                                              -1.891
## BodyPartKnee                                                          0.412
## BodyPartLarynx                                                       -2.954
## BodyPartLower Arm                                                     0.714
## BodyPartLower Back Area                                               2.676
## BodyPartLower Leg                                                    -0.892
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)           2.689
## BodyPartLungs                                                         1.149
## BodyPartMouth                                                         0.977
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  -8.933
## BodyPartMultiple Head Injury                                          1.986
## BodyPartMultiple Lower Extremities                                    1.855
## BodyPartMultiple Neck Injury                                         -5.201
## BodyPartMultiple Trunk                                               -0.549
## BodyPartMultiple Upper Extremities                                    0.111
## BodyPartNo Physical Injury                                           -9.092
## BodyPartNon-Standard Code                                                NA
## BodyPartNose                                                          1.255
## BodyPartPelvis                                                        1.429
## BodyPartSacrum And Coccyx                                             0.002
## BodyPartShoulder(S)                                                   3.870
## BodyPartSkull                                                         0.708
## BodyPartSoft Tissue-Head                                             -0.014
## BodyPartSoft Tissue-Neck                                             -5.241
## BodyPartSpinal Cord-Trunk                                             1.369
## BodyPartTeeth                                                            NA
## BodyPartThumb                                                        -0.045
## BodyPartToes                                                         -0.744
## BodyPartTrachea                                                      -4.428
## BodyPartUpper Arm                                                    -0.327
## BodyPartUpper Back Area                                               1.154
## BodyPartUpper Leg                                                        NA
## BodyPartVertebrae                                                        NA
## BodyPartWhole Body                                                       NA
## BodyPartWrist                                                            NA
##                                                                     Pr(>|t|)
## (Intercept)                                                         0.005297
## IsDenied                                                             < 2e-16
## ClaimantTypeMedical Only                                             < 2e-16
## ClaimantTypeReport Only                                              < 2e-16
## GenderMale                                                          0.163798
## GenderNot Available                                                 5.41e-12
## Transaction_Time                                                     < 2e-16
## Procesing_Time                                                       < 2e-16
## ClaimantAge_at_DOI                                                  1.19e-09
## AverageWeeklyWage1                                                  1.81e-13
## BodyPartRegionLower Extremities                                     0.098012
## BodyPartRegionMultiple Body Parts                                    < 2e-16
## BodyPartRegionNeck                                                  3.82e-08
## BodyPartRegionNon-Standard Code                                     0.000256
## BodyPartRegionTrunk                                                 0.481575
## BodyPartRegionUpper Extremities                                     0.232979
## BodyPartAnkle                                                       0.359161
## BodyPartArtificial Appliance                                        3.65e-13
## BodyPartBody Systems and Multiple Body Systems                       < 2e-16
## BodyPartBrain                                                       8.29e-07
## BodyPartButtocks                                                    0.429655
## BodyPartChest                                                       0.108428
## BodyPartDisc-Trunk                                                  0.000650
## BodyPartEar(S)                                                      0.780434
## BodyPartElbow                                                       0.201198
## BodyPartEyes                                                        0.128931
## BodyPartFacial Bones                                                0.260857
## BodyPartFinger(S)                                                   0.297689
## BodyPartFoot                                                        0.212978
## BodyPartGreat Toe                                                   0.513200
## BodyPartHand                                                        0.761947
## BodyPartHeart                                                       0.154804
## BodyPartHip                                                         0.666491
## BodyPartInsufficient Info to Properly Identify?Unclassified          < 2e-16
## BodyPartInternal Organs                                             0.058620
## BodyPartKnee                                                        0.680134
## BodyPartLarynx                                                      0.003138
## BodyPartLower Arm                                                   0.475340
## BodyPartLower Back Area                                             0.007452
## BodyPartLower Leg                                                   0.372476
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)         0.007177
## BodyPartLungs                                                       0.250451
## BodyPartMouth                                                       0.328512
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)  < 2e-16
## BodyPartMultiple Head Injury                                        0.047038
## BodyPartMultiple Lower Extremities                                  0.063608
## BodyPartMultiple Neck Injury                                        1.99e-07
## BodyPartMultiple Trunk                                              0.583010
## BodyPartMultiple Upper Extremities                                  0.911923
## BodyPartNo Physical Injury                                           < 2e-16
## BodyPartNon-Standard Code                                                 NA
## BodyPartNose                                                        0.209431
## BodyPartPelvis                                                      0.153151
## BodyPartSacrum And Coccyx                                           0.998343
## BodyPartShoulder(S)                                                 0.000109
## BodyPartSkull                                                       0.478930
## BodyPartSoft Tissue-Head                                            0.988767
## BodyPartSoft Tissue-Neck                                            1.61e-07
## BodyPartSpinal Cord-Trunk                                           0.170860
## BodyPartTeeth                                                             NA
## BodyPartThumb                                                       0.963872
## BodyPartToes                                                        0.456857
## BodyPartTrachea                                                     9.53e-06
## BodyPartUpper Arm                                                   0.743899
## BodyPartUpper Back Area                                             0.248408
## BodyPartUpper Leg                                                         NA
## BodyPartVertebrae                                                         NA
## BodyPartWhole Body                                                        NA
## BodyPartWrist                                                             NA
##                                                                        
## (Intercept)                                                         ** 
## IsDenied                                                            ***
## ClaimantTypeMedical Only                                            ***
## ClaimantTypeReport Only                                             ***
## GenderMale                                                             
## GenderNot Available                                                 ***
## Transaction_Time                                                    ***
## Procesing_Time                                                      ***
## ClaimantAge_at_DOI                                                  ***
## AverageWeeklyWage1                                                  ***
## 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                                                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 25150 on 30942 degrees of freedom
##   (614 observations deleted due to missingness)
## Multiple R-squared:  0.1874, Adjusted R-squared:  0.1858 
## F-statistic: 115.1 on 62 and 30942 DF,  p-value: < 2.2e-16

Construir un modelo de prediccion

datos_nuevos <- data.frame(IsDenied=0, ClaimantType="Indemnity", Gender="Female", Transaction_Time=100, Procesing_Time=200, ClaimantAge_at_DOI=50, AverageWeeklyWage1=490, BodyPartRegion="Trunk", BodyPart="Lower Back Area")
predict(regresion,datos_nuevos)
##        1 
## 25703.79

Conclusión

El modelo de regresión lineal explica el 18% del comportamiento del costo del seguro. Este modelo se puede mejorar agregando otras variables que impacten.

LS0tDQp0aXRsZTogIlJlZ3Jlc2nDs24gTGluZWFsIC0gU2VndXJvcyINCmF1dGhvcjogIk5haWxhIFNhbGluYXMgLSBBMDA4MzI3MDIiDQpkYXRlOiAiMjAyNC0wOC0xOSINCm91dHB1dDogDQogaHRtbF9kb2N1bWVudDoNCiAgICB0b2M6IHRydWUNCiAgICB0b2NfZmxvYXQ6IHRydWUNCiAgICBjb2RlX2Rvd25sb2FkOiB0cnVlDQotLS0NCg0KIVtdKEM6XFxVc2Vyc1xcbmFpbGFcXE9uZURyaXZlXFxEb2N1bWVudG9zXFwxIFRFQ1xcN01PIFNFTUVTVFJFXFxNMlxcc2VndXJvLmdpZikNCg0KIyA8c3BhbiBzdHlsZT0iY29sb3I6IGdyYXk7Ij5UZW9yw61hPC9zcGFuPg0KKipsbSgpKiogZXMgbGEgZnVuY2nDs24gZGUgUiBwYXJhIGFqdXN0YXIgbW9kZWxvcyBsaW5lYWxlcy4gIA0KRXMgZWwgbW9kZWxvIGVzdGFkw61zdGljbyBtw6FzIGLDoXNpY28gcXVlIGV4aXN0ZSB5IG3DoXMgZsOhY2lsIGRlIGludGVycHJldGFyLiAgDQpQYXJhIGludGVycHJldGFybG8gc2UgdXNhIGxhIG1lZGlkYSBSLWN1YWRyYWRhLCBxdWUgc2lnbmlmaWNhIHF1w6kgdGFuIGNlcmNhIGVzdMOhbiBsb3MgZGF0b3MgZGUgbGEgbMOtbmVhIGRlIHJlZ3Jlc2nDs24gYWp1c3RhZGEgKHZhIGRlIDAgYSAxLCBkb25kZSAxIGVzIHF1ZSBlbCBtb2RlbG8gZXhwbGljYSB0b2RhIGxhIHZhcmlhYmlsaWRhZCkuICANCg0KDQojIDxzcGFuIHN0eWxlPSJjb2xvcjogZ3JheTsiPkltcG9ydGFyIGJhc2UgZGUgZGF0b3M8L3NwYW4+DQpgYGB7cn0NCiNmaWxlLmNob29zZSgpDQpiYXNlX2RlX2RhdG9zIDwtIHJlYWQuY3N2KCJDOlxcVXNlcnNcXG5haWxhXFxPbmVEcml2ZVxcRG9jdW1lbnRvc1xcMSBURUNcXDdNTyBTRU1FU1RSRVxcTTJcXHNlZ3Vyb3MuY3N2IikNCmBgYA0KDQojIDxzcGFuIHN0eWxlPSJjb2xvcjogZ3JheTsiPkVudGVuZGVyIGxhIGJhc2UgZGUgZGF0b3M8L3NwYW4+DQpgYGB7cn0NCnJlc3VtZW4gPC0gc3VtbWFyeShiYXNlX2RlX2RhdG9zKQ0KcmVzdW1lbg0KYGBgDQoNCg0KDQojIDxzcGFuIHN0eWxlPSJjb2xvcjogZ3JheTsiPkdlbmVyYXIgcmVncmVzaW9uIChtb2RlbG8gbGluZWFsKTwvc3Bhbj4NCmBgYHtyfQ0KY29sdW1uYXNfY2F0ZWdvcmljYXMgPC0gYygiR2VuZGVyIiwgIkNsYWltYW50VHlwZSIsICJJbmp1cnlOYXR1cmUiLCAiQm9keVBhcnRSZWdpb24iLCAiQm9keVBhcnQiKQ0KYmFzZV9kZV9kYXRvc1tjb2x1bW5hc19jYXRlZ29yaWNhc10gPC0gbGFwcGx5KGJhc2VfZGVfZGF0b3NbY29sdW1uYXNfY2F0ZWdvcmljYXNdLCBhcy5mYWN0b3IpDQpyZWdyZXNpb24gPC0gbG0oVG90YWxJbmN1cnJlZENvc3QgfiBJc0RlbmllZCArIEdlbmRlciArIENsYWltYW50VHlwZSArIEluanVyeU5hdHVyZSArIEJvZHlQYXJ0UmVnaW9uICsgQm9keVBhcnQgKyBUcmFuc2FjdGlvbl9UaW1lICsgUHJvY2VzaW5nX1RpbWUgKyBDbGFpbWFudEFnZV9hdF9ET0kgK0F2ZXJhZ2VXZWVrbHlXYWdlMSwgZGF0YT1iYXNlX2RlX2RhdG9zKQ0Kc3VtbWFyeShyZWdyZXNpb24pDQpgYGANCg0KIyA8c3BhbiBzdHlsZT0iY29sb3I6IGdyYXk7Ij5FdmFsdWFyLCB5IGVuIGNhc28gbmVjZXNhcmlvLCBhanVzdGFyIGxhIHJlZ3Jlc2lvbjwvc3Bhbj4NCmBgYHtyfQ0KcmVncmVzaW9uIDwtIGxtKFRvdGFsSW5jdXJyZWRDb3N0IH4gSXNEZW5pZWQgKyBDbGFpbWFudFR5cGUgKyBHZW5kZXIgKyBUcmFuc2FjdGlvbl9UaW1lICsgUHJvY2VzaW5nX1RpbWUgKyBDbGFpbWFudEFnZV9hdF9ET0kgKyBBdmVyYWdlV2Vla2x5V2FnZTEgKyBCb2R5UGFydFJlZ2lvbiArIEJvZHlQYXJ0LCBkYXRhPWJhc2VfZGVfZGF0b3MpDQpzdW1tYXJ5KHJlZ3Jlc2lvbikNCmBgYA0KDQojIDxzcGFuIHN0eWxlPSJjb2xvcjogZ3JheTsiPkNvbnN0cnVpciB1biBtb2RlbG8gZGUgcHJlZGljY2lvbg0KYGBge3J9DQpkYXRvc19udWV2b3MgPC0gZGF0YS5mcmFtZShJc0RlbmllZD0wLCBDbGFpbWFudFR5cGU9IkluZGVtbml0eSIsIEdlbmRlcj0iRmVtYWxlIiwgVHJhbnNhY3Rpb25fVGltZT0xMDAsIFByb2Nlc2luZ19UaW1lPTIwMCwgQ2xhaW1hbnRBZ2VfYXRfRE9JPTUwLCBBdmVyYWdlV2Vla2x5V2FnZTE9NDkwLCBCb2R5UGFydFJlZ2lvbj0iVHJ1bmsiLCBCb2R5UGFydD0iTG93ZXIgQmFjayBBcmVhIikNCnByZWRpY3QocmVncmVzaW9uLGRhdG9zX251ZXZvcykNCmBgYA0KDQojIDxzcGFuIHN0eWxlPSJjb2xvcjogZ3JheTsiPkNvbmNsdXNpw7NuPC9zcGFuPg0KRWwgbW9kZWxvIGRlIHJlZ3Jlc2nDs24gbGluZWFsIGV4cGxpY2EgZWwgMTglIGRlbCBjb21wb3J0YW1pZW50byBkZWwgY29zdG8gZGVsIHNlZ3Vyby4gRXN0ZSBtb2RlbG8gc2UgcHVlZGUgbWVqb3JhciBhZ3JlZ2FuZG8gb3RyYXMgdmFyaWFibGVzIHF1ZSBpbXBhY3Rlbi4NCg==