Insurance and its price fluctuations based on gender.

This project will look at how gender and other variables affect the cost of insurance charges by looking at how adding and removing certain controls effect the models outcome to attept to answer how gender affects insurance charges.

This notebook uses tidyverse for graphing and general R commands, dplyr for data manipulation, ggplot2 for graphing and data visualizations, and modelr for creating statistical models and their summarys.

library(tidyverse)
library(dplyr)
library(ggplot2)
library(modelr)

Here we aquire and read in the insurance data set with the readr library

library(readr)
insurance <- read_csv("C:/Users/Admin/Downloads/insurance.csv")
#View(insurance)

This model uses the insurance data set for all models and visualzations. It can be sourced here https://www.kaggle.com/datasets/mirichoi0218/insurance for more inofrmation and to see the entire data set yourself.

Below I list the frist 10 entires of the data set becuase of its size I have limited it to just the first 10 entires.

slice(insurance, 1:10)

Here we have our 7 main variables and a total of 1,338 entries

Age repersents the persons age in years

Sex either male or female

BMI their BMI

Children is the number of children they have

Smoker is if they smoke either yes or no

Region either southwest, southeast, Northeast, or Northwest

Charges is their insurance charges

Here we compare the average cost for insurance charges of men and women to see how they compare.

mean_charges_male <- mean(insurance$charges[insurance$sex == "male"], na.rm = TRUE)
mean_charges_female <- mean(insurance$charges[insurance$sex == "female"], na.rm = TRUE)

cat("Average insurance charges for men:", mean_charges_male, "\n")
Average insurance charges for men: 13956.75 
cat("Average insurance charges for women:", mean_charges_female, "\n")
Average insurance charges for women: 12569.58 
ggplot(insurance, aes(x = sex, y = charges, fill = sex)) +
  stat_summary(fun = mean, geom = "bar") +
  labs(title = "Average Insurance Charges by Gender", x = "Gender", y = "Average Charges")

On average as shown by the bar graph and the averages of the calculated data men are charged more for insurance then women are. So it fair to conclude men are charged more.

insurance_result <- lm(charges ~ sex, data = insurance)

summary(insurance_result)

Call:
lm(formula = charges ~ sex, data = insurance)

Residuals:
   Min     1Q Median     3Q    Max 
-12835  -8435  -3980   3476  51201 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  12569.6      470.1  26.740   <2e-16 ***
sexmale       1387.2      661.3   2.098   0.0361 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 12090 on 1336 degrees of freedom
Multiple R-squared:  0.003282,  Adjusted R-squared:  0.002536 
F-statistic:   4.4 on 1 and 1336 DF,  p-value: 0.03613

When we look at the both the P value which is .0358 and the confidence interval we can see the picture here is that there is a significant difference between the prices of male and female insurance and appears that males are charged more for insurance. Here we can also see that by being male we get an increase by $1387.2 showing that based on our model being a male does increase the insurance charges. But at a .03% P value it is pretty close to the cut off of 5%

The R Squared value is very small so while there is statistical evidence that shows significance that there is a large difference in charges for each gender, gender might not be the sol reason for the large differences and seems to explain only a small portion of the difference. We should take into account that men in the set could be older on average than women this could be skewing the data by making it seem like gender is having a bigger effect then what it really is becuase age also has an effect on the charges as most insurance companies use age based pricing and this effect might be attributed to the difference in gender.

So to further test the effects of age on pricing of insurance we will rebuild the model to control for age.

model_with_age <- lm(charges ~ sex + age, data = insurance)

summary(model_with_age)

Call:
lm(formula = charges ~ sex + age, data = insurance)

Residuals:
   Min     1Q Median     3Q    Max 
 -8821  -6947  -5511   5443  48203 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  2343.62     994.35   2.357   0.0186 *  
sexmale      1538.83     631.08   2.438   0.0149 *  
age           258.87      22.47  11.523   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 11540 on 1335 degrees of freedom
Multiple R-squared:  0.09344,   Adjusted R-squared:  0.09209 
F-statistic:  68.8 on 2 and 1335 DF,  p-value: < 2.2e-16

The things to pay attention to here are the new age P-value and intercepts. Here we see that as age goes up by a year the costs of insurance increases by $258.87 we also see age has a small P value. This shows that while sex still has a statistical significant impact on insurance charges your age also has a statistical significant impact on your pricing. Also notice our R squared value went down slightly which helps the covidence and the model.

While we have the statistical data to show that both gender and age have an effect in your insurance pricing there is still some uncertainty that remains unexplained such as past health diagnosis’s or life style choices like smoking or high risk jobs. Also our low R squared value leaves some uncertainty about if our model is over simplified or that our data could be bias such as chronic illnesses or life choices such as smoking.

This model adds on controls for both if they smoke and their BMI

model_with_age <- lm(charges ~ sex + age + smoker + bmi, data = insurance)

summary(model_with_age)

Call:
lm(formula = charges ~ sex + age + smoker + bmi, data = insurance)

Residuals:
     Min       1Q   Median       3Q      Max 
-12364.7  -2972.2   -983.2   1475.8  29018.3 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -11633.49     947.27 -12.281   <2e-16 ***
sexmale       -109.04     334.66  -0.326    0.745    
age            259.45      11.94  21.727   <2e-16 ***
smokeryes    23833.87     414.19  57.544   <2e-16 ***
bmi            323.05      27.53  11.735   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 6094 on 1333 degrees of freedom
Multiple R-squared:  0.7475,    Adjusted R-squared:  0.7467 
F-statistic: 986.5 on 4 and 1333 DF,  p-value: < 2.2e-16

This model further improves on what we had but changes how we look at the data. Adding on smokers and bmi has now changed how we look at gender before being male increased our insurances cost but now we see its now -109.04 lowering it. we also see now that age BMI and if they smoke are all statistically significant means that what we originally attributed to if someone was male vs female was not the case and that our other three variables better show these are the things that significantly impact the insurance costs. We can see that just starting to smoke increases your insurances charges on average by $23833.87 which is a huge amount of money to increase by for a single variable. Our BMI also affects it significantly with each increase in BMI it costs almost 323.05 dollars. Here we also have to see our RSE was almost cut in half which is a big step towrds improving the the fit and confidence in the model.

I believe at this point the data is very trust worthy. However; there are still outside variables and possible even bias built into the data which cannot really be accounted for, but this is the case with all data and based off the data set we have we seem to have a accurate picture of what causes the insurance prices to go up or down.

This model addes in the controls for our last two variables region and chlidren to test if any are statistically significant.

model_with_health <- lm(charges ~ sex + age + smoker + bmi + children + region, data = insurance)

summary(model_with_health)

Call:
lm(formula = charges ~ sex + age + smoker + bmi + children + 
    region, data = insurance)

Residuals:
     Min       1Q   Median       3Q      Max 
-11304.9  -2848.1   -982.1   1393.9  29992.8 

Coefficients:
                Estimate Std. Error t value Pr(>|t|)    
(Intercept)     -11938.5      987.8 -12.086  < 2e-16 ***
sexmale           -131.3      332.9  -0.394 0.693348    
age                256.9       11.9  21.587  < 2e-16 ***
smokeryes        23848.5      413.1  57.723  < 2e-16 ***
bmi                339.2       28.6  11.860  < 2e-16 ***
children           475.5      137.8   3.451 0.000577 ***
regionnorthwest   -353.0      476.3  -0.741 0.458769    
regionsoutheast  -1035.0      478.7  -2.162 0.030782 *  
regionsouthwest   -960.0      477.9  -2.009 0.044765 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 6062 on 1329 degrees of freedom
Multiple R-squared:  0.7509,    Adjusted R-squared:  0.7494 
F-statistic: 500.8 on 8 and 1329 DF,  p-value: < 2.2e-16

This picture becomes even clearer when we add on our last to variables, number of children and what region each person is from. We can see that from our P values all the added variables have signfcance except for our region north west which shows it doesn’t differ much from the reference region. While our RSE here is still over 6000 its much lower then our previous models and is more inline with what our data is showing.

The other regions effected the cost but not as much as costs associated with your number of BMI or if they smoke. While the regions have an effect its realtivly small compared to your other variables so for the best of the model I feel omitting the regions would make for a clearer model. We also can see that each additional child increases you insurance costs by $475.5. For the best model I feel children should be included beucase of its large impact as well as statistical signifcance as shown by its small P value.

conclusion

Overall I beleve the shows paints a clear picture that gender does not provide evidence that men are charged significantly more for health insurance than women. This is supported by gender presenting a P value of 0.69 showing no statistical significant. In the early models it appeared that men were being charged more for insurance then women. But once the model was expanded apon by controlling for more variables we found that other factors affect the cost of insurance more. The most prominent predictors included smoking, BMI, children, and age. These factors affect the overall cost of insurace charges more then anything else with smoking being the most prominent variable that affects insurance charges

In conclusion the model has no evidence to support males insurace charges are greater based solely on gender, due to its large P value and other variables showing more significance then gender in the data set.

LS0tDQp0aXRsZTogIkluc3VyYW5jZSBDaGFyZ2VzIg0Kb3V0c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