title: “Regresion Lineal” author: “Equipo 4- Mariana Magaña, Rogeiro Ramirez, David Cavazos, Lynette Solis, Rogelio Gomez” date: “2023-08-25” output: html_document: toc: TRUE toc_float: TRUE code_download: TRUE theme: “yeti” —

#Actividad 4.6

claims <- read.csv("/Users/davidcavazos/Desktop/ClaimsData2018.csv")

trans <- read.csv("/Users/davidcavazos/Desktop/TransactionsSummary2018.csv")
df <- merge(claims,trans,by = "ClaimID", all = TRUE)

Regresion Lineal

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

# View(df1)
summary(df1)
##     ClaimID           TotalPaid       TotalReserves     TotalRecovery      
##  Min.   :  633915   Min.   :   -270   Min.   :      0   Min.   :     0.00  
##  1st Qu.:  810246   1st Qu.:     60   1st Qu.:      0   1st Qu.:     0.00  
##  Median :  856915   Median :    235   Median :      0   Median :     0.00  
##  Mean   :12344572   Mean   :   6746   Mean   :   2233   Mean   :    68.88  
##  3rd Qu.:22716420   3rd Qu.:    938   3rd Qu.:      0   3rd Qu.:     0.00  
##  Max.   :62246496   Max.   :4527291   Max.   :2069575   Max.   :130541.03  
##                     NA's   :52673     NA's   :52673     NA's   :52673      
##  IndemnityPaid      OtherPaid       ClaimStatus        IncidentDate      
##  Min.   :  -475   Min.   :  -7820   Length:186677      Length:186677     
##  1st Qu.:     0   1st Qu.:     58   Class :character   Class :character  
##  Median :     0   Median :    230   Mode  :character   Mode  :character  
##  Mean   :  3061   Mean   :   3685                                        
##  3rd Qu.:     0   3rd Qu.:    855                                        
##  Max.   :640732   Max.   :4129915                                        
##  NA's   :52673    NA's   :52673                                          
##  IncidentDescription ReturnToWorkDate   AverageWeeklyWage  ClaimantOpenedDate
##  Length:186677       Length:186677      Length:186677      Length:186677     
##  Class :character    Class :character   Class :character   Class :character  
##  Mode  :character    Mode  :character   Mode  :character   Mode  :character  
##                                                                              
##                                                                              
##                                                                              
##                                                                              
##  ClaimantClosedDate EmployerNotificationDate ReceivedDate          IsDenied    
##  Length:186677      Length:186677            Length:186677      Min.   :0.00   
##  Class :character   Class :character         Class :character   1st Qu.:0.00   
##  Mode  :character   Mode  :character         Mode  :character   Median :0.00   
##                                                                 Mean   :0.04   
##                                                                 3rd Qu.:0.00   
##                                                                 Max.   :1.00   
##                                                                 NA's   :52673  
##  ClaimantAge_at_DOI    Gender          ClaimantType       InjuryNature      
##  Length:186677      Length:186677      Length:186677      Length:186677     
##  Class :character   Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
##                                                                             
##                                                                             
##                                                                             
##                                                                             
##  BodyPartRegion       BodyPart            X             X.1         
##  Length:186677      Length:186677      Mode:logical   Mode:logical  
##  Class :character   Class :character   NA's:186677    NA's:186677   
##  Mode  :character   Mode  :character                                
##                                                                     
##                                                                     
##                                                                     
##                                                                     
##    X.2            X.3            X.4            X.5            X.6         
##  Mode:logical   Mode:logical   Mode:logical   Mode:logical   Mode:logical  
##  NA's:186677    NA's:186677    NA's:186677    NA's:186677    NA's:186677   
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##    X.7            X.8            X.9            X.10           X.11        
##  Mode:logical   Mode:logical   Mode:logical   Mode:logical   Mode:logical  
##  NA's:186677    NA's:186677    NA's:186677    NA's:186677    NA's:186677   
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##    X.12           X.13           X.14           X.15           X.16        
##  Mode:logical   Mode:logical   Mode:logical   Mode:logical   Mode:logical  
##  NA's:186677    NA's:186677    NA's:186677    NA's:186677    NA's:186677   
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##    X.17           X.18           X.19           X.20           X.21        
##  Mode:logical   Mode:logical   Mode:logical   Mode:logical   Mode:logical  
##  NA's:186677    NA's:186677    NA's:186677    NA's:186677    NA's:186677   
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##    X.22         BillReviewALE        Hospital         PhysicianOutpatient
##  Mode:logical   Min.   : -456.0   Min.   : -12570.4   Min.   :  -4655.7  
##  NA's:186677    1st Qu.:   16.0   1st Qu.:    193.9   1st Qu.:    107.6  
##                 Median :   32.0   Median :    559.1   Median :    221.6  
##                 Mean   :  191.2   Mean   :   4394.7   Mean   :   1752.3  
##                 3rd Qu.:   80.0   3rd Qu.:   2253.4   3rd Qu.:    710.5  
##                 Max.   :56475.3   Max.   :2759604.0   Max.   :1481468.5  
##                 NA's   :139865    NA's   :145262      NA's   :84986      
##        Rx          
##  Min.   :  -469.5  
##  1st Qu.:    23.3  
##  Median :    58.3  
##  Mean   :  1140.4  
##  3rd Qu.:   174.5  
##  Max.   :631635.5  
##  NA's   :145752

Cambio de formato

df1$OtherPaid <- as.numeric(df1$OtherPaid)

df1$TotalPaid <- as.numeric(df1$TotalPaid)

df1$AverageWeeklyWage <- as.numeric(df1$AverageWeeklyWage)
## Warning: NAs introduced by coercion

Creacion de “Total Incurred Cost”

df1$TIC <- df1$TotalReserves + df1$TotalPaid - df1$TotalRecovery

Regresion

regresion <- lm(TIC ~ Gender + AverageWeeklyWage + ClaimantType + InjuryNature + BodyPart, data = df1)

summary(regresion)
## 
## Call:
## lm(formula = TIC ~ Gender + AverageWeeklyWage + ClaimantType + 
##     InjuryNature + BodyPart, data = df1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -193460  -30725   -6662    5919 4909321 
## 
## Coefficients:
##                                                                           Estimate
## (Intercept)                                                              4.477e+03
## GenderMale                                                               2.427e+03
## GenderNot Available                                                      3.737e+04
## AverageWeeklyWage                                                        2.360e-02
## ClaimantTypeMedical Only                                                -4.052e+04
## ClaimantTypeReport Only                                                 -4.200e+04
## InjuryNatureAll Other Cumulative Injury, NOC                             1.422e+04
## InjuryNatureAll Other Occupational Disease Injury, NOC                   1.308e+05
## InjuryNatureAll Other Specific Injuries, Noc                             1.538e+04
## InjuryNatureAmputation                                                   1.956e+04
## InjuryNatureAngina Pectoris                                              1.667e+04
## InjuryNatureAsbestosis                                                   2.896e+04
## InjuryNatureAsphyxiation                                                 6.909e+04
## InjuryNatureBurn                                                         2.512e+04
## InjuryNatureCancer                                                       2.140e+04
## InjuryNatureCarpal Tunnel Syndrome                                       1.442e+04
## InjuryNatureConcussion                                                   5.174e+04
## InjuryNatureContagious Disease                                           2.993e+04
## InjuryNatureContusion                                                    2.425e+04
## InjuryNatureCrushing                                                     2.126e+04
## InjuryNatureDermatitis                                                   1.758e+04
## InjuryNatureDislocation                                                  1.523e+04
## InjuryNatureDust Disease, NOC                                            1.486e+04
## InjuryNatureElectric Shock                                               3.536e+04
## InjuryNatureForeign Body                                                 2.122e+04
## InjuryNatureFracture                                                     2.509e+04
## InjuryNatureFreezing                                                     8.147e+04
## InjuryNatureHearing Loss Or Impairment                                   2.498e+04
## InjuryNatureHeat Prostration                                             6.914e+03
## InjuryNatureHernia                                                       1.221e+04
## InjuryNatureInfection                                                    1.712e+04
## InjuryNatureInflammation                                                 2.909e+04
## InjuryNatureLaceration                                                   2.463e+04
## InjuryNatureLoss of Hearing                                              1.856e+04
## InjuryNatureMental Disorder                                              1.012e+04
## InjuryNatureMental Stress                                                1.447e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  1.223e+05
## InjuryNatureMultiple Physical Injuries Only                              3.299e+04
## InjuryNatureMyocardial Infarction                                        7.040e+03
## InjuryNatureNo Physical Injury                                           1.332e+04
## InjuryNatureNon-Standard Code                                            1.227e+04
## InjuryNatureNot Available                                                1.710e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       2.698e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              1.860e+04
## InjuryNaturePuncture                                                     2.493e+04
## InjuryNatureRadiation                                                    1.667e+04
## InjuryNatureRespiratory Disorders                                        2.600e+04
## InjuryNatureRupture                                                      4.913e+04
## InjuryNatureSeverance                                                    4.378e+04
## InjuryNatureSilicosis                                                    2.649e+04
## InjuryNatureSprain                                                       2.056e+04
## InjuryNatureStrain                                                       1.876e+04
## InjuryNatureSyncope                                                      7.501e+03
## InjuryNatureVascular                                                     4.578e+03
## InjuryNatureVDT-Related Disease                                          1.016e+04
## InjuryNatureVision Loss                                                  1.178e+04
## BodyPartAnkle                                                            7.639e+03
## BodyPartArtificial Appliance                                            -4.637e+03
## BodyPartBody Systems and Multiple Body Systems                           8.627e+03
## BodyPartBrain                                                            8.487e+04
## BodyPartButtocks                                                         1.535e+04
## BodyPartChest                                                            6.938e+03
## BodyPartDisc-Trunk                                                       2.165e+04
## BodyPartEar(S)                                                           3.061e+03
## BodyPartElbow                                                            7.798e+03
## BodyPartEyes                                                             1.072e+04
## BodyPartFacial Bones                                                     9.971e+03
## BodyPartFinger(S)                                                        1.487e+03
## BodyPartFoot                                                             4.460e+03
## BodyPartGreat Toe                                                        1.445e+03
## BodyPartHand                                                             3.938e+03
## BodyPartHeart                                                           -5.005e+03
## BodyPartHip                                                              1.776e+04
## BodyPartInsufficient Info to Properly Identify?Unclassified              1.240e+04
## BodyPartInternal Organs                                                  1.039e+04
## BodyPartKnee                                                             1.547e+04
## BodyPartLarynx                                                          -5.540e+03
## BodyPartLower Arm                                                        7.272e+03
## BodyPartLower Back Area                                                  3.480e+04
## BodyPartLower Leg                                                        1.269e+04
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              2.876e+04
## BodyPartLungs                                                           -6.949e+02
## BodyPartMouth                                                            1.833e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      1.868e+04
## BodyPartMultiple Head Injury                                             9.975e+03
## BodyPartMultiple Lower Extremities                                       1.293e+04
## BodyPartMultiple Neck Injury                                             1.708e+04
## BodyPartMultiple Trunk                                                   1.369e+04
## BodyPartMultiple Upper Extremities                                       1.044e+04
## BodyPartNo Physical Injury                                               1.673e+04
## BodyPartNon-Standard Code                                                1.364e+04
## BodyPartNose                                                             2.200e+03
## BodyPartNot Available                                                    2.281e+04
## BodyPartPelvis                                                          -2.351e+02
## BodyPartSacrum And Coccyx                                                2.664e+04
## BodyPartShoulder(S)                                                      2.444e+04
## BodyPartSkull                                                            1.576e+04
## BodyPartSoft Tissue-Head                                                 1.114e+04
## BodyPartSoft Tissue-Neck                                                 2.191e+04
## BodyPartSpinal Cord-Trunk                                                1.415e+05
## BodyPartTeeth                                                           -7.676e+03
## BodyPartThumb                                                            1.327e+03
## BodyPartToes                                                             1.666e+03
## BodyPartTrachea                                                         -3.432e+02
## BodyPartUpper Arm                                                        1.170e+04
## BodyPartUpper Back Area                                                  2.040e+04
## BodyPartUpper Leg                                                        1.490e+04
## BodyPartVertebrae                                                        3.253e+04
## BodyPartWhole Body                                                       7.809e+04
## BodyPartWrist                                                            9.015e+03
##                                                                         Std. Error
## (Intercept)                                                              3.852e+04
## GenderMale                                                               8.659e+02
## GenderNot Available                                                      5.618e+03
## AverageWeeklyWage                                                        3.804e-02
## ClaimantTypeMedical Only                                                 9.068e+02
## ClaimantTypeReport Only                                                  2.898e+03
## InjuryNatureAll Other Cumulative Injury, NOC                             4.172e+04
## InjuryNatureAll Other Occupational Disease Injury, NOC                   5.071e+04
## InjuryNatureAll Other Specific Injuries, Noc                             3.830e+04
## InjuryNatureAmputation                                                   4.072e+04
## InjuryNatureAngina Pectoris                                              4.447e+04
## InjuryNatureAsbestosis                                                   4.119e+04
## InjuryNatureAsphyxiation                                                 5.680e+04
## InjuryNatureBurn                                                         3.852e+04
## InjuryNatureCancer                                                       5.067e+04
## InjuryNatureCarpal Tunnel Syndrome                                       3.850e+04
## InjuryNatureConcussion                                                   3.877e+04
## InjuryNatureContagious Disease                                           3.912e+04
## InjuryNatureContusion                                                    3.829e+04
## InjuryNatureCrushing                                                     3.866e+04
## InjuryNatureDermatitis                                                   3.846e+04
## InjuryNatureDislocation                                                  3.865e+04
## InjuryNatureDust Disease, NOC                                            4.578e+04
## InjuryNatureElectric Shock                                               4.012e+04
## InjuryNatureForeign Body                                                 3.852e+04
## InjuryNatureFracture                                                     3.833e+04
## InjuryNatureFreezing                                                     6.052e+04
## InjuryNatureHearing Loss Or Impairment                                   4.372e+04
## InjuryNatureHeat Prostration                                             3.950e+04
## InjuryNatureHernia                                                       3.912e+04
## InjuryNatureInfection                                                    3.889e+04
## InjuryNatureInflammation                                                 3.844e+04
## InjuryNatureLaceration                                                   3.833e+04
## InjuryNatureLoss of Hearing                                              4.294e+04
## InjuryNatureMental Disorder                                              4.694e+04
## InjuryNatureMental Stress                                                3.893e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological  4.035e+04
## InjuryNatureMultiple Physical Injuries Only                              3.835e+04
## InjuryNatureMyocardial Infarction                                        4.481e+04
## InjuryNatureNo Physical Injury                                           3.851e+04
## InjuryNatureNon-Standard Code                                            3.880e+04
## InjuryNatureNot Available                                                3.904e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals)                       3.932e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)              4.365e+04
## InjuryNaturePuncture                                                     3.838e+04
## InjuryNatureRadiation                                                    4.688e+04
## InjuryNatureRespiratory Disorders                                        3.868e+04
## InjuryNatureRupture                                                      3.913e+04
## InjuryNatureSeverance                                                    4.172e+04
## InjuryNatureSilicosis                                                    5.679e+04
## InjuryNatureSprain                                                       3.831e+04
## InjuryNatureStrain                                                       3.829e+04
## InjuryNatureSyncope                                                      3.960e+04
## InjuryNatureVascular                                                     5.065e+04
## InjuryNatureVDT-Related Disease                                          6.629e+04
## InjuryNatureVision Loss                                                  4.327e+04
## BodyPartAnkle                                                            4.792e+03
## BodyPartArtificial Appliance                                             6.642e+04
## BodyPartBody Systems and Multiple Body Systems                           8.318e+03
## BodyPartBrain                                                            1.652e+04
## BodyPartButtocks                                                         8.038e+03
## BodyPartChest                                                            5.403e+03
## BodyPartDisc-Trunk                                                       6.322e+03
## BodyPartEar(S)                                                           9.115e+03
## BodyPartElbow                                                            5.401e+03
## BodyPartEyes                                                             5.381e+03
## BodyPartFacial Bones                                                     6.877e+03
## BodyPartFinger(S)                                                        4.742e+03
## BodyPartFoot                                                             4.970e+03
## BodyPartGreat Toe                                                        1.148e+04
## BodyPartHand                                                             4.708e+03
## BodyPartHeart                                                            2.031e+04
## BodyPartHip                                                              5.621e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified              7.184e+03
## BodyPartInternal Organs                                                  9.085e+03
## BodyPartKnee                                                             4.496e+03
## BodyPartLarynx                                                           2.743e+04
## BodyPartLower Arm                                                        5.253e+03
## BodyPartLower Back Area                                                  4.479e+03
## BodyPartLower Leg                                                        5.205e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)              5.790e+03
## BodyPartLungs                                                            8.509e+03
## BodyPartMouth                                                            7.857e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)      4.504e+03
## BodyPartMultiple Head Injury                                             5.264e+03
## BodyPartMultiple Lower Extremities                                       6.068e+03
## BodyPartMultiple Neck Injury                                             5.312e+03
## BodyPartMultiple Trunk                                                   1.005e+04
## BodyPartMultiple Upper Extremities                                       5.642e+03
## BodyPartNo Physical Injury                                               7.126e+03
## BodyPartNon-Standard Code                                                7.760e+03
## BodyPartNose                                                             7.872e+03
## BodyPartNot Available                                                    9.406e+04
## BodyPartPelvis                                                           1.107e+04
## BodyPartSacrum And Coccyx                                                1.601e+04
## BodyPartShoulder(S)                                                      4.659e+03
## BodyPartSkull                                                            7.871e+03
## BodyPartSoft Tissue-Head                                                 6.534e+03
## BodyPartSoft Tissue-Neck                                                 5.052e+03
## BodyPartSpinal Cord-Trunk                                                1.370e+04
## BodyPartTeeth                                                            9.332e+03
## BodyPartThumb                                                            5.487e+03
## BodyPartToes                                                             7.385e+03
## BodyPartTrachea                                                          3.861e+04
## BodyPartUpper Arm                                                        5.321e+03
## BodyPartUpper Back Area                                                  6.276e+03
## BodyPartUpper Leg                                                        6.671e+03
## BodyPartVertebrae                                                        2.459e+04
## BodyPartWhole Body                                                       1.331e+04
## BodyPartWrist                                                            4.826e+03
##                                                                         t value
## (Intercept)                                                               0.116
## GenderMale                                                                2.803
## GenderNot Available                                                       6.652
## AverageWeeklyWage                                                         0.620
## ClaimantTypeMedical Only                                                -44.685
## ClaimantTypeReport Only                                                 -14.493
## InjuryNatureAll Other Cumulative Injury, NOC                              0.341
## InjuryNatureAll Other Occupational Disease Injury, NOC                    2.579
## InjuryNatureAll Other Specific Injuries, Noc                              0.401
## InjuryNatureAmputation                                                    0.480
## InjuryNatureAngina Pectoris                                               0.375
## InjuryNatureAsbestosis                                                    0.703
## InjuryNatureAsphyxiation                                                  1.216
## InjuryNatureBurn                                                          0.652
## InjuryNatureCancer                                                        0.422
## InjuryNatureCarpal Tunnel Syndrome                                        0.374
## InjuryNatureConcussion                                                    1.334
## InjuryNatureContagious Disease                                            0.765
## InjuryNatureContusion                                                     0.633
## InjuryNatureCrushing                                                      0.550
## InjuryNatureDermatitis                                                    0.457
## InjuryNatureDislocation                                                   0.394
## InjuryNatureDust Disease, NOC                                             0.325
## InjuryNatureElectric Shock                                                0.881
## InjuryNatureForeign Body                                                  0.551
## InjuryNatureFracture                                                      0.655
## InjuryNatureFreezing                                                      1.346
## InjuryNatureHearing Loss Or Impairment                                    0.571
## InjuryNatureHeat Prostration                                              0.175
## InjuryNatureHernia                                                        0.312
## InjuryNatureInfection                                                     0.440
## InjuryNatureInflammation                                                  0.757
## InjuryNatureLaceration                                                    0.643
## InjuryNatureLoss of Hearing                                               0.432
## InjuryNatureMental Disorder                                               0.216
## InjuryNatureMental Stress                                                 0.372
## InjuryNatureMultiple Injuries Including Both Physical and Psychological   3.032
## InjuryNatureMultiple Physical Injuries Only                               0.860
## InjuryNatureMyocardial Infarction                                         0.157
## InjuryNatureNo Physical Injury                                            0.346
## InjuryNatureNon-Standard Code                                             0.316
## InjuryNatureNot Available                                                 0.438
## InjuryNaturePoisoning?Chemical (Other Than Metals)                        0.686
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)               0.426
## InjuryNaturePuncture                                                      0.650
## InjuryNatureRadiation                                                     0.356
## InjuryNatureRespiratory Disorders                                         0.672
## InjuryNatureRupture                                                       1.256
## InjuryNatureSeverance                                                     1.049
## InjuryNatureSilicosis                                                     0.466
## InjuryNatureSprain                                                        0.537
## InjuryNatureStrain                                                        0.490
## InjuryNatureSyncope                                                       0.189
## InjuryNatureVascular                                                      0.090
## InjuryNatureVDT-Related Disease                                           0.153
## InjuryNatureVision Loss                                                   0.272
## BodyPartAnkle                                                             1.594
## BodyPartArtificial Appliance                                             -0.070
## BodyPartBody Systems and Multiple Body Systems                            1.037
## BodyPartBrain                                                             5.138
## BodyPartButtocks                                                          1.910
## BodyPartChest                                                             1.284
## BodyPartDisc-Trunk                                                        3.424
## BodyPartEar(S)                                                            0.336
## BodyPartElbow                                                             1.444
## BodyPartEyes                                                              1.993
## BodyPartFacial Bones                                                      1.450
## BodyPartFinger(S)                                                         0.314
## BodyPartFoot                                                              0.898
## BodyPartGreat Toe                                                         0.126
## BodyPartHand                                                              0.836
## BodyPartHeart                                                            -0.246
## BodyPartHip                                                               3.160
## BodyPartInsufficient Info to Properly Identify?Unclassified               1.726
## BodyPartInternal Organs                                                   1.144
## BodyPartKnee                                                              3.440
## BodyPartLarynx                                                           -0.202
## BodyPartLower Arm                                                         1.384
## BodyPartLower Back Area                                                   7.771
## BodyPartLower Leg                                                         2.437
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)               4.967
## BodyPartLungs                                                            -0.082
## BodyPartMouth                                                             0.233
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)       4.147
## BodyPartMultiple Head Injury                                              1.895
## BodyPartMultiple Lower Extremities                                        2.131
## BodyPartMultiple Neck Injury                                              3.215
## BodyPartMultiple Trunk                                                    1.362
## BodyPartMultiple Upper Extremities                                        1.850
## BodyPartNo Physical Injury                                                2.347
## BodyPartNon-Standard Code                                                 1.757
## BodyPartNose                                                              0.279
## BodyPartNot Available                                                     0.243
## BodyPartPelvis                                                           -0.021
## BodyPartSacrum And Coccyx                                                 1.664
## BodyPartShoulder(S)                                                       5.246
## BodyPartSkull                                                             2.002
## BodyPartSoft Tissue-Head                                                  1.705
## BodyPartSoft Tissue-Neck                                                  4.337
## BodyPartSpinal Cord-Trunk                                                10.328
## BodyPartTeeth                                                            -0.823
## BodyPartThumb                                                             0.242
## BodyPartToes                                                              0.226
## BodyPartTrachea                                                          -0.009
## BodyPartUpper Arm                                                         2.199
## BodyPartUpper Back Area                                                   3.251
## BodyPartUpper Leg                                                         2.233
## BodyPartVertebrae                                                         1.323
## BodyPartWhole Body                                                        5.867
## BodyPartWrist                                                             1.868
##                                                                         Pr(>|t|)
## (Intercept)                                                             0.907479
## GenderMale                                                              0.005058
## GenderNot Available                                                     2.92e-11
## AverageWeeklyWage                                                       0.535002
## ClaimantTypeMedical Only                                                 < 2e-16
## ClaimantTypeReport Only                                                  < 2e-16
## InjuryNatureAll Other Cumulative Injury, NOC                            0.733237
## InjuryNatureAll Other Occupational Disease Injury, NOC                  0.009919
## InjuryNatureAll Other Specific Injuries, Noc                            0.688105
## InjuryNatureAmputation                                                  0.630913
## InjuryNatureAngina Pectoris                                             0.707836
## InjuryNatureAsbestosis                                                  0.481955
## InjuryNatureAsphyxiation                                                0.223845
## InjuryNatureBurn                                                        0.514361
## InjuryNatureCancer                                                      0.672812
## InjuryNatureCarpal Tunnel Syndrome                                      0.708064
## InjuryNatureConcussion                                                  0.182072
## InjuryNatureContagious Disease                                          0.444107
## InjuryNatureContusion                                                   0.526495
## InjuryNatureCrushing                                                    0.582350
## InjuryNatureDermatitis                                                  0.647486
## InjuryNatureDislocation                                                 0.693638
## InjuryNatureDust Disease, NOC                                           0.745401
## InjuryNatureElectric Shock                                              0.378162
## InjuryNatureForeign Body                                                0.581727
## InjuryNatureFracture                                                    0.512763
## InjuryNatureFreezing                                                    0.178266
## InjuryNatureHearing Loss Or Impairment                                  0.567852
## InjuryNatureHeat Prostration                                            0.861050
## InjuryNatureHernia                                                      0.754923
## InjuryNatureInfection                                                   0.659789
## InjuryNatureInflammation                                                0.449218
## InjuryNatureLaceration                                                  0.520399
## InjuryNatureLoss of Hearing                                             0.665578
## InjuryNatureMental Disorder                                             0.829241
## InjuryNatureMental Stress                                               0.710191
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.002433
## InjuryNatureMultiple Physical Injuries Only                             0.389673
## InjuryNatureMyocardial Infarction                                       0.875166
## InjuryNatureNo Physical Injury                                          0.729365
## InjuryNatureNon-Standard Code                                           0.751846
## InjuryNatureNot Available                                               0.661341
## InjuryNaturePoisoning?Chemical (Other Than Metals)                      0.492500
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury)             0.670002
## InjuryNaturePuncture                                                    0.515915
## InjuryNatureRadiation                                                   0.722115
## InjuryNatureRespiratory Disorders                                       0.501495
## InjuryNatureRupture                                                     0.209260
## InjuryNatureSeverance                                                   0.293968
## InjuryNatureSilicosis                                                   0.640876
## InjuryNatureSprain                                                      0.591411
## InjuryNatureStrain                                                      0.624190
## InjuryNatureSyncope                                                     0.849745
## InjuryNatureVascular                                                    0.927981
## InjuryNatureVDT-Related Disease                                         0.878158
## InjuryNatureVision Loss                                                 0.785471
## BodyPartAnkle                                                           0.110889
## BodyPartArtificial Appliance                                            0.944349
## BodyPartBody Systems and Multiple Body Systems                          0.299668
## BodyPartBrain                                                           2.78e-07
## BodyPartButtocks                                                        0.056109
## BodyPartChest                                                           0.199114
## BodyPartDisc-Trunk                                                      0.000617
## BodyPartEar(S)                                                          0.737024
## BodyPartElbow                                                           0.148760
## BodyPartEyes                                                            0.046268
## BodyPartFacial Bones                                                    0.147126
## BodyPartFinger(S)                                                       0.753841
## BodyPartFoot                                                            0.369453
## BodyPartGreat Toe                                                       0.899821
## BodyPartHand                                                            0.402920
## BodyPartHeart                                                           0.805327
## BodyPartHip                                                             0.001580
## BodyPartInsufficient Info to Properly Identify?Unclassified             0.084415
## BodyPartInternal Organs                                                 0.252655
## BodyPartKnee                                                            0.000581
## BodyPartLarynx                                                          0.839946
## BodyPartLower Arm                                                       0.166258
## BodyPartLower Back Area                                                 7.95e-15
## BodyPartLower Leg                                                       0.014804
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk)             6.81e-07
## BodyPartLungs                                                           0.934909
## BodyPartMouth                                                           0.815554
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts)     3.38e-05
## BodyPartMultiple Head Injury                                            0.058117
## BodyPartMultiple Lower Extremities                                      0.033116
## BodyPartMultiple Neck Injury                                            0.001304
## BodyPartMultiple Trunk                                                  0.173321
## BodyPartMultiple Upper Extremities                                      0.064318
## BodyPartNo Physical Injury                                              0.018912
## BodyPartNon-Standard Code                                               0.078874
## BodyPartNose                                                            0.779945
## BodyPartNot Available                                                   0.808393
## BodyPartPelvis                                                          0.983055
## BodyPartSacrum And Coccyx                                               0.096046
## BodyPartShoulder(S)                                                     1.56e-07
## BodyPartSkull                                                           0.045257
## BodyPartSoft Tissue-Head                                                0.088198
## BodyPartSoft Tissue-Neck                                                1.45e-05
## BodyPartSpinal Cord-Trunk                                                < 2e-16
## BodyPartTeeth                                                           0.410762
## BodyPartThumb                                                           0.808864
## BodyPartToes                                                            0.821559
## BodyPartTrachea                                                         0.992907
## BodyPartUpper Arm                                                       0.027868
## BodyPartUpper Back Area                                                 0.001152
## BodyPartUpper Leg                                                       0.025522
## BodyPartVertebrae                                                       0.185826
## BodyPartWhole Body                                                      4.48e-09
## BodyPartWrist                                                           0.061735
##                                                                            
## (Intercept)                                                                
## GenderMale                                                              ** 
## GenderNot Available                                                     ***
## AverageWeeklyWage                                                          
## ClaimantTypeMedical Only                                                ***
## ClaimantTypeReport Only                                                 ***
## InjuryNatureAll Other Cumulative Injury, NOC                               
## InjuryNatureAll Other Occupational Disease Injury, NOC                  ** 
## InjuryNatureAll Other Specific Injuries, Noc                               
## InjuryNatureAmputation                                                     
## InjuryNatureAngina Pectoris                                                
## InjuryNatureAsbestosis                                                     
## InjuryNatureAsphyxiation                                                   
## 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                                                      
## InjuryNatureSilicosis                                                      
## 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                                                               
## BodyPartNot Available                                                      
## 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: 93720 on 48970 degrees of freedom
##   (137597 observations deleted due to missingness)
## Multiple R-squared:  0.06575,    Adjusted R-squared:  0.06367 
## F-statistic: 31.62 on 109 and 48970 DF,  p-value: < 2.2e-16
datos <- data.frame(Gender = "Male", AverageWeeklyWage = 3333 ,  ClaimantType = "Medical Only" , InjuryNature = "Strain" , BodyPart = "Lower Back Area")

predict(regresion,datos)
##        1 
## 20027.24
datos <- data.frame(Gender = "Male", AverageWeeklyWage = 3333 ,  ClaimantType = "Medical Only" , InjuryNature = "Contusion" , BodyPart = "Skull")

predict(regresion,datos)
##        1 
## 6475.381
LS0tCgp0aXRsZTogIlJlZ3Jlc2lvbiBMaW5lYWwiCmF1dGhvcjogIkVxdWlwbyA0LSBNYXJpYW5hIE1hZ2HDsWEsIFJvZ2Vpcm8gUmFtaXJleiwgRGF2aWQgQ2F2YXpvcywgTHluZXR0ZSBTb2xpcywgUm9nZWxpbyBHb21leiAiCmRhdGU6ICIyMDIzLTA4LTI1IgpvdXRwdXQ6IAogaHRtbF9kb2N1bWVudDoKICAgIHRvYzogVFJVRQogICAgdG9jX2Zsb2F0OiBUUlVFCiAgICBjb2RlX2Rvd25sb2FkOiBUUlVFCiAgICB0aGVtZTogInlldGkiCi0tLQoKCgojQWN0aXZpZGFkIDQuNgoKYGBge3J9CmNsYWltcyA8LSByZWFkLmNzdigiL1VzZXJzL2RhdmlkY2F2YXpvcy9EZXNrdG9wL0NsYWltc0RhdGEyMDE4LmNzdiIpCgp0cmFucyA8LSByZWFkLmNzdigiL1VzZXJzL2RhdmlkY2F2YXpvcy9EZXNrdG9wL1RyYW5zYWN0aW9uc1N1bW1hcnkyMDE4LmNzdiIpCmBgYAoKYGBge3J9CmRmIDwtIG1lcmdlKGNsYWltcyx0cmFucyxieSA9ICJDbGFpbUlEIiwgYWxsID0gVFJVRSkKYGBgCgojIyBSZWdyZXNpb24gTGluZWFsIAoKYGBge3J9CmxpYnJhcnkoZHBseXIpCmBgYAoKYGBge3J9CmRmMSA8LSBkZgoKIyBWaWV3KGRmMSkKYGBgCgpgYGB7cn0Kc3VtbWFyeShkZjEpCmBgYAoKIyMjIENhbWJpbyBkZSBmb3JtYXRvIAoKYGBge3J9CgpkZjEkT3RoZXJQYWlkIDwtIGFzLm51bWVyaWMoZGYxJE90aGVyUGFpZCkKCmRmMSRUb3RhbFBhaWQgPC0gYXMubnVtZXJpYyhkZjEkVG90YWxQYWlkKQoKZGYxJEF2ZXJhZ2VXZWVrbHlXYWdlIDwtIGFzLm51bWVyaWMoZGYxJEF2ZXJhZ2VXZWVrbHlXYWdlKQoKYGBgCgojIyMgQ3JlYWNpb24gZGUgIlRvdGFsIEluY3VycmVkIENvc3QiCgpgYGB7cn0KZGYxJFRJQyA8LSBkZjEkVG90YWxSZXNlcnZlcyArIGRmMSRUb3RhbFBhaWQgLSBkZjEkVG90YWxSZWNvdmVyeQpgYGAKCiMjIyBSZWdyZXNpb24gCgpgYGB7cn0KcmVncmVzaW9uIDwtIGxtKFRJQyB+IEdlbmRlciArIEF2ZXJhZ2VXZWVrbHlXYWdlICsgQ2xhaW1hbnRUeXBlICsgSW5qdXJ5TmF0dXJlICsgQm9keVBhcnQsIGRhdGEgPSBkZjEpCgpzdW1tYXJ5KHJlZ3Jlc2lvbikKCmBgYAoKCmBgYHtyfQpkYXRvcyA8LSBkYXRhLmZyYW1lKEdlbmRlciA9ICJNYWxlIiwgQXZlcmFnZVdlZWtseVdhZ2UgPSAzMzMzICwgIENsYWltYW50VHlwZSA9ICJNZWRpY2FsIE9ubHkiICwgSW5qdXJ5TmF0dXJlID0gIlN0cmFpbiIgLCBCb2R5UGFydCA9ICJMb3dlciBCYWNrIEFyZWEiKQoKcHJlZGljdChyZWdyZXNpb24sZGF0b3MpCmBgYApgYGB7cn0KZGF0b3MgPC0gZGF0YS5mcmFtZShHZW5kZXIgPSAiTWFsZSIsIEF2ZXJhZ2VXZWVrbHlXYWdlID0gMzMzMyAsICBDbGFpbWFudFR5cGUgPSAiTWVkaWNhbCBPbmx5IiAsIEluanVyeU5hdHVyZSA9ICJDb250dXNpb24iICwgQm9keVBhcnQgPSAiU2t1bGwiKQoKcHJlZGljdChyZWdyZXNpb24sZGF0b3MpCmBgYAoK