setwd("C:\\Users\\javaw\\OneDrive - Instituto Tecnologico y de Estudios Superiores de Monterrey\\7mo Semestre\\Modulo 3")
df <- read.csv("rentadebicis.csv")
head(df,10)
## ï..hora dia mes aÃ.o estacion dia_de_la_semana asueto temperatura
## 1 0 1 1 2011 1 6 0 9.84
## 2 1 1 1 2011 1 6 0 9.02
## 3 2 1 1 2011 1 6 0 9.02
## 4 3 1 1 2011 1 6 0 9.84
## 5 4 1 1 2011 1 6 0 9.84
## 6 5 1 1 2011 1 6 0 9.84
## 7 6 1 1 2011 1 6 0 9.02
## 8 7 1 1 2011 1 6 0 8.20
## 9 8 1 1 2011 1 6 0 9.84
## 10 9 1 1 2011 1 6 0 13.12
## sensacion_termica humedad velocidad_del_viento rentas_de_no_registrados
## 1 14.395 81 0.0000 3
## 2 13.635 80 0.0000 8
## 3 13.635 80 0.0000 5
## 4 14.395 75 0.0000 3
## 5 14.395 75 0.0000 0
## 6 12.880 75 6.0032 0
## 7 13.635 80 0.0000 2
## 8 12.880 86 0.0000 1
## 9 14.395 75 0.0000 1
## 10 17.425 76 0.0000 8
## rentas_de_registrados rentas_totales
## 1 13 16
## 2 32 40
## 3 27 32
## 4 10 13
## 5 1 1
## 6 1 1
## 7 0 2
## 8 2 3
## 9 7 8
## 10 6 14
resumen <- summary(df)
resumen
## ï..hora dia mes aÃ.o
## Min. : 0.00 Min. : 1.000 Min. : 1.000 Min. :2011
## 1st Qu.: 6.00 1st Qu.: 5.000 1st Qu.: 4.000 1st Qu.:2011
## Median :12.00 Median :10.000 Median : 7.000 Median :2012
## Mean :11.54 Mean : 9.993 Mean : 6.521 Mean :2012
## 3rd Qu.:18.00 3rd Qu.:15.000 3rd Qu.:10.000 3rd Qu.:2012
## Max. :23.00 Max. :19.000 Max. :12.000 Max. :2012
## estacion dia_de_la_semana asueto temperatura
## Min. :1.000 Min. :1.000 Min. :0.00000 Min. : 0.82
## 1st Qu.:2.000 1st Qu.:2.000 1st Qu.:0.00000 1st Qu.:13.94
## Median :3.000 Median :4.000 Median :0.00000 Median :20.50
## Mean :2.507 Mean :4.014 Mean :0.02857 Mean :20.23
## 3rd Qu.:4.000 3rd Qu.:6.000 3rd Qu.:0.00000 3rd Qu.:26.24
## Max. :4.000 Max. :7.000 Max. :1.00000 Max. :41.00
## sensacion_termica humedad velocidad_del_viento
## Min. : 0.76 Min. : 0.00 Min. : 0.000
## 1st Qu.:16.66 1st Qu.: 47.00 1st Qu.: 7.002
## Median :24.24 Median : 62.00 Median :12.998
## Mean :23.66 Mean : 61.89 Mean :12.799
## 3rd Qu.:31.06 3rd Qu.: 77.00 3rd Qu.:16.998
## Max. :45.45 Max. :100.00 Max. :56.997
## rentas_de_no_registrados rentas_de_registrados rentas_totales
## Min. : 0.00 Min. : 0.0 Min. : 1.0
## 1st Qu.: 4.00 1st Qu.: 36.0 1st Qu.: 42.0
## Median : 17.00 Median :118.0 Median :145.0
## Mean : 36.02 Mean :155.6 Mean :191.6
## 3rd Qu.: 49.00 3rd Qu.:222.0 3rd Qu.:284.0
## Max. :367.00 Max. :886.0 Max. :977.0
Observaciones
El departamento de renta de bicicletas, y el KPI es rentas.
Elaborar un modelo predictivo de rentas de bicicleta.
Elaborar una regresión para realizar un modelo predictivo para las rentas.
Mecadotecnia elaborará plan para aumentar las rentas de acuerdo al resultado del modelo predictivo.
plot(df$temperatura, df$rentas_totales, main = "Influencia de la temperatura sobre las rentas totales", xlab = "Temperatura (°C)", ylab = "Rentas totales", type = "p")
regresion <- lm(rentas_totales~ï..hora+dia+mes+aÃ.o+estacion+dia_de_la_semana+asueto+temperatura+sensacion_termica+humedad+velocidad_del_viento, data=df)
summary(regresion)
##
## Call:
## lm(formula = rentas_totales ~ ï..hora + dia + mes + aÃ.o + estacion +
## dia_de_la_semana + asueto + temperatura + sensacion_termica +
## humedad + velocidad_del_viento, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -305.52 -93.64 -27.70 61.85 649.10
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.661e+05 5.496e+03 -30.217 < 2e-16 ***
## ï..hora 7.735e+00 2.070e-01 37.368 < 2e-16 ***
## dia 3.844e-01 2.482e-01 1.549 0.12150
## mes 9.996e+00 1.682e+00 5.943 2.89e-09 ***
## aÃ.o 8.258e+01 2.732e+00 30.225 < 2e-16 ***
## estacion -7.774e+00 5.177e+00 -1.502 0.13324
## dia_de_la_semana 4.393e-01 6.918e-01 0.635 0.52545
## asueto -4.864e+00 8.365e+00 -0.582 0.56089
## temperatura 1.582e+00 1.038e+00 1.524 0.12752
## sensacion_termica 4.748e+00 9.552e-01 4.971 6.76e-07 ***
## humedad -2.115e+00 7.884e-02 -26.827 < 2e-16 ***
## velocidad_del_viento 5.582e-01 1.809e-01 3.086 0.00203 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 141.7 on 10874 degrees of freedom
## Multiple R-squared: 0.3891, Adjusted R-squared: 0.3885
## F-statistic: 629.6 on 11 and 10874 DF, p-value: < 2.2e-16
regresion <- lm(rentas_totales~ï..hora+mes+aÃ.o+sensacion_termica+humedad+velocidad_del_viento, data=df)
summary(regresion)
##
## Call:
## lm(formula = rentas_totales ~ ï..hora + mes + aÃ.o + sensacion_termica +
## humedad + velocidad_del_viento, data = df)
##
## Residuals:
## Min 1Q Median 3Q Max
## -308.60 -93.85 -28.34 61.05 648.09
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.662e+05 5.496e+03 -30.250 < 2e-16 ***
## ï..hora 7.734e+00 2.070e-01 37.364 < 2e-16 ***
## mes 7.574e+00 4.207e-01 18.002 < 2e-16 ***
## aÃ.o 8.266e+01 2.732e+00 30.258 < 2e-16 ***
## sensacion_termica 6.172e+00 1.689e-01 36.539 < 2e-16 ***
## humedad -2.121e+00 7.858e-02 -26.988 < 2e-16 ***
## velocidad_del_viento 6.208e-01 1.771e-01 3.506 0.000457 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 141.7 on 10879 degrees of freedom
## Multiple R-squared: 0.3886, Adjusted R-squared: 0.3883
## F-statistic: 1153 on 6 and 10879 DF, p-value: < 2.2e-16
datos_nuevos <- data.frame(ï..hora=12,mes=1:12,aÃ.o=2013,sensacion_termica=24,humedad=62,velocidad_del_viento=13)
datos_nuevos
## ï..hora mes aÃ.o sensacion_termica humedad velocidad_del_viento
## 1 12 1 2013 24 62 13
## 2 12 2 2013 24 62 13
## 3 12 3 2013 24 62 13
## 4 12 4 2013 24 62 13
## 5 12 5 2013 24 62 13
## 6 12 6 2013 24 62 13
## 7 12 7 2013 24 62 13
## 8 12 8 2013 24 62 13
## 9 12 9 2013 24 62 13
## 10 12 10 2013 24 62 13
## 11 12 11 2013 24 62 13
## 12 12 12 2013 24 62 13
predict(regresion,datos_nuevos)
## 1 2 3 4 5 6 7 8
## 279.1478 286.7215 294.2952 301.8690 309.4427 317.0164 324.5901 332.1638
## 9 10 11 12
## 339.7375 347.3112 354.8849 362.4587
library(janitor)
library(dplyr)
setwd("C:\\Users\\javaw\\OneDrive - Instituto Tecnologico y de Estudios Superiores de Monterrey\\7mo Semestre\\Modulo 3")
df2 <- read.csv("seguros.csv")
head(df2)
## ï..ClaimID TotalPaid TotalReserves TotalRecovery IndemnityPaid OtherPaid
## 1 777632 20.00 0 0 0.0 20.00
## 2 777646 0.00 0 0 0.0 0.00
## 3 777651 5407.32 0 0 2246.4 3160.92
## 4 777661 287.79 0 0 0.0 287.79
## 5 777666 234.89 0 0 0.0 234.89
## 6 777668 67.16 0 0 0.0 67.16
## TotalIncurredCost ClaimStatus IncidentDate
## 1 20.00 C 01-jul-99
## 2 0.00 C 01-jul-99
## 3 5407.32 C 02-jul-99
## 4 287.79 C 02-jul-99
## 5 234.89 C 02-jul-99
## 6 67.16 C 03-jul-99
## IncidentDescription
## 1 EE. States while going down the steps--EE foot slipped & she fell down to cement on ground--injurher rt. Knee, lt. Chest & side, cut lt. Arm
## 2 Neck, arm, wrist and neck... On going for 20 yrs, repetitive, performing ultrasound exam on patients. Repetitive motion/constant pushing combined
## 3 EE was removing items from freezer when items started to fall - EE had to get out of way of falling boxes- strained back
## 4 EE states the fumes from a truck caused her to getan upset stomach and headache.
## 5 EE. States while trying to assist resident to wheelchair-resident slid down to floor. EE felt pain in lt shoulder down her lt arm.
## 6 EE states while trying to restrain student--he placed himself in front of the pt. & pt. Made a quick motion injurying EE. Left forearm
## ReturnToWorkDate ClaimantOpenedDate ClaimantClosedDate
## 1 12-jul-99 31-mar-05
## 2 29-sep-05 22DEC2005
## 3 14-jul-99 31-mar-05
## 4 20-jul-99 17-jun-08
## 5 20AUG1999 31-mar-05
## 6 12-jul-99 15-jul-05
## EmployerNotificationDate ReceivedDate IsDenied Transaction_Time
## 1 01-jul-99 12-jul-99 0 2089
## 2 01-jul-99 29-sep-05 1 84
## 3 02-jul-99 13-jul-99 0 2087
## 4 02-jul-99 20-jul-99 0 3255
## 5 02-jul-99 19AUG1999 0 2050
## 6 03-jul-99 12-jul-99 0 2195
## Procesing_Time ClaimantAge_at_DOI Gender ClaimantType
## 1 11 49 Female Medical Only
## 2 2282 48 Female Indemnity
## 3 12 33 Female Indemnity
## 4 18 29 Female Medical Only
## 5 49 54 Female Medical Only
## 6 9 49 Male Medical Only
## InjuryNature BodyPartRegion
## 1 Laceration Multiple Body Parts
## 2 All Other Specific Injuries, Noc Multiple Body Parts
## 3 Strain Trunk
## 4 Respiratory Disorders Multiple Body Parts
## 5 Strain Multiple Body Parts
## 6 Strain Upper Extremities
## BodyPart
## 1 Multiple Body Parts (Including Body Systems and Body Parts)
## 2 Multiple Body Parts (Including Body Systems and Body Parts)
## 3 Lower Back Area
## 4 Multiple Body Parts (Including Body Systems and Body Parts)
## 5 Multiple Body Parts (Including Body Systems and Body Parts)
## 6 Lower Arm
## AverageWeeklyWage1 ClaimID1 BillReviewALE Hospital PhysicianOutpatient
## 1 491.965 777632 NA NA NA
## 2 673.080 777646 592.2 36341.95 41773.42
## 3 327.600 777651 NA 299.28 154.97
## 4 491.965 777661 NA NA 65.53
## 5 491.965 777666 NA NA 221.57
## 6 491.965 777668 NA NA 175.00
## Rx
## 1 50.29
## 2 3108.47
## 3 NA
## 4 NA
## 5 NA
## 6 NA
Es necesario tener los nombres de escritos de forma correcta y ordenada, esto para no confundirnos y escribirlos de forma correcta más adelante.
df2<-clean_names (df2)
colnames(df2)
## [1] "i_claim_id" "total_paid"
## [3] "total_reserves" "total_recovery"
## [5] "indemnity_paid" "other_paid"
## [7] "total_incurred_cost" "claim_status"
## [9] "incident_date" "incident_description"
## [11] "return_to_work_date" "claimant_opened_date"
## [13] "claimant_closed_date" "employer_notification_date"
## [15] "received_date" "is_denied"
## [17] "transaction_time" "procesing_time"
## [19] "claimant_age_at_doi" "gender"
## [21] "claimant_type" "injury_nature"
## [23] "body_part_region" "body_part"
## [25] "average_weekly_wage1" "claim_id1"
## [27] "bill_review_ale" "hospital"
## [29] "physician_outpatient" "rx"
count (df2, incident_description, sort = TRUE)
count (df2, claimant_type, sort = TRUE)
count (df2, injury_nature , sort = TRUE)
count (df2, body_part_region ,sort = TRUE)
count (df2, body_part ,sort = TRUE)
count (df2, average_weekly_wage1 ,sort = TRUE)
resumen2 <- summary(df2)
resumen2
## i_claim_id total_paid total_reserves total_recovery
## Min. : 777632 Min. : 0 Min. : 0 Min. : 0.00
## 1st Qu.: 800748 1st Qu.: 83 1st Qu.: 0 1st Qu.: 0.00
## Median : 812128 Median : 271 Median : 0 Median : 0.00
## Mean : 1864676 Mean : 10404 Mean : 3368 Mean : 66.05
## 3rd Qu.: 824726 3rd Qu.: 1122 3rd Qu.: 0 3rd Qu.: 0.00
## Max. :62203364 Max. :4527291 Max. :1529053 Max. :100000.00
##
## indemnity_paid other_paid total_incurred_cost claim_status
## Min. : 0 Min. : 0 Min. : -10400 Length:31619
## 1st Qu.: 0 1st Qu.: 80 1st Qu.: 80 Class :character
## Median : 0 Median : 265 Median : 266 Mode :character
## Mean : 4977 Mean : 5427 Mean : 13706
## 3rd Qu.: 0 3rd Qu.: 1023 3rd Qu.: 1098
## Max. :640732 Max. :4129915 Max. :4734750
##
## incident_date incident_description return_to_work_date
## Length:31619 Length:31619 Length:31619
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
## claimant_opened_date claimant_closed_date employer_notification_date
## Length:31619 Length:31619 Length:31619
## Class :character Class :character Class :character
## Mode :character Mode :character Mode :character
##
##
##
##
## received_date is_denied transaction_time procesing_time
## Length:31619 Min. :0.00000 Min. : 0 Min. : 0.00
## Class :character 1st Qu.:0.00000 1st Qu.: 211 1st Qu.: 4.00
## Mode :character Median :0.00000 Median : 780 Median : 10.00
## Mean :0.04463 Mean : 1004 Mean : 62.99
## 3rd Qu.:0.00000 3rd Qu.: 1440 3rd Qu.: 24.00
## Max. :1.00000 Max. :16428 Max. :11558.00
## NA's :614
## claimant_age_at_doi gender claimant_type injury_nature
## Min. :14.0 Length:31619 Length:31619 Length:31619
## 1st Qu.:33.0 Class :character Class :character Class :character
## Median :42.0 Mode :character Mode :character Mode :character
## Mean :41.6
## 3rd Qu.:50.0
## Max. :94.0
##
## body_part_region body_part average_weekly_wage1 claim_id1
## Length:31619 Length:31619 Min. : 100.0 Min. : 777632
## Class :character Class :character 1st Qu.: 492.0 1st Qu.: 800748
## Mode :character Mode :character Median : 492.0 Median : 812128
## Mean : 536.5 Mean : 1864676
## 3rd Qu.: 492.0 3rd Qu.: 824726
## Max. :8613.5 Max. :62203364
##
## bill_review_ale hospital physician_outpatient rx
## Min. : -448.0 Min. : -12570.4 Min. : -549.5 Min. : -160.7
## 1st Qu.: 16.0 1st Qu.: 210.5 1st Qu.: 105.8 1st Qu.: 22.9
## Median : 24.0 Median : 613.9 Median : 218.0 Median : 61.5
## Mean : 188.7 Mean : 5113.2 Mean : 1813.2 Mean : 1695.2
## 3rd Qu.: 64.1 3rd Qu.: 2349.1 3rd Qu.: 680.6 3rd Qu.: 189.0
## Max. :46055.3 Max. :2759604.0 Max. :1219766.6 Max. :631635.5
## NA's :14912 NA's :19655 NA's :2329 NA's :20730
El departamento de costos, y el KPI es costo incurrido.
Elaborar un modelo predictivo del costo incurrido de acuerdo al tipo de lesión.
Elaborar una regresión para realizar un modelo predictivo para el costo incurrido.
El departamento de costos, de acuerdo a los resultados de la regresión y el modelo predictivo, buscaran ajustar la tasa de la aseguradora.
regresion2 <- lm (total_incurred_cost ~ claimant_age_at_doi + gender + claimant_type + injury_nature + body_part_region + body_part + average_weekly_wage1 , data=df2)
summary (regresion2)
##
## Call:
## lm(formula = total_incurred_cost ~ claimant_age_at_doi + gender +
## claimant_type + injury_nature + body_part_region + body_part +
## average_weekly_wage1, data = df2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -477362 -12697 -550 5168 4673472
##
## Coefficients: (6 not defined because of singularities)
## Estimate
## (Intercept) -2.378e+04
## claimant_age_at_doi 1.562e+02
## genderMale 1.284e+03
## genderNot Available 6.689e+04
## claimant_typeMedical Only -5.558e+04
## claimant_typeReport Only -5.011e+04
## injury_natureAll Other Specific Injuries, Noc 5.673e+04
## injury_natureAmputation 3.981e+04
## injury_natureAngina Pectoris -3.435e+03
## injury_natureAsbestosis 6.414e+04
## injury_natureAsphyxiation 6.103e+04
## injury_natureBlack Lung 6.015e+04
## injury_natureBurn 5.822e+04
## injury_natureCancer 6.751e+04
## injury_natureCarpal Tunnel Syndrome 3.969e+04
## injury_natureConcussion 8.513e+04
## injury_natureContagious Disease 7.377e+04
## injury_natureContusion 5.310e+04
## injury_natureCrushing 5.680e+04
## injury_natureDermatitis 5.106e+04
## injury_natureDislocation 3.829e+04
## injury_natureDust Disease, NOC 5.988e+04
## injury_natureElectric Shock 6.393e+04
## injury_natureForeign Body 5.245e+04
## injury_natureFracture 5.006e+04
## injury_natureFreezing 4.739e+04
## injury_natureHearing Loss Or Impairment 4.654e+04
## injury_natureHeat Prostration 4.574e+04
## injury_natureHernia 2.304e+04
## injury_natureInfection 4.686e+04
## injury_natureInflammation 6.115e+04
## injury_natureLaceration 5.288e+04
## injury_natureLoss of Hearing 4.266e+04
## injury_natureMental Disorder -3.827e+04
## injury_natureMental Stress 5.016e+04
## injury_natureMultiple Injuries Including Both Physical and Psychological 3.957e+04
## injury_natureMultiple Physical Injuries Only 5.938e+04
## injury_natureMyocardial Infarction 3.203e+04
## injury_natureNo Physical Injury 4.793e+04
## injury_natureNon-Standard Code 3.735e+04
## injury_natureNot Available 5.287e+04
## injury_naturePoisoning?Chemical (Other Than Metals) 5.778e+04
## injury_naturePoisoning?General (NOT OD or Cumulative Injury) 4.645e+04
## injury_naturePuncture 5.340e+04
## injury_natureRadiation 5.488e+04
## injury_natureRespiratory Disorders 5.089e+04
## injury_natureRupture 6.257e+04
## injury_natureSeverance 8.690e+04
## injury_natureSprain 5.235e+04
## injury_natureStrain 4.740e+04
## injury_natureSyncope 4.655e+04
## injury_natureVascular 2.162e+02
## injury_natureVDT-Related Disease 6.035e+02
## injury_natureVision Loss 5.446e+04
## body_part_regionLower Extremities 1.748e+04
## body_part_regionMultiple Body Parts 2.913e+05
## body_part_regionNeck 5.097e+04
## body_part_regionNon-Standard Code 5.759e+03
## body_part_regionTrunk 8.666e+03
## body_part_regionUpper Extremities 1.304e+04
## body_partAnkle -6.760e+03
## body_partArtificial Appliance -2.843e+05
## body_partBody Systems and Multiple Body Systems -2.765e+05
## body_partBrain 4.126e+05
## body_partButtocks 1.879e+04
## body_partChest 3.892e+03
## body_partDisc-Trunk 1.761e+04
## body_partEar(S) 1.043e+04
## body_partElbow -1.760e+02
## body_partEyes 1.369e+04
## body_partFacial Bones 1.372e+04
## body_partFinger(S) -2.799e+03
## body_partFoot -8.480e+03
## body_partGreat Toe -8.733e+03
## body_partHand -2.864e+03
## body_partHeart 6.144e+03
## body_partHip 6.854e+03
## body_partInsufficient Info to Properly Identify?Unclassified -2.826e+05
## body_partInternal Organs 1.228e+04
## body_partKnee -1.194e+03
## body_partLarynx -8.529e+04
## body_partLower Arm -2.674e+03
## body_partLower Back Area 2.532e+04
## body_partLower Leg -5.612e+01
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 1.772e+04
## body_partLungs -4.964e+02
## body_partMouth 1.350e+04
## body_partMultiple Body Parts (Including Body Systems and Body Parts) -2.711e+05
## body_partMultiple Head Injury 1.652e+04
## body_partMultiple Lower Extremities 1.911e+03
## body_partMultiple Neck Injury -3.185e+04
## body_partMultiple Trunk 6.008e+03
## body_partMultiple Upper Extremities 4.154e+03
## body_partNo Physical Injury -2.756e+05
## body_partNon-Standard Code NA
## body_partNose 9.839e+03
## body_partPelvis 7.507e+02
## body_partSacrum And Coccyx 1.936e+04
## body_partShoulder(S) 6.654e+03
## body_partSkull 4.699e+04
## body_partSoft Tissue-Head -1.759e+04
## body_partSoft Tissue-Neck -1.805e+04
## body_partSpinal Cord-Trunk 9.208e+04
## body_partTeeth NA
## body_partThumb -2.801e+03
## body_partToes -8.322e+03
## body_partTrachea -5.600e+04
## body_partUpper Arm 3.218e+03
## body_partUpper Back Area 6.851e+03
## body_partUpper Leg NA
## body_partVertebrae NA
## body_partWhole Body NA
## body_partWrist NA
## average_weekly_wage1 8.033e+00
## Std. Error
## (Intercept) 8.063e+04
## claimant_age_at_doi 4.036e+01
## genderMale 9.244e+02
## genderNot Available 8.412e+03
## claimant_typeMedical Only 1.152e+03
## claimant_typeReport Only 2.596e+03
## injury_natureAll Other Specific Injuries, Noc 8.019e+04
## injury_natureAmputation 8.502e+04
## injury_natureAngina Pectoris 9.965e+04
## injury_natureAsbestosis 8.190e+04
## injury_natureAsphyxiation 1.134e+05
## injury_natureBlack Lung 1.134e+05
## injury_natureBurn 8.029e+04
## injury_natureCancer 8.962e+04
## injury_natureCarpal Tunnel Syndrome 8.036e+04
## injury_natureConcussion 8.056e+04
## injury_natureContagious Disease 8.067e+04
## injury_natureContusion 8.018e+04
## injury_natureCrushing 8.045e+04
## injury_natureDermatitis 8.026e+04
## injury_natureDislocation 8.043e+04
## injury_natureDust Disease, NOC 9.279e+04
## injury_natureElectric Shock 8.116e+04
## injury_natureForeign Body 8.024e+04
## injury_natureFracture 8.022e+04
## injury_natureFreezing 9.252e+04
## injury_natureHearing Loss Or Impairment 8.260e+04
## injury_natureHeat Prostration 8.102e+04
## injury_natureHernia 8.088e+04
## injury_natureInfection 8.057e+04
## injury_natureInflammation 8.029e+04
## injury_natureLaceration 8.019e+04
## injury_natureLoss of Hearing 8.309e+04
## injury_natureMental Disorder 8.799e+04
## injury_natureMental Stress 8.077e+04
## injury_natureMultiple Injuries Including Both Physical and Psychological 8.279e+04
## injury_natureMultiple Physical Injuries Only 8.025e+04
## injury_natureMyocardial Infarction 8.664e+04
## injury_natureNo Physical Injury 8.011e+04
## injury_natureNon-Standard Code 8.082e+04
## injury_natureNot Available 1.133e+05
## injury_naturePoisoning?Chemical (Other Than Metals) 8.081e+04
## injury_naturePoisoning?General (NOT OD or Cumulative Injury) 8.261e+04
## injury_naturePuncture 8.020e+04
## injury_natureRadiation 8.297e+04
## injury_natureRespiratory Disorders 8.038e+04
## injury_natureRupture 8.119e+04
## injury_natureSeverance 8.321e+04
## injury_natureSprain 8.019e+04
## injury_natureStrain 8.018e+04
## injury_natureSyncope 8.093e+04
## injury_natureVascular 1.132e+05
## injury_natureVDT-Related Disease 1.133e+05
## injury_natureVision Loss 8.347e+04
## body_part_regionLower Extremities 9.834e+03
## body_part_regionMultiple Body Parts 3.140e+04
## body_part_regionNeck 4.088e+04
## body_part_regionNon-Standard Code 1.367e+04
## body_part_regionTrunk 9.718e+03
## body_part_regionUpper Extremities 8.743e+03
## body_partAnkle 5.588e+03
## body_partArtificial Appliance 4.685e+04
## body_partBody Systems and Multiple Body Systems 3.117e+04
## body_partBrain 3.768e+04
## body_partButtocks 9.258e+03
## body_partChest 5.913e+03
## body_partDisc-Trunk 7.302e+03
## body_partEar(S) 1.227e+04
## body_partElbow 4.234e+03
## body_partEyes 8.927e+03
## body_partFacial Bones 9.857e+03
## body_partFinger(S) 2.933e+03
## body_partFoot 5.699e+03
## body_partGreat Toe 1.081e+04
## body_partHand 2.960e+03
## body_partHeart 3.530e+04
## body_partHip 6.760e+03
## body_partInsufficient Info to Properly Identify?Unclassified 3.066e+04
## body_partInternal Organs 1.275e+04
## body_partKnee 5.259e+03
## body_partLarynx 8.940e+04
## body_partLower Arm 3.719e+03
## body_partLower Back Area 4.984e+03
## body_partLower Leg 5.884e+03
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 5.937e+03
## body_partLungs 9.118e+03
## body_partMouth 1.054e+04
## body_partMultiple Body Parts (Including Body Systems and Body Parts) 3.026e+04
## body_partMultiple Head Injury 8.836e+03
## body_partMultiple Lower Extremities 6.542e+03
## body_partMultiple Neck Injury 4.016e+04
## body_partMultiple Trunk 1.184e+04
## body_partMultiple Upper Extremities 4.255e+03
## body_partNo Physical Injury 3.086e+04
## body_partNon-Standard Code NA
## body_partNose 1.060e+04
## body_partPelvis 1.139e+04
## body_partSacrum And Coccyx 1.612e+04
## body_partShoulder(S) 3.078e+03
## body_partSkull 1.638e+04
## body_partSoft Tissue-Head 8.066e+04
## body_partSoft Tissue-Neck 4.032e+04
## body_partSpinal Cord-Trunk 1.418e+04
## body_partTeeth NA
## body_partThumb 3.799e+03
## body_partToes 7.792e+03
## body_partTrachea 5.036e+04
## body_partUpper Arm 4.484e+03
## body_partUpper Back Area 6.937e+03
## body_partUpper Leg NA
## body_partVertebrae NA
## body_partWhole Body NA
## body_partWrist NA
## average_weekly_wage1 2.081e+00
## t value
## (Intercept) -0.295
## claimant_age_at_doi 3.871
## genderMale 1.389
## genderNot Available 7.952
## claimant_typeMedical Only -48.261
## claimant_typeReport Only -19.300
## injury_natureAll Other Specific Injuries, Noc 0.707
## injury_natureAmputation 0.468
## injury_natureAngina Pectoris -0.034
## injury_natureAsbestosis 0.783
## injury_natureAsphyxiation 0.538
## injury_natureBlack Lung 0.530
## injury_natureBurn 0.725
## injury_natureCancer 0.753
## injury_natureCarpal Tunnel Syndrome 0.494
## injury_natureConcussion 1.057
## injury_natureContagious Disease 0.915
## injury_natureContusion 0.662
## injury_natureCrushing 0.706
## injury_natureDermatitis 0.636
## injury_natureDislocation 0.476
## injury_natureDust Disease, NOC 0.645
## injury_natureElectric Shock 0.788
## injury_natureForeign Body 0.654
## injury_natureFracture 0.624
## injury_natureFreezing 0.512
## injury_natureHearing Loss Or Impairment 0.563
## injury_natureHeat Prostration 0.565
## injury_natureHernia 0.285
## injury_natureInfection 0.582
## injury_natureInflammation 0.762
## injury_natureLaceration 0.659
## injury_natureLoss of Hearing 0.513
## injury_natureMental Disorder -0.435
## injury_natureMental Stress 0.621
## injury_natureMultiple Injuries Including Both Physical and Psychological 0.478
## injury_natureMultiple Physical Injuries Only 0.740
## injury_natureMyocardial Infarction 0.370
## injury_natureNo Physical Injury 0.598
## injury_natureNon-Standard Code 0.462
## injury_natureNot Available 0.467
## injury_naturePoisoning?Chemical (Other Than Metals) 0.715
## injury_naturePoisoning?General (NOT OD or Cumulative Injury) 0.562
## injury_naturePuncture 0.666
## injury_natureRadiation 0.661
## injury_natureRespiratory Disorders 0.633
## injury_natureRupture 0.771
## injury_natureSeverance 1.044
## injury_natureSprain 0.653
## injury_natureStrain 0.591
## injury_natureSyncope 0.575
## injury_natureVascular 0.002
## injury_natureVDT-Related Disease 0.005
## injury_natureVision Loss 0.652
## body_part_regionLower Extremities 1.778
## body_part_regionMultiple Body Parts 9.277
## body_part_regionNeck 1.247
## body_part_regionNon-Standard Code 0.421
## body_part_regionTrunk 0.892
## body_part_regionUpper Extremities 1.491
## body_partAnkle -1.210
## body_partArtificial Appliance -6.068
## body_partBody Systems and Multiple Body Systems -8.871
## body_partBrain 10.951
## body_partButtocks 2.030
## body_partChest 0.658
## body_partDisc-Trunk 2.412
## body_partEar(S) 0.850
## body_partElbow -0.042
## body_partEyes 1.534
## body_partFacial Bones 1.392
## body_partFinger(S) -0.954
## body_partFoot -1.488
## body_partGreat Toe -0.808
## body_partHand -0.967
## body_partHeart 0.174
## body_partHip 1.014
## body_partInsufficient Info to Properly Identify?Unclassified -9.218
## body_partInternal Organs 0.964
## body_partKnee -0.227
## body_partLarynx -0.954
## body_partLower Arm -0.719
## body_partLower Back Area 5.080
## body_partLower Leg -0.010
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 2.985
## body_partLungs -0.054
## body_partMouth 1.281
## body_partMultiple Body Parts (Including Body Systems and Body Parts) -8.957
## body_partMultiple Head Injury 1.869
## body_partMultiple Lower Extremities 0.292
## body_partMultiple Neck Injury -0.793
## body_partMultiple Trunk 0.508
## body_partMultiple Upper Extremities 0.976
## body_partNo Physical Injury -8.930
## body_partNon-Standard Code NA
## body_partNose 0.929
## body_partPelvis 0.066
## body_partSacrum And Coccyx 1.201
## body_partShoulder(S) 2.162
## body_partSkull 2.868
## body_partSoft Tissue-Head -0.218
## body_partSoft Tissue-Neck -0.448
## body_partSpinal Cord-Trunk 6.495
## body_partTeeth NA
## body_partThumb -0.737
## body_partToes -1.068
## body_partTrachea -1.112
## body_partUpper Arm 0.718
## body_partUpper Back Area 0.988
## body_partUpper Leg NA
## body_partVertebrae NA
## body_partWhole Body NA
## body_partWrist NA
## average_weekly_wage1 3.860
## Pr(>|t|)
## (Intercept) 0.768018
## claimant_age_at_doi 0.000109
## genderMale 0.164980
## genderNot Available 1.90e-15
## claimant_typeMedical Only < 2e-16
## claimant_typeReport Only < 2e-16
## injury_natureAll Other Specific Injuries, Noc 0.479316
## injury_natureAmputation 0.639614
## injury_natureAngina Pectoris 0.972499
## injury_natureAsbestosis 0.433548
## injury_natureAsphyxiation 0.590606
## injury_natureBlack Lung 0.595936
## injury_natureBurn 0.468425
## injury_natureCancer 0.451230
## injury_natureCarpal Tunnel Syndrome 0.621353
## injury_natureConcussion 0.290675
## injury_natureContagious Disease 0.360437
## injury_natureContusion 0.507791
## injury_natureCrushing 0.480165
## injury_natureDermatitis 0.524685
## injury_natureDislocation 0.634034
## injury_natureDust Disease, NOC 0.518712
## injury_natureElectric Shock 0.430906
## injury_natureForeign Body 0.513297
## injury_natureFracture 0.532576
## injury_natureFreezing 0.608538
## injury_natureHearing Loss Or Impairment 0.573195
## injury_natureHeat Prostration 0.572386
## injury_natureHernia 0.775742
## injury_natureInfection 0.560845
## injury_natureInflammation 0.446283
## injury_natureLaceration 0.509641
## injury_natureLoss of Hearing 0.607631
## injury_natureMental Disorder 0.663656
## injury_natureMental Stress 0.534599
## injury_natureMultiple Injuries Including Both Physical and Psychological 0.632666
## injury_natureMultiple Physical Injuries Only 0.459316
## injury_natureMyocardial Infarction 0.711606
## injury_natureNo Physical Injury 0.549606
## injury_natureNon-Standard Code 0.643982
## injury_natureNot Available 0.640612
## injury_naturePoisoning?Chemical (Other Than Metals) 0.474557
## injury_naturePoisoning?General (NOT OD or Cumulative Injury) 0.573890
## injury_naturePuncture 0.505543
## injury_natureRadiation 0.508337
## injury_natureRespiratory Disorders 0.526623
## injury_natureRupture 0.440943
## injury_natureSeverance 0.296341
## injury_natureSprain 0.513860
## injury_natureStrain 0.554392
## injury_natureSyncope 0.565167
## injury_natureVascular 0.998477
## injury_natureVDT-Related Disease 0.995749
## injury_natureVision Loss 0.514091
## body_part_regionLower Extremities 0.075477
## body_part_regionMultiple Body Parts < 2e-16
## body_part_regionNeck 0.212527
## body_part_regionNon-Standard Code 0.673656
## body_part_regionTrunk 0.372556
## body_part_regionUpper Extremities 0.135999
## body_partAnkle 0.226456
## body_partArtificial Appliance 1.31e-09
## body_partBody Systems and Multiple Body Systems < 2e-16
## body_partBrain < 2e-16
## body_partButtocks 0.042366
## body_partChest 0.510385
## body_partDisc-Trunk 0.015884
## body_partEar(S) 0.395371
## body_partElbow 0.966846
## body_partEyes 0.125140
## body_partFacial Bones 0.164062
## body_partFinger(S) 0.339968
## body_partFoot 0.136747
## body_partGreat Toe 0.419364
## body_partHand 0.333304
## body_partHeart 0.861813
## body_partHip 0.310615
## body_partInsufficient Info to Properly Identify?Unclassified < 2e-16
## body_partInternal Organs 0.335180
## body_partKnee 0.820407
## body_partLarynx 0.340075
## body_partLower Arm 0.472158
## body_partLower Back Area 3.80e-07
## body_partLower Leg 0.992390
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) 0.002835
## body_partLungs 0.956579
## body_partMouth 0.200318
## body_partMultiple Body Parts (Including Body Systems and Body Parts) < 2e-16
## body_partMultiple Head Injury 0.061608
## body_partMultiple Lower Extremities 0.770137
## body_partMultiple Neck Injury 0.427779
## body_partMultiple Trunk 0.611717
## body_partMultiple Upper Extremities 0.328914
## body_partNo Physical Injury < 2e-16
## body_partNon-Standard Code NA
## body_partNose 0.353155
## body_partPelvis 0.947456
## body_partSacrum And Coccyx 0.229765
## body_partShoulder(S) 0.030656
## body_partSkull 0.004132
## body_partSoft Tissue-Head 0.827415
## body_partSoft Tissue-Neck 0.654345
## body_partSpinal Cord-Trunk 8.40e-11
## body_partTeeth NA
## body_partThumb 0.460854
## body_partToes 0.285566
## body_partTrachea 0.266149
## body_partUpper Arm 0.472978
## body_partUpper Back Area 0.323337
## body_partUpper Leg NA
## body_partVertebrae NA
## body_partWhole Body NA
## body_partWrist NA
## average_weekly_wage1 0.000114
##
## (Intercept)
## claimant_age_at_doi ***
## genderMale
## genderNot Available ***
## claimant_typeMedical Only ***
## claimant_typeReport Only ***
## injury_natureAll Other Specific Injuries, Noc
## injury_natureAmputation
## injury_natureAngina Pectoris
## injury_natureAsbestosis
## injury_natureAsphyxiation
## injury_natureBlack Lung
## injury_natureBurn
## injury_natureCancer
## injury_natureCarpal Tunnel Syndrome
## injury_natureConcussion
## injury_natureContagious Disease
## injury_natureContusion
## injury_natureCrushing
## injury_natureDermatitis
## injury_natureDislocation
## injury_natureDust Disease, NOC
## injury_natureElectric Shock
## injury_natureForeign Body
## injury_natureFracture
## injury_natureFreezing
## injury_natureHearing Loss Or Impairment
## injury_natureHeat Prostration
## injury_natureHernia
## injury_natureInfection
## injury_natureInflammation
## injury_natureLaceration
## injury_natureLoss of Hearing
## injury_natureMental Disorder
## injury_natureMental Stress
## injury_natureMultiple Injuries Including Both Physical and Psychological
## injury_natureMultiple Physical Injuries Only
## injury_natureMyocardial Infarction
## injury_natureNo Physical Injury
## injury_natureNon-Standard Code
## injury_natureNot Available
## injury_naturePoisoning?Chemical (Other Than Metals)
## injury_naturePoisoning?General (NOT OD or Cumulative Injury)
## injury_naturePuncture
## injury_natureRadiation
## injury_natureRespiratory Disorders
## injury_natureRupture
## injury_natureSeverance
## injury_natureSprain
## injury_natureStrain
## injury_natureSyncope
## injury_natureVascular
## injury_natureVDT-Related Disease
## injury_natureVision Loss
## body_part_regionLower Extremities .
## body_part_regionMultiple Body Parts ***
## body_part_regionNeck
## body_part_regionNon-Standard Code
## body_part_regionTrunk
## body_part_regionUpper Extremities
## body_partAnkle
## body_partArtificial Appliance ***
## body_partBody Systems and Multiple Body Systems ***
## body_partBrain ***
## body_partButtocks *
## body_partChest
## body_partDisc-Trunk *
## body_partEar(S)
## body_partElbow
## body_partEyes
## body_partFacial Bones
## body_partFinger(S)
## body_partFoot
## body_partGreat Toe
## body_partHand
## body_partHeart
## body_partHip
## body_partInsufficient Info to Properly Identify?Unclassified ***
## body_partInternal Organs
## body_partKnee
## body_partLarynx
## body_partLower Arm
## body_partLower Back Area ***
## body_partLower Leg
## body_partLumbar and/or Sacral Vertebrae (Vertebra NOC Trunk) **
## body_partLungs
## body_partMouth
## body_partMultiple Body Parts (Including Body Systems and Body Parts) ***
## body_partMultiple Head Injury .
## body_partMultiple Lower Extremities
## body_partMultiple Neck Injury
## body_partMultiple Trunk
## body_partMultiple Upper Extremities
## body_partNo Physical Injury ***
## body_partNon-Standard Code
## body_partNose
## body_partPelvis
## body_partSacrum And Coccyx
## body_partShoulder(S) *
## body_partSkull **
## body_partSoft Tissue-Head
## body_partSoft Tissue-Neck
## body_partSpinal Cord-Trunk ***
## body_partTeeth
## body_partThumb
## body_partToes
## body_partTrachea
## body_partUpper Arm
## body_partUpper Back Area
## body_partUpper Leg
## body_partVertebrae
## body_partWhole Body
## body_partWrist
## average_weekly_wage1 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 79930 on 31511 degrees of freedom
## Multiple R-squared: 0.1034, Adjusted R-squared: 0.1004
## F-statistic: 33.98 on 107 and 31511 DF, p-value: < 2.2e-16
Las variables que posen asteriscos (*) son las que tienen mayor nivel de significanza en el modelo, por lo tanto, son las variables que debemos usar para la predicción.
Decidimos calcular el Total Incurred Cost con 7 de las variables más relevantes que nos mostró la regresión lineal, junto con diferentes edades de los pacientes.
datos_nuevos2 <- data.frame (claimant_age_at_doi = c(20,30,40,50,60,70,80,90), gender= "Male", claimant_type = "Medical Only" , injury_nature = "Amputation", body_part_region = "Multiple Body Parts", body_part = "Brain" , average_weekly_wage1= 537)
predict (regresion2,datos_nuevos2)
## Warning in predict.lm(regresion2, datos_nuevos2): prediction from a rank-
## deficient fit may be misleading
## 1 2 3 4 5 6 7 8
## 673115.3 674677.3 676239.3 677801.3 679363.3 680925.3 682487.3 684049.4
Tanto el caso de renta de bicicletas como el de seguros buscan predecir futuros comportamientos de específicas variables para impactar en los negocios. Los modelos predictivos permiten a las organizaciones emprender acciones antes de que el resultado se de, permiten que se pueda prevenir e inclusive actuar de mejor manera ante diversos escenarios.