## Warning: package 'readxl' was built under R version 4.1.3
## Warning: package 'dplyr' was built under R version 4.1.3
claims_data$TotalReserves <- as.numeric(claims_data$TotalReserves)
claims_data$IndemnityPaid <- as.numeric(claims_data$IndemnityPaid)
claims_data$OtherPaid <- as.numeric(claims_data$OtherPaid)
claims_data$TotalRecovery <- as.numeric(claims_data$TotalRecovery)
claims_data$ClaimantOpenedDate <- as.Date(claims_data$ClaimantOpenedDate, format = "%Y/%m/%d")
claims_data$ClaimantClosedDate <- as.Date(claims_data$ClaimantClosedDate, format = "%Y/%m/%d")
claims_data$ClaimantAge_at_DOI <- as.numeric(claims_data$ClaimantAge_at_DOI)## Warning: NAs introducidos por coerción
## Warning: NAs introducidos por coerción
##Analysis
Create Total Incurred Cost per claim
df2 <- df
#summary(df2)
df2$TotalIncurredCost <- with(df2, TotalReserves + IndemnityPaid + OtherPaid - TotalRecovery)Obtain the difference between closed and open dates to obtain the Claim Duration
df2$ClaimDuration <- as.numeric(difftime(df2$ClaimantClosedDate, df2$ClaimantOpenedDate, units = c("days")))
#df2$ClaimDuration <- seq(from = df2$ClaimantOpenedDate, to = df2$ClaimantClosedDate, by = "day")
#summary(df2$ClaimDuration)df2.lm <- lm(TotalIncurredCost ~ ClaimStatus + ClaimantAge_at_DOI + Gender + AverageWeeklyWage + BodyPartRegion + BodyPart + InjuryNature, data = df2)
summary(df2.lm)##
## Call:
## lm(formula = TotalIncurredCost ~ ClaimStatus + ClaimantAge_at_DOI +
## Gender + AverageWeeklyWage + BodyPartRegion + BodyPart +
## InjuryNature, data = df2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -289205 -16987 -3489 5766 4757653
##
## Coefficients: (7 not defined because of singularities)
## Estimate
## (Intercept) -1.766e+04
## ClaimStatusO 1.650e+05
## ClaimStatusR 1.754e+05
## ClaimantAge_at_DOI 4.046e+00
## GenderMale 2.605e+03
## GenderNot Available 2.422e+04
## AverageWeeklyWage 2.618e-03
## BodyPartRegionLower Extremities 1.458e+04
## BodyPartRegionMultiple Body Parts 5.952e+04
## BodyPartRegionNeck 4.562e+04
## BodyPartRegionNon-Standard Code 6.831e+03
## BodyPartRegionNot Available 2.438e+04
## BodyPartRegionTrunk 6.148e+03
## BodyPartRegionUpper Extremities 1.420e+04
## BodyPartAnkle -1.337e+03
## BodyPartArtificial Appliance -4.247e+04
## BodyPartBody Systems and Multiple Body Systems -4.695e+04
## BodyPartBrain 7.347e+04
## BodyPartButtocks -2.985e+02
## BodyPartChest -3.626e+02
## BodyPartDisc-Trunk 3.403e+04
## BodyPartEar(S) 1.445e+03
## BodyPartElbow -4.576e+03
## BodyPartEyes 5.443e+03
## BodyPartFacial Bones 1.300e+04
## BodyPartFinger(S) -1.013e+04
## BodyPartFoot -6.831e+03
## BodyPartGreat Toe -1.018e+04
## BodyPartHand -9.000e+03
## BodyPartHeart 4.469e+03
## BodyPartHip 4.306e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified -4.100e+04
## BodyPartInternal Organs 1.903e+04
## BodyPartKnee 4.109e+03
## BodyPartLarynx -3.683e+04
## BodyPartLower Arm -7.120e+03
## BodyPartLower Back Area 3.467e+04
## BodyPartLower Leg 8.986e+02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 3.072e+04
## BodyPartLungs -1.036e+03
## BodyPartMouth 9.086e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -2.590e+04
## BodyPartMultiple Head Injury 2.008e+04
## BodyPartMultiple Lower Extremities 1.203e+04
## BodyPartMultiple Neck Injury -1.754e+04
## BodyPartMultiple Trunk 1.723e+04
## BodyPartMultiple Upper Extremities 9.815e+03
## BodyPartNo Physical Injury -4.008e+04
## BodyPartNon-Standard Code NA
## BodyPartNose -1.718e+03
## BodyPartNot Available NA
## BodyPartPelvis 3.667e+03
## BodyPartSacrum And Coccyx 2.023e+04
## BodyPartShoulder(S) 7.246e+03
## BodyPartSkull 4.599e+03
## BodyPartSoft Tissue-Head -2.094e+04
## BodyPartSoft Tissue-Neck -5.241e+04
## BodyPartSpinal Cord-Trunk 1.404e+05
## BodyPartTeeth NA
## BodyPartThumb -7.328e+03
## BodyPartToes -9.862e+03
## BodyPartTrachea -3.939e+04
## BodyPartUpper Arm 5.325e+03
## BodyPartUpper Back Area 2.012e+04
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC -1.911e+04
## InjuryNatureAll Other Occupational Disease Injury, NOC 1.069e+05
## InjuryNatureAll Other Specific Injuries, Noc 1.434e+04
## InjuryNatureAmputation 2.370e+04
## InjuryNatureAngina Pectoris 9.385e+03
## InjuryNatureAsbestosis 1.830e+04
## InjuryNatureAsphyxiation 3.520e+04
## InjuryNatureBurn 1.256e+04
## InjuryNatureCancer 2.455e+04
## InjuryNatureCarpal Tunnel Syndrome 1.035e+04
## InjuryNatureConcussion 3.092e+04
## InjuryNatureContagious Disease 1.683e+04
## InjuryNatureContusion 1.007e+04
## InjuryNatureCrushing 6.976e+03
## InjuryNatureDermatitis -3.936e+03
## InjuryNatureDislocation 4.992e+03
## InjuryNatureDust Disease, NOC -1.884e+03
## InjuryNatureElectric Shock 4.657e+03
## InjuryNatureForeign Body 6.205e+03
## InjuryNatureFracture 1.778e+04
## InjuryNatureFreezing -1.010e+04
## InjuryNatureHearing Loss Or Impairment 1.282e+04
## InjuryNatureHeat Prostration -7.442e+03
## InjuryNatureHernia 1.008e+04
## InjuryNatureInfection -4.112e+03
## InjuryNatureInflammation 9.181e+03
## InjuryNatureLaceration 7.542e+03
## InjuryNatureLoss of Hearing 1.831e+04
## InjuryNatureMental Disorder 9.832e+03
## InjuryNatureMental Stress 2.095e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 1.056e+05
## InjuryNatureMultiple Physical Injuries Only 3.242e+03
## InjuryNatureMyocardial Infarction 8.407e+03
## InjuryNatureNo Physical Injury 4.773e+02
## InjuryNatureNon-Standard Code -9.568e+03
## InjuryNatureNot Available 3.816e+03
## InjuryNaturePoisoning?Chemical (Other Than Metals) 2.088e+02
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) -1.108e+04
## InjuryNaturePuncture 8.092e+03
## InjuryNatureRadiation 3.064e+04
## InjuryNatureRespiratory Disorders 1.329e+04
## InjuryNatureRupture 1.216e+04
## InjuryNatureSeverance 5.789e+04
## InjuryNatureSilicosis -7.988e+02
## InjuryNatureSprain 4.469e+02
## InjuryNatureStrain 3.497e+03
## InjuryNatureSyncope 4.440e+03
## InjuryNatureVascular 5.007e+03
## InjuryNatureVDT-Related Disease 6.596e+03
## InjuryNatureVision Loss 1.075e+04
## Std. Error
## (Intercept) 5.532e+04
## ClaimStatusO 1.874e+03
## ClaimStatusR 3.334e+03
## ClaimantAge_at_DOI 5.594e+00
## GenderMale 9.881e+02
## GenderNot Available 5.941e+03
## AverageWeeklyWage 3.835e-02
## BodyPartRegionLower Extremities 1.082e+04
## BodyPartRegionMultiple Body Parts 1.580e+04
## BodyPartRegionNeck 2.777e+04
## BodyPartRegionNon-Standard Code 1.134e+04
## BodyPartRegionNot Available 9.506e+04
## BodyPartRegionTrunk 1.036e+04
## BodyPartRegionUpper Extremities 9.546e+03
## BodyPartAnkle 6.092e+03
## BodyPartArtificial Appliance 6.798e+04
## BodyPartBody Systems and Multiple Body Systems 1.465e+04
## BodyPartBrain 1.948e+04
## BodyPartButtocks 8.420e+03
## BodyPartChest 5.958e+03
## BodyPartDisc-Trunk 7.543e+03
## BodyPartEar(S) 1.292e+04
## BodyPartElbow 4.333e+03
## BodyPartEyes 9.955e+03
## BodyPartFacial Bones 1.105e+04
## BodyPartFinger(S) 3.327e+03
## BodyPartFoot 6.265e+03
## BodyPartGreat Toe 1.228e+04
## BodyPartHand 3.232e+03
## BodyPartHeart 2.306e+04
## BodyPartHip 6.985e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified 1.433e+04
## BodyPartInternal Organs 1.117e+04
## BodyPartKnee 5.816e+03
## BodyPartLarynx 3.872e+04
## BodyPartLower Arm 4.063e+03
## BodyPartLower Back Area 4.894e+03
## BodyPartLower Leg 6.471e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 6.323e+03
## BodyPartLungs 9.280e+03
## BodyPartMouth 1.204e+04
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) 1.291e+04
## BodyPartMultiple Head Injury 9.846e+03
## BodyPartMultiple Lower Extremities 7.644e+03
## BodyPartMultiple Neck Injury 2.644e+04
## BodyPartMultiple Trunk 1.174e+04
## BodyPartMultiple Upper Extremities 5.474e+03
## BodyPartNo Physical Injury 1.405e+04
## BodyPartNon-Standard Code NA
## BodyPartNose 1.192e+04
## BodyPartNot Available NA
## BodyPartPelvis 1.190e+04
## BodyPartSacrum And Coccyx 1.787e+04
## BodyPartShoulder(S) 3.136e+03
## BodyPartSkull 1.141e+04
## BodyPartSoft Tissue-Head 1.049e+04
## BodyPartSoft Tissue-Neck 2.633e+04
## BodyPartSpinal Cord-Trunk 1.455e+04
## BodyPartTeeth NA
## BodyPartThumb 4.580e+03
## BodyPartToes 8.960e+03
## BodyPartTrachea 4.671e+04
## BodyPartUpper Arm 4.733e+03
## BodyPartUpper Back Area 6.883e+03
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC 5.704e+04
## InjuryNatureAll Other Occupational Disease Injury, NOC 6.401e+04
## InjuryNatureAll Other Specific Injuries, Noc 5.458e+04
## InjuryNatureAmputation 5.684e+04
## InjuryNatureAngina Pectoris 5.934e+04
## InjuryNatureAsbestosis 5.699e+04
## InjuryNatureAsphyxiation 6.896e+04
## InjuryNatureBurn 5.475e+04
## InjuryNatureCancer 7.220e+04
## InjuryNatureCarpal Tunnel Syndrome 5.478e+04
## InjuryNatureConcussion 5.493e+04
## InjuryNatureContagious Disease 5.535e+04
## InjuryNatureContusion 5.455e+04
## InjuryNatureCrushing 5.486e+04
## InjuryNatureDermatitis 5.469e+04
## InjuryNatureDislocation 5.486e+04
## InjuryNatureDust Disease, NOC 6.011e+04
## InjuryNatureElectric Shock 5.598e+04
## InjuryNatureForeign Body 5.476e+04
## InjuryNatureFracture 5.459e+04
## InjuryNatureFreezing 7.713e+04
## InjuryNatureHearing Loss Or Impairment 5.899e+04
## InjuryNatureHeat Prostration 5.544e+04
## InjuryNatureHernia 5.527e+04
## InjuryNatureInfection 5.501e+04
## InjuryNatureInflammation 5.467e+04
## InjuryNatureLaceration 5.457e+04
## InjuryNatureLoss of Hearing 5.917e+04
## InjuryNatureMental Disorder 6.532e+04
## InjuryNatureMental Stress 5.511e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 5.619e+04
## InjuryNatureMultiple Physical Injuries Only 5.460e+04
## InjuryNatureMyocardial Infarction 6.147e+04
## InjuryNatureNo Physical Injury 5.468e+04
## InjuryNatureNon-Standard Code 5.492e+04
## InjuryNatureNot Available 5.508e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals) 5.568e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) 5.847e+04
## InjuryNaturePuncture 5.462e+04
## InjuryNatureRadiation 6.681e+04
## InjuryNatureRespiratory Disorders 5.490e+04
## InjuryNatureRupture 5.523e+04
## InjuryNatureSeverance 6.097e+04
## InjuryNatureSilicosis 7.712e+04
## InjuryNatureSprain 5.456e+04
## InjuryNatureStrain 5.455e+04
## InjuryNatureSyncope 5.562e+04
## InjuryNatureVascular 6.681e+04
## InjuryNatureVDT-Related Disease 8.622e+04
## InjuryNatureVision Loss 5.925e+04
## t value
## (Intercept) -0.319
## ClaimStatusO 88.042
## ClaimStatusR 52.623
## ClaimantAge_at_DOI 0.723
## GenderMale 2.636
## GenderNot Available 4.077
## AverageWeeklyWage 0.068
## BodyPartRegionLower Extremities 1.348
## BodyPartRegionMultiple Body Parts 3.768
## BodyPartRegionNeck 1.643
## BodyPartRegionNon-Standard Code 0.602
## BodyPartRegionNot Available 0.256
## BodyPartRegionTrunk 0.593
## BodyPartRegionUpper Extremities 1.487
## BodyPartAnkle -0.219
## BodyPartArtificial Appliance -0.625
## BodyPartBody Systems and Multiple Body Systems -3.204
## BodyPartBrain 3.771
## BodyPartButtocks -0.035
## BodyPartChest -0.061
## BodyPartDisc-Trunk 4.511
## BodyPartEar(S) 0.112
## BodyPartElbow -1.056
## BodyPartEyes 0.547
## BodyPartFacial Bones 1.177
## BodyPartFinger(S) -3.045
## BodyPartFoot -1.090
## BodyPartGreat Toe -0.829
## BodyPartHand -2.785
## BodyPartHeart 0.194
## BodyPartHip 0.616
## BodyPartInsufficient Info to Properly Identify?Unclassified -2.861
## BodyPartInternal Organs 1.703
## BodyPartKnee 0.707
## BodyPartLarynx -0.951
## BodyPartLower Arm -1.753
## BodyPartLower Back Area 7.085
## BodyPartLower Leg 0.139
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 4.859
## BodyPartLungs -0.112
## BodyPartMouth 0.755
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -2.006
## BodyPartMultiple Head Injury 2.040
## BodyPartMultiple Lower Extremities 1.574
## BodyPartMultiple Neck Injury -0.664
## BodyPartMultiple Trunk 1.468
## BodyPartMultiple Upper Extremities 1.793
## BodyPartNo Physical Injury -2.852
## BodyPartNon-Standard Code NA
## BodyPartNose -0.144
## BodyPartNot Available NA
## BodyPartPelvis 0.308
## BodyPartSacrum And Coccyx 1.132
## BodyPartShoulder(S) 2.311
## BodyPartSkull 0.403
## BodyPartSoft Tissue-Head -1.995
## BodyPartSoft Tissue-Neck -1.990
## BodyPartSpinal Cord-Trunk 9.652
## BodyPartTeeth NA
## BodyPartThumb -1.600
## BodyPartToes -1.101
## BodyPartTrachea -0.843
## BodyPartUpper Arm 1.125
## BodyPartUpper Back Area 2.923
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC -0.335
## InjuryNatureAll Other Occupational Disease Injury, NOC 1.670
## InjuryNatureAll Other Specific Injuries, Noc 0.263
## InjuryNatureAmputation 0.417
## InjuryNatureAngina Pectoris 0.158
## InjuryNatureAsbestosis 0.321
## InjuryNatureAsphyxiation 0.510
## InjuryNatureBurn 0.229
## InjuryNatureCancer 0.340
## InjuryNatureCarpal Tunnel Syndrome 0.189
## InjuryNatureConcussion 0.563
## InjuryNatureContagious Disease 0.304
## InjuryNatureContusion 0.185
## InjuryNatureCrushing 0.127
## InjuryNatureDermatitis -0.072
## InjuryNatureDislocation 0.091
## InjuryNatureDust Disease, NOC -0.031
## InjuryNatureElectric Shock 0.083
## InjuryNatureForeign Body 0.113
## InjuryNatureFracture 0.326
## InjuryNatureFreezing -0.131
## InjuryNatureHearing Loss Or Impairment 0.217
## InjuryNatureHeat Prostration -0.134
## InjuryNatureHernia 0.182
## InjuryNatureInfection -0.075
## InjuryNatureInflammation 0.168
## InjuryNatureLaceration 0.138
## InjuryNatureLoss of Hearing 0.309
## InjuryNatureMental Disorder 0.151
## InjuryNatureMental Stress 0.380
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 1.880
## InjuryNatureMultiple Physical Injuries Only 0.059
## InjuryNatureMyocardial Infarction 0.137
## InjuryNatureNo Physical Injury 0.009
## InjuryNatureNon-Standard Code -0.174
## InjuryNatureNot Available 0.069
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.004
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) -0.190
## InjuryNaturePuncture 0.148
## InjuryNatureRadiation 0.459
## InjuryNatureRespiratory Disorders 0.242
## InjuryNatureRupture 0.220
## InjuryNatureSeverance 0.950
## InjuryNatureSilicosis -0.010
## InjuryNatureSprain 0.008
## InjuryNatureStrain 0.064
## InjuryNatureSyncope 0.080
## InjuryNatureVascular 0.075
## InjuryNatureVDT-Related Disease 0.076
## InjuryNatureVision Loss 0.182
## Pr(>|t|)
## (Intercept) 0.749540
## ClaimStatusO < 2e-16
## ClaimStatusR < 2e-16
## ClaimantAge_at_DOI 0.469599
## GenderMale 0.008391
## GenderNot Available 4.58e-05
## AverageWeeklyWage 0.945567
## BodyPartRegionLower Extremities 0.177755
## BodyPartRegionMultiple Body Parts 0.000165
## BodyPartRegionNeck 0.100442
## BodyPartRegionNon-Standard Code 0.546850
## BodyPartRegionNot Available 0.797603
## BodyPartRegionTrunk 0.552907
## BodyPartRegionUpper Extremities 0.136934
## BodyPartAnkle 0.826310
## BodyPartArtificial Appliance 0.532099
## BodyPartBody Systems and Multiple Body Systems 0.001355
## BodyPartBrain 0.000163
## BodyPartButtocks 0.971725
## BodyPartChest 0.951476
## BodyPartDisc-Trunk 6.46e-06
## BodyPartEar(S) 0.910929
## BodyPartElbow 0.290868
## BodyPartEyes 0.584517
## BodyPartFacial Bones 0.239139
## BodyPartFinger(S) 0.002332
## BodyPartFoot 0.275565
## BodyPartGreat Toe 0.407044
## BodyPartHand 0.005362
## BodyPartHeart 0.846339
## BodyPartHip 0.537572
## BodyPartInsufficient Info to Properly Identify?Unclassified 0.004225
## BodyPartInternal Organs 0.088511
## BodyPartKnee 0.479840
## BodyPartLarynx 0.341562
## BodyPartLower Arm 0.079672
## BodyPartLower Back Area 1.42e-12
## BodyPartLower Leg 0.889560
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 1.18e-06
## BodyPartLungs 0.911069
## BodyPartMouth 0.450487
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) 0.044873
## BodyPartMultiple Head Injury 0.041391
## BodyPartMultiple Lower Extremities 0.115405
## BodyPartMultiple Neck Injury 0.507006
## BodyPartMultiple Trunk 0.142101
## BodyPartMultiple Upper Extremities 0.072988
## BodyPartNo Physical Injury 0.004345
## BodyPartNon-Standard Code NA
## BodyPartNose 0.885414
## BodyPartNot Available NA
## BodyPartPelvis 0.758063
## BodyPartSacrum And Coccyx 0.257593
## BodyPartShoulder(S) 0.020855
## BodyPartSkull 0.686873
## BodyPartSoft Tissue-Head 0.045997
## BodyPartSoft Tissue-Neck 0.046570
## BodyPartSpinal Cord-Trunk < 2e-16
## BodyPartTeeth NA
## BodyPartThumb 0.109607
## BodyPartToes 0.271051
## BodyPartTrachea 0.399162
## BodyPartUpper Arm 0.260544
## BodyPartUpper Back Area 0.003466
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC 0.737666
## InjuryNatureAll Other Occupational Disease Injury, NOC 0.094923
## InjuryNatureAll Other Specific Injuries, Noc 0.792729
## InjuryNatureAmputation 0.676655
## InjuryNatureAngina Pectoris 0.874325
## InjuryNatureAsbestosis 0.748108
## InjuryNatureAsphyxiation 0.609757
## InjuryNatureBurn 0.818582
## InjuryNatureCancer 0.733794
## InjuryNatureCarpal Tunnel Syndrome 0.850073
## InjuryNatureConcussion 0.573506
## InjuryNatureContagious Disease 0.761027
## InjuryNatureContusion 0.853542
## InjuryNatureCrushing 0.898810
## InjuryNatureDermatitis 0.942629
## InjuryNatureDislocation 0.927506
## InjuryNatureDust Disease, NOC 0.974993
## InjuryNatureElectric Shock 0.933699
## InjuryNatureForeign Body 0.909779
## InjuryNatureFracture 0.744607
## InjuryNatureFreezing 0.895808
## InjuryNatureHearing Loss Or Impairment 0.827956
## InjuryNatureHeat Prostration 0.893215
## InjuryNatureHernia 0.855272
## InjuryNatureInfection 0.940411
## InjuryNatureInflammation 0.866624
## InjuryNatureLaceration 0.890093
## InjuryNatureLoss of Hearing 0.757051
## InjuryNatureMental Disorder 0.880357
## InjuryNatureMental Stress 0.703833
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.060153
## InjuryNatureMultiple Physical Injuries Only 0.952654
## InjuryNatureMyocardial Infarction 0.891225
## InjuryNatureNo Physical Injury 0.993035
## InjuryNatureNon-Standard Code 0.861708
## InjuryNatureNot Available 0.944763
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.997008
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) 0.849692
## InjuryNaturePuncture 0.882230
## InjuryNatureRadiation 0.646486
## InjuryNatureRespiratory Disorders 0.808660
## InjuryNatureRupture 0.825795
## InjuryNatureSeverance 0.342350
## InjuryNatureSilicosis 0.991737
## InjuryNatureSprain 0.993465
## InjuryNatureStrain 0.948886
## InjuryNatureSyncope 0.936375
## InjuryNatureVascular 0.940265
## InjuryNatureVDT-Related Disease 0.939023
## InjuryNatureVision Loss 0.855965
##
## (Intercept)
## ClaimStatusO ***
## ClaimStatusR ***
## ClaimantAge_at_DOI
## GenderMale **
## GenderNot Available ***
## AverageWeeklyWage
## BodyPartRegionLower Extremities
## BodyPartRegionMultiple Body Parts ***
## BodyPartRegionNeck
## BodyPartRegionNon-Standard Code
## BodyPartRegionNot Available
## 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
## 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
## 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
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 94380 on 38269 degrees of freedom
## (148297 observations deleted due to missingness)
## Multiple R-squared: 0.2321, Adjusted R-squared: 0.2299
## F-statistic: 105.2 on 110 and 38269 DF, p-value: < 2.2e-16
## Warning in sqrt(crit * p * (1 - hh)/hh): Se han producido NaNs
## Warning in sqrt(crit * p * (1 - hh)/hh): Se han producido NaNs
Create Total Incurred Cost per claim
df2 <- df
#summary(df2)
df2$TotalIncurredCost <- with(df2, TotalReserves + IndemnityPaid + OtherPaid - TotalRecovery)Obtain the difference between closed and open dates to obtain the Claim Duration
df2$ClaimDuration <- as.numeric(difftime(df2$ClaimantClosedDate, df2$ClaimantOpenedDate, units = c("days")))
#df2$ClaimDuration <- seq(from = df2$ClaimantOpenedDate, to = df2$ClaimantClosedDate, by = "day")
#summary(df2$ClaimDuration)df2.lm <- lm(TotalIncurredCost ~ ClaimStatus + ClaimantAge_at_DOI + Gender + AverageWeeklyWage + BodyPartRegion + BodyPart + InjuryNature, data = df2)
summary(df2.lm)##
## Call:
## lm(formula = TotalIncurredCost ~ ClaimStatus + ClaimantAge_at_DOI +
## Gender + AverageWeeklyWage + BodyPartRegion + BodyPart +
## InjuryNature, data = df2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -289205 -16987 -3489 5766 4757653
##
## Coefficients: (7 not defined because of singularities)
## Estimate
## (Intercept) -1.766e+04
## ClaimStatusO 1.650e+05
## ClaimStatusR 1.754e+05
## ClaimantAge_at_DOI 4.046e+00
## GenderMale 2.605e+03
## GenderNot Available 2.422e+04
## AverageWeeklyWage 2.618e-03
## BodyPartRegionLower Extremities 1.458e+04
## BodyPartRegionMultiple Body Parts 5.952e+04
## BodyPartRegionNeck 4.562e+04
## BodyPartRegionNon-Standard Code 6.831e+03
## BodyPartRegionNot Available 2.438e+04
## BodyPartRegionTrunk 6.148e+03
## BodyPartRegionUpper Extremities 1.420e+04
## BodyPartAnkle -1.337e+03
## BodyPartArtificial Appliance -4.247e+04
## BodyPartBody Systems and Multiple Body Systems -4.695e+04
## BodyPartBrain 7.347e+04
## BodyPartButtocks -2.985e+02
## BodyPartChest -3.626e+02
## BodyPartDisc-Trunk 3.403e+04
## BodyPartEar(S) 1.445e+03
## BodyPartElbow -4.576e+03
## BodyPartEyes 5.443e+03
## BodyPartFacial Bones 1.300e+04
## BodyPartFinger(S) -1.013e+04
## BodyPartFoot -6.831e+03
## BodyPartGreat Toe -1.018e+04
## BodyPartHand -9.000e+03
## BodyPartHeart 4.469e+03
## BodyPartHip 4.306e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified -4.100e+04
## BodyPartInternal Organs 1.903e+04
## BodyPartKnee 4.109e+03
## BodyPartLarynx -3.683e+04
## BodyPartLower Arm -7.120e+03
## BodyPartLower Back Area 3.467e+04
## BodyPartLower Leg 8.986e+02
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 3.072e+04
## BodyPartLungs -1.036e+03
## BodyPartMouth 9.086e+03
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -2.590e+04
## BodyPartMultiple Head Injury 2.008e+04
## BodyPartMultiple Lower Extremities 1.203e+04
## BodyPartMultiple Neck Injury -1.754e+04
## BodyPartMultiple Trunk 1.723e+04
## BodyPartMultiple Upper Extremities 9.815e+03
## BodyPartNo Physical Injury -4.008e+04
## BodyPartNon-Standard Code NA
## BodyPartNose -1.718e+03
## BodyPartNot Available NA
## BodyPartPelvis 3.667e+03
## BodyPartSacrum And Coccyx 2.023e+04
## BodyPartShoulder(S) 7.246e+03
## BodyPartSkull 4.599e+03
## BodyPartSoft Tissue-Head -2.094e+04
## BodyPartSoft Tissue-Neck -5.241e+04
## BodyPartSpinal Cord-Trunk 1.404e+05
## BodyPartTeeth NA
## BodyPartThumb -7.328e+03
## BodyPartToes -9.862e+03
## BodyPartTrachea -3.939e+04
## BodyPartUpper Arm 5.325e+03
## BodyPartUpper Back Area 2.012e+04
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC -1.911e+04
## InjuryNatureAll Other Occupational Disease Injury, NOC 1.069e+05
## InjuryNatureAll Other Specific Injuries, Noc 1.434e+04
## InjuryNatureAmputation 2.370e+04
## InjuryNatureAngina Pectoris 9.385e+03
## InjuryNatureAsbestosis 1.830e+04
## InjuryNatureAsphyxiation 3.520e+04
## InjuryNatureBurn 1.256e+04
## InjuryNatureCancer 2.455e+04
## InjuryNatureCarpal Tunnel Syndrome 1.035e+04
## InjuryNatureConcussion 3.092e+04
## InjuryNatureContagious Disease 1.683e+04
## InjuryNatureContusion 1.007e+04
## InjuryNatureCrushing 6.976e+03
## InjuryNatureDermatitis -3.936e+03
## InjuryNatureDislocation 4.992e+03
## InjuryNatureDust Disease, NOC -1.884e+03
## InjuryNatureElectric Shock 4.657e+03
## InjuryNatureForeign Body 6.205e+03
## InjuryNatureFracture 1.778e+04
## InjuryNatureFreezing -1.010e+04
## InjuryNatureHearing Loss Or Impairment 1.282e+04
## InjuryNatureHeat Prostration -7.442e+03
## InjuryNatureHernia 1.008e+04
## InjuryNatureInfection -4.112e+03
## InjuryNatureInflammation 9.181e+03
## InjuryNatureLaceration 7.542e+03
## InjuryNatureLoss of Hearing 1.831e+04
## InjuryNatureMental Disorder 9.832e+03
## InjuryNatureMental Stress 2.095e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 1.056e+05
## InjuryNatureMultiple Physical Injuries Only 3.242e+03
## InjuryNatureMyocardial Infarction 8.407e+03
## InjuryNatureNo Physical Injury 4.773e+02
## InjuryNatureNon-Standard Code -9.568e+03
## InjuryNatureNot Available 3.816e+03
## InjuryNaturePoisoning?Chemical (Other Than Metals) 2.088e+02
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) -1.108e+04
## InjuryNaturePuncture 8.092e+03
## InjuryNatureRadiation 3.064e+04
## InjuryNatureRespiratory Disorders 1.329e+04
## InjuryNatureRupture 1.216e+04
## InjuryNatureSeverance 5.789e+04
## InjuryNatureSilicosis -7.988e+02
## InjuryNatureSprain 4.469e+02
## InjuryNatureStrain 3.497e+03
## InjuryNatureSyncope 4.440e+03
## InjuryNatureVascular 5.007e+03
## InjuryNatureVDT-Related Disease 6.596e+03
## InjuryNatureVision Loss 1.075e+04
## Std. Error
## (Intercept) 5.532e+04
## ClaimStatusO 1.874e+03
## ClaimStatusR 3.334e+03
## ClaimantAge_at_DOI 5.594e+00
## GenderMale 9.881e+02
## GenderNot Available 5.941e+03
## AverageWeeklyWage 3.835e-02
## BodyPartRegionLower Extremities 1.082e+04
## BodyPartRegionMultiple Body Parts 1.580e+04
## BodyPartRegionNeck 2.777e+04
## BodyPartRegionNon-Standard Code 1.134e+04
## BodyPartRegionNot Available 9.506e+04
## BodyPartRegionTrunk 1.036e+04
## BodyPartRegionUpper Extremities 9.546e+03
## BodyPartAnkle 6.092e+03
## BodyPartArtificial Appliance 6.798e+04
## BodyPartBody Systems and Multiple Body Systems 1.465e+04
## BodyPartBrain 1.948e+04
## BodyPartButtocks 8.420e+03
## BodyPartChest 5.958e+03
## BodyPartDisc-Trunk 7.543e+03
## BodyPartEar(S) 1.292e+04
## BodyPartElbow 4.333e+03
## BodyPartEyes 9.955e+03
## BodyPartFacial Bones 1.105e+04
## BodyPartFinger(S) 3.327e+03
## BodyPartFoot 6.265e+03
## BodyPartGreat Toe 1.228e+04
## BodyPartHand 3.232e+03
## BodyPartHeart 2.306e+04
## BodyPartHip 6.985e+03
## BodyPartInsufficient Info to Properly Identify?Unclassified 1.433e+04
## BodyPartInternal Organs 1.117e+04
## BodyPartKnee 5.816e+03
## BodyPartLarynx 3.872e+04
## BodyPartLower Arm 4.063e+03
## BodyPartLower Back Area 4.894e+03
## BodyPartLower Leg 6.471e+03
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 6.323e+03
## BodyPartLungs 9.280e+03
## BodyPartMouth 1.204e+04
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) 1.291e+04
## BodyPartMultiple Head Injury 9.846e+03
## BodyPartMultiple Lower Extremities 7.644e+03
## BodyPartMultiple Neck Injury 2.644e+04
## BodyPartMultiple Trunk 1.174e+04
## BodyPartMultiple Upper Extremities 5.474e+03
## BodyPartNo Physical Injury 1.405e+04
## BodyPartNon-Standard Code NA
## BodyPartNose 1.192e+04
## BodyPartNot Available NA
## BodyPartPelvis 1.190e+04
## BodyPartSacrum And Coccyx 1.787e+04
## BodyPartShoulder(S) 3.136e+03
## BodyPartSkull 1.141e+04
## BodyPartSoft Tissue-Head 1.049e+04
## BodyPartSoft Tissue-Neck 2.633e+04
## BodyPartSpinal Cord-Trunk 1.455e+04
## BodyPartTeeth NA
## BodyPartThumb 4.580e+03
## BodyPartToes 8.960e+03
## BodyPartTrachea 4.671e+04
## BodyPartUpper Arm 4.733e+03
## BodyPartUpper Back Area 6.883e+03
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC 5.704e+04
## InjuryNatureAll Other Occupational Disease Injury, NOC 6.401e+04
## InjuryNatureAll Other Specific Injuries, Noc 5.458e+04
## InjuryNatureAmputation 5.684e+04
## InjuryNatureAngina Pectoris 5.934e+04
## InjuryNatureAsbestosis 5.699e+04
## InjuryNatureAsphyxiation 6.896e+04
## InjuryNatureBurn 5.475e+04
## InjuryNatureCancer 7.220e+04
## InjuryNatureCarpal Tunnel Syndrome 5.478e+04
## InjuryNatureConcussion 5.493e+04
## InjuryNatureContagious Disease 5.535e+04
## InjuryNatureContusion 5.455e+04
## InjuryNatureCrushing 5.486e+04
## InjuryNatureDermatitis 5.469e+04
## InjuryNatureDislocation 5.486e+04
## InjuryNatureDust Disease, NOC 6.011e+04
## InjuryNatureElectric Shock 5.598e+04
## InjuryNatureForeign Body 5.476e+04
## InjuryNatureFracture 5.459e+04
## InjuryNatureFreezing 7.713e+04
## InjuryNatureHearing Loss Or Impairment 5.899e+04
## InjuryNatureHeat Prostration 5.544e+04
## InjuryNatureHernia 5.527e+04
## InjuryNatureInfection 5.501e+04
## InjuryNatureInflammation 5.467e+04
## InjuryNatureLaceration 5.457e+04
## InjuryNatureLoss of Hearing 5.917e+04
## InjuryNatureMental Disorder 6.532e+04
## InjuryNatureMental Stress 5.511e+04
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 5.619e+04
## InjuryNatureMultiple Physical Injuries Only 5.460e+04
## InjuryNatureMyocardial Infarction 6.147e+04
## InjuryNatureNo Physical Injury 5.468e+04
## InjuryNatureNon-Standard Code 5.492e+04
## InjuryNatureNot Available 5.508e+04
## InjuryNaturePoisoning?Chemical (Other Than Metals) 5.568e+04
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) 5.847e+04
## InjuryNaturePuncture 5.462e+04
## InjuryNatureRadiation 6.681e+04
## InjuryNatureRespiratory Disorders 5.490e+04
## InjuryNatureRupture 5.523e+04
## InjuryNatureSeverance 6.097e+04
## InjuryNatureSilicosis 7.712e+04
## InjuryNatureSprain 5.456e+04
## InjuryNatureStrain 5.455e+04
## InjuryNatureSyncope 5.562e+04
## InjuryNatureVascular 6.681e+04
## InjuryNatureVDT-Related Disease 8.622e+04
## InjuryNatureVision Loss 5.925e+04
## t value
## (Intercept) -0.319
## ClaimStatusO 88.042
## ClaimStatusR 52.623
## ClaimantAge_at_DOI 0.723
## GenderMale 2.636
## GenderNot Available 4.077
## AverageWeeklyWage 0.068
## BodyPartRegionLower Extremities 1.348
## BodyPartRegionMultiple Body Parts 3.768
## BodyPartRegionNeck 1.643
## BodyPartRegionNon-Standard Code 0.602
## BodyPartRegionNot Available 0.256
## BodyPartRegionTrunk 0.593
## BodyPartRegionUpper Extremities 1.487
## BodyPartAnkle -0.219
## BodyPartArtificial Appliance -0.625
## BodyPartBody Systems and Multiple Body Systems -3.204
## BodyPartBrain 3.771
## BodyPartButtocks -0.035
## BodyPartChest -0.061
## BodyPartDisc-Trunk 4.511
## BodyPartEar(S) 0.112
## BodyPartElbow -1.056
## BodyPartEyes 0.547
## BodyPartFacial Bones 1.177
## BodyPartFinger(S) -3.045
## BodyPartFoot -1.090
## BodyPartGreat Toe -0.829
## BodyPartHand -2.785
## BodyPartHeart 0.194
## BodyPartHip 0.616
## BodyPartInsufficient Info to Properly Identify?Unclassified -2.861
## BodyPartInternal Organs 1.703
## BodyPartKnee 0.707
## BodyPartLarynx -0.951
## BodyPartLower Arm -1.753
## BodyPartLower Back Area 7.085
## BodyPartLower Leg 0.139
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 4.859
## BodyPartLungs -0.112
## BodyPartMouth 0.755
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) -2.006
## BodyPartMultiple Head Injury 2.040
## BodyPartMultiple Lower Extremities 1.574
## BodyPartMultiple Neck Injury -0.664
## BodyPartMultiple Trunk 1.468
## BodyPartMultiple Upper Extremities 1.793
## BodyPartNo Physical Injury -2.852
## BodyPartNon-Standard Code NA
## BodyPartNose -0.144
## BodyPartNot Available NA
## BodyPartPelvis 0.308
## BodyPartSacrum And Coccyx 1.132
## BodyPartShoulder(S) 2.311
## BodyPartSkull 0.403
## BodyPartSoft Tissue-Head -1.995
## BodyPartSoft Tissue-Neck -1.990
## BodyPartSpinal Cord-Trunk 9.652
## BodyPartTeeth NA
## BodyPartThumb -1.600
## BodyPartToes -1.101
## BodyPartTrachea -0.843
## BodyPartUpper Arm 1.125
## BodyPartUpper Back Area 2.923
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC -0.335
## InjuryNatureAll Other Occupational Disease Injury, NOC 1.670
## InjuryNatureAll Other Specific Injuries, Noc 0.263
## InjuryNatureAmputation 0.417
## InjuryNatureAngina Pectoris 0.158
## InjuryNatureAsbestosis 0.321
## InjuryNatureAsphyxiation 0.510
## InjuryNatureBurn 0.229
## InjuryNatureCancer 0.340
## InjuryNatureCarpal Tunnel Syndrome 0.189
## InjuryNatureConcussion 0.563
## InjuryNatureContagious Disease 0.304
## InjuryNatureContusion 0.185
## InjuryNatureCrushing 0.127
## InjuryNatureDermatitis -0.072
## InjuryNatureDislocation 0.091
## InjuryNatureDust Disease, NOC -0.031
## InjuryNatureElectric Shock 0.083
## InjuryNatureForeign Body 0.113
## InjuryNatureFracture 0.326
## InjuryNatureFreezing -0.131
## InjuryNatureHearing Loss Or Impairment 0.217
## InjuryNatureHeat Prostration -0.134
## InjuryNatureHernia 0.182
## InjuryNatureInfection -0.075
## InjuryNatureInflammation 0.168
## InjuryNatureLaceration 0.138
## InjuryNatureLoss of Hearing 0.309
## InjuryNatureMental Disorder 0.151
## InjuryNatureMental Stress 0.380
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 1.880
## InjuryNatureMultiple Physical Injuries Only 0.059
## InjuryNatureMyocardial Infarction 0.137
## InjuryNatureNo Physical Injury 0.009
## InjuryNatureNon-Standard Code -0.174
## InjuryNatureNot Available 0.069
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.004
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) -0.190
## InjuryNaturePuncture 0.148
## InjuryNatureRadiation 0.459
## InjuryNatureRespiratory Disorders 0.242
## InjuryNatureRupture 0.220
## InjuryNatureSeverance 0.950
## InjuryNatureSilicosis -0.010
## InjuryNatureSprain 0.008
## InjuryNatureStrain 0.064
## InjuryNatureSyncope 0.080
## InjuryNatureVascular 0.075
## InjuryNatureVDT-Related Disease 0.076
## InjuryNatureVision Loss 0.182
## Pr(>|t|)
## (Intercept) 0.749540
## ClaimStatusO < 2e-16
## ClaimStatusR < 2e-16
## ClaimantAge_at_DOI 0.469599
## GenderMale 0.008391
## GenderNot Available 4.58e-05
## AverageWeeklyWage 0.945567
## BodyPartRegionLower Extremities 0.177755
## BodyPartRegionMultiple Body Parts 0.000165
## BodyPartRegionNeck 0.100442
## BodyPartRegionNon-Standard Code 0.546850
## BodyPartRegionNot Available 0.797603
## BodyPartRegionTrunk 0.552907
## BodyPartRegionUpper Extremities 0.136934
## BodyPartAnkle 0.826310
## BodyPartArtificial Appliance 0.532099
## BodyPartBody Systems and Multiple Body Systems 0.001355
## BodyPartBrain 0.000163
## BodyPartButtocks 0.971725
## BodyPartChest 0.951476
## BodyPartDisc-Trunk 6.46e-06
## BodyPartEar(S) 0.910929
## BodyPartElbow 0.290868
## BodyPartEyes 0.584517
## BodyPartFacial Bones 0.239139
## BodyPartFinger(S) 0.002332
## BodyPartFoot 0.275565
## BodyPartGreat Toe 0.407044
## BodyPartHand 0.005362
## BodyPartHeart 0.846339
## BodyPartHip 0.537572
## BodyPartInsufficient Info to Properly Identify?Unclassified 0.004225
## BodyPartInternal Organs 0.088511
## BodyPartKnee 0.479840
## BodyPartLarynx 0.341562
## BodyPartLower Arm 0.079672
## BodyPartLower Back Area 1.42e-12
## BodyPartLower Leg 0.889560
## BodyPartLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 1.18e-06
## BodyPartLungs 0.911069
## BodyPartMouth 0.450487
## BodyPartMultiple Body Parts (Including Body Systems and Body Parts) 0.044873
## BodyPartMultiple Head Injury 0.041391
## BodyPartMultiple Lower Extremities 0.115405
## BodyPartMultiple Neck Injury 0.507006
## BodyPartMultiple Trunk 0.142101
## BodyPartMultiple Upper Extremities 0.072988
## BodyPartNo Physical Injury 0.004345
## BodyPartNon-Standard Code NA
## BodyPartNose 0.885414
## BodyPartNot Available NA
## BodyPartPelvis 0.758063
## BodyPartSacrum And Coccyx 0.257593
## BodyPartShoulder(S) 0.020855
## BodyPartSkull 0.686873
## BodyPartSoft Tissue-Head 0.045997
## BodyPartSoft Tissue-Neck 0.046570
## BodyPartSpinal Cord-Trunk < 2e-16
## BodyPartTeeth NA
## BodyPartThumb 0.109607
## BodyPartToes 0.271051
## BodyPartTrachea 0.399162
## BodyPartUpper Arm 0.260544
## BodyPartUpper Back Area 0.003466
## BodyPartUpper Leg NA
## BodyPartVertebrae NA
## BodyPartWhole Body NA
## BodyPartWrist NA
## InjuryNatureAll Other Cumulative Injury, NOC 0.737666
## InjuryNatureAll Other Occupational Disease Injury, NOC 0.094923
## InjuryNatureAll Other Specific Injuries, Noc 0.792729
## InjuryNatureAmputation 0.676655
## InjuryNatureAngina Pectoris 0.874325
## InjuryNatureAsbestosis 0.748108
## InjuryNatureAsphyxiation 0.609757
## InjuryNatureBurn 0.818582
## InjuryNatureCancer 0.733794
## InjuryNatureCarpal Tunnel Syndrome 0.850073
## InjuryNatureConcussion 0.573506
## InjuryNatureContagious Disease 0.761027
## InjuryNatureContusion 0.853542
## InjuryNatureCrushing 0.898810
## InjuryNatureDermatitis 0.942629
## InjuryNatureDislocation 0.927506
## InjuryNatureDust Disease, NOC 0.974993
## InjuryNatureElectric Shock 0.933699
## InjuryNatureForeign Body 0.909779
## InjuryNatureFracture 0.744607
## InjuryNatureFreezing 0.895808
## InjuryNatureHearing Loss Or Impairment 0.827956
## InjuryNatureHeat Prostration 0.893215
## InjuryNatureHernia 0.855272
## InjuryNatureInfection 0.940411
## InjuryNatureInflammation 0.866624
## InjuryNatureLaceration 0.890093
## InjuryNatureLoss of Hearing 0.757051
## InjuryNatureMental Disorder 0.880357
## InjuryNatureMental Stress 0.703833
## InjuryNatureMultiple Injuries Including Both Physical and Psychological 0.060153
## InjuryNatureMultiple Physical Injuries Only 0.952654
## InjuryNatureMyocardial Infarction 0.891225
## InjuryNatureNo Physical Injury 0.993035
## InjuryNatureNon-Standard Code 0.861708
## InjuryNatureNot Available 0.944763
## InjuryNaturePoisoning?Chemical (Other Than Metals) 0.997008
## InjuryNaturePoisoning?General (NOT OD or Cumulative Injury) 0.849692
## InjuryNaturePuncture 0.882230
## InjuryNatureRadiation 0.646486
## InjuryNatureRespiratory Disorders 0.808660
## InjuryNatureRupture 0.825795
## InjuryNatureSeverance 0.342350
## InjuryNatureSilicosis 0.991737
## InjuryNatureSprain 0.993465
## InjuryNatureStrain 0.948886
## InjuryNatureSyncope 0.936375
## InjuryNatureVascular 0.940265
## InjuryNatureVDT-Related Disease 0.939023
## InjuryNatureVision Loss 0.855965
##
## (Intercept)
## ClaimStatusO ***
## ClaimStatusR ***
## ClaimantAge_at_DOI
## GenderMale **
## GenderNot Available ***
## AverageWeeklyWage
## BodyPartRegionLower Extremities
## BodyPartRegionMultiple Body Parts ***
## BodyPartRegionNeck
## BodyPartRegionNon-Standard Code
## BodyPartRegionNot Available
## 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
## 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
## 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
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 94380 on 38269 degrees of freedom
## (148297 observations deleted due to missingness)
## Multiple R-squared: 0.2321, Adjusted R-squared: 0.2299
## F-statistic: 105.2 on 110 and 38269 DF, p-value: < 2.2e-16
## Warning in sqrt(crit * p * (1 - hh)/hh): Se han producido NaNs
## Warning in sqrt(crit * p * (1 - hh)/hh): Se han producido NaNs
## ClaimID TotalPaid TotalReserves TotalRecovery
## Min. : 633915 Length:186677 Min. : 0 Min. : 0.00
## 1st Qu.: 810246 Class :character 1st Qu.: 0 1st Qu.: 0.00
## Median : 856915 Mode :character Median : 0 Median : 0.00
## Mean :12344572 Mean : 2233 Mean : 68.88
## 3rd Qu.:22716420 3rd Qu.: 0 3rd Qu.: 0.00
## Max. :62246496 Max. :2069575 Max. :130541.03
## NA's :52673 NA's :52673
## IndemnityPaid OtherPaid TotalIncurredCost ClaimStatus
## Min. : -475 Min. : -7820 Min. : -11775 Length:186677
## 1st Qu.: 0 1st Qu.: 58 1st Qu.: 59 Class :character
## Median : 0 Median : 230 Median : 234 Mode :character
## Mean : 3061 Mean : 3685 Mean : 8910
## 3rd Qu.: 0 3rd Qu.: 855 3rd Qu.: 965
## Max. :640732 Max. :4129915 Max. :5054823
## NA's :52673 NA's :52673 NA's :52673
## IncidentDate IncidentDescription
## Min. :1947-02-24 00:00:00 Length:186677
## 1st Qu.:1998-12-21 00:00:00 Class :character
## Median :2004-01-05 00:00:00 Mode :character
## Mean :2003-12-08 16:48:47
## 3rd Qu.:2009-02-02 00:00:00
## Max. :2014-06-27 00:00:00
## NA's :52673
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## Min. :1976-10-29 00:00:00 Min. : 0.0 Min. :1947-02-24
## 1st Qu.:2002-04-25 00:00:00 1st Qu.: 300.0 1st Qu.:1999-02-09
## Median :2007-07-09 00:00:00 Median : 492.0 Median :2004-02-17
## Mean :2006-06-01 15:30:12 Mean : 587.3 Mean :2004-01-23
## 3rd Qu.:2011-06-01 00:00:00 3rd Qu.: 660.4 3rd Qu.:2009-04-09
## Max. :2015-05-07 00:00:00 Max. :2024000.0 Max. :2014-06-30
## NA's :111310 NA's :137597 NA's :52673
## ClaimantClosedDate EmployerNotificationDate
## Min. :1999-06-01 Min. :1972-09-10 00:00:00
## 1st Qu.:2005-03-31 1st Qu.:2000-03-13 00:00:00
## Median :2006-04-04 Median :2004-12-28 00:00:00
## Mean :2007-05-24 Mean :2005-08-29 04:49:34
## 3rd Qu.:2009-11-11 3rd Qu.:2009-11-03 00:00:00
## Max. :2014-06-30 Max. :9999-07-21 00:00:00
## NA's :57351 NA's :74961
## ReceivedDate IsDenied ClaimantAge_at_DOI
## Min. :1947-02-24 00:00:00 Length:186677 Min. :-8000.00
## 1st Qu.:1999-02-09 00:00:00 Class :character 1st Qu.: 33.00
## Median :2004-02-13 00:00:00 Mode :character Median : 42.00
## Mean :2004-07-19 11:29:03 Mean : 39.85
## 3rd Qu.:2009-02-27 00:00:00 3rd Qu.: 51.00
## Max. :9999-07-21 00:00:00 Max. : 94.00
## NA's :52673 NA's :97751
## Gender ClaimantType InjuryNature BodyPartRegion
## Length:186677 Length:186677 Length:186677 Length:186677
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## BodyPart BillReviewALE Hospital PhysicianOutpatient
## Length:186677 Min. : -456.0 Min. : -12570.4 Min. : -4655.7
## Class :character 1st Qu.: 16.0 1st Qu.: 193.9 1st Qu.: 107.6
## Mode :character 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
#library(dplyr)
#Convertir a numericos
df$IndemnityPaid <- as.numeric(df$IndemnityPaid)
df$TotalPaid <- as.numeric(df$TotalPaid)
df$TotalReserves <- as.numeric(df$TotalReserves)
df$TotalRecovery <- as.numeric(df$TotalRecovery)
df$IndemnityPaid <- as.numeric(df$IndemnityPaid)
df$OtherPaid <- as.numeric(df$OtherPaid)
df$AverageWeeklyWage <- as.numeric(df$AverageWeeklyWage)
df$ClaimantAge_at_DOI <- as.numeric(df$ClaimantAge_at_DOI)
df$TotalIncurredCost <- with(df, TotalReserves + IndemnityPaid + OtherPaid - TotalRecovery)
# Eliminar Totales negativos
df <- df[df$TotalIncurredCost>=0,]
df <- df[df$BillReviewALE>=0,]
df <- df[df$Hospital>=0,]
df <- df[df$PhysicianOutpatient>=0,]
df <- df[df$Rx>=0,]
# Cuantos NA's hay por variable
sapply(df, function(x) sum(is.na(x)))## ClaimID TotalPaid TotalReserves
## 181492 181492 181492
## TotalRecovery IndemnityPaid OtherPaid
## 181492 181492 181492
## TotalIncurredCost ClaimStatus IncidentDate
## 181492 181492 181492
## IncidentDescription ReturnToWorkDate AverageWeeklyWage
## 181492 184160 184958
## ClaimantOpenedDate ClaimantClosedDate EmployerNotificationDate
## 181492 181529 181685
## ReceivedDate IsDenied ClaimantAge_at_DOI
## 181492 181492 183099
## Gender ClaimantType InjuryNature
## 181492 181492 181492
## BodyPartRegion BodyPart BillReviewALE
## 181492 181492 181492
## Hospital PhysicianOutpatient Rx
## 181492 181492 181492
## ClaimID TotalPaid TotalReserves TotalRecovery
## Min. : 777625 Min. : 0.0 Min. : 0 Min. : 0.00
## 1st Qu.: 793154 1st Qu.: 67.4 1st Qu.: 0 1st Qu.: 0.00
## Median : 803511 Median : 240.7 Median : 0 Median : 0.00
## Mean : 1672130 Mean : 6187.5 Mean : 1707 Mean : 50.73
## 3rd Qu.: 813440 3rd Qu.: 851.9 3rd Qu.: 0 3rd Qu.: 0.00
## Max. :36094375 Max. :755038.3 Max. :899411 Max. :25044.20
## NA's :181492 NA's :181492 NA's :181492 NA's :181492
## IndemnityPaid OtherPaid TotalIncurredCost ClaimStatus
## Min. : 0 Min. : 0.0 Min. : 0.0 Length:186571
## 1st Qu.: 0 1st Qu.: 66.7 1st Qu.: 65.3 Class :character
## Median : 0 Median : 235.7 Median : 235.1 Mode :character
## Mean : 2852 Mean : 3335.7 Mean : 7843.8
## 3rd Qu.: 0 3rd Qu.: 783.3 3rd Qu.: 832.8
## Max. :314577 Max. :623298.0 Max. :1654449.4
## NA's :181492 NA's :181492 NA's :181492
## IncidentDate IncidentDescription
## Min. :1982-09-16 00:00:00 Length:186571
## 1st Qu.:2001-05-24 00:00:00 Class :character
## Median :2003-06-03 00:00:00 Mode :character
## Mean :2002-12-19 00:57:33
## 3rd Qu.:2005-02-23 00:00:00
## Max. :2013-09-12 00:00:00
## NA's :181492
## ReturnToWorkDate AverageWeeklyWage ClaimantOpenedDate
## Min. :1992-05-01 00:00:00 Min. : 0.23 Min. :1982-09-16
## 1st Qu.:2003-05-28 00:00:00 1st Qu.: 346.40 1st Qu.:2001-06-19
## Median :2004-11-18 00:00:00 Median : 472.79 Median :2003-07-11
## Mean :2004-03-29 03:13:30 Mean : 490.53 Mean :2003-02-07
## 3rd Qu.:2005-10-25 00:00:00 3rd Qu.: 616.81 3rd Qu.:2005-04-11
## Max. :2013-09-12 00:00:00 Max. :7409.77 Max. :2013-09-18
## NA's :184160 NA's :184958 NA's :181492
## ClaimantClosedDate EmployerNotificationDate
## Min. :1999-07-12 Min. :1990-10-10 00:00:00
## 1st Qu.:2005-03-31 1st Qu.:2001-08-01 12:00:00
## Median :2005-04-25 Median :2003-07-17 00:00:00
## Mean :2006-05-07 Mean :2003-04-23 08:55:30
## 3rd Qu.:2007-07-20 3rd Qu.:2005-03-22 00:00:00
## Max. :2014-06-25 Max. :2013-09-12 00:00:00
## NA's :181529 NA's :181685
## ReceivedDate IsDenied ClaimantAge_at_DOI
## Min. :1982-09-16 00:00:00 Length:186571 Min. :-80.00
## 1st Qu.:2001-06-19 00:00:00 Class :character 1st Qu.: 33.00
## Median :2003-07-10 00:00:00 Mode :character Median : 42.00
## Mean :2003-10-13 12:02:24 Mean : 41.46
## 3rd Qu.:2005-04-06 00:00:00 3rd Qu.: 50.00
## Max. :5202-01-10 00:00:00 Max. : 94.00
## NA's :181492 NA's :183099
## Gender ClaimantType InjuryNature BodyPartRegion
## Length:186571 Length:186571 Length:186571 Length:186571
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## BodyPart BillReviewALE Hospital PhysicianOutpatient
## Length:186571 Min. : 0.0 Min. : 0.0 Min. : 0
## Class :character 1st Qu.: 40.0 1st Qu.: 775.9 1st Qu.: 627
## Mode :character Median : 144.0 Median : 3609.9 Median : 3897
## Mean : 722.6 Mean : 14363.7 Mean : 10604
## 3rd Qu.: 516.8 3rd Qu.: 12562.1 3rd Qu.: 10990
## Max. :56475.3 Max. :2759604.0 Max. :1481469
## NA's :181492 NA's :181492 NA's :181492
## Rx
## Min. : 0.0
## 1st Qu.: 48.3
## Median : 183.3
## Mean : 4900.2
## 3rd Qu.: 953.9
## Max. :631635.5
## NA's :181492
## Warning: package 'rpart' was built under R version 4.1.3
## Warning: package 'rpart.plot' was built under R version 4.1.3