Is there evidence that men pay more in health insurance charges than women?
With the insurance data set obtained from Machine
Learning with R: https://github.com/stedy/Machine-Learning-with-R-datasets,
this report intends to answer the question posed above. This data set
contains 1,338 observations of primary insurance beneficiaries. There
are 7 variables:
age denotes the number of years the insured person
has been alive
sex contains whether the individual is a male or
female
bmi is the Body Mass Index - a metric comparing
weight and height with the healthy adult range considered 18.5 to
24.9
children is the number of dependent children covered
under the individual’s insurance
smoker indicates yes if the individual
smokes and no if they do not
region refers to which quadrant of the US the
individual is from - northwest, southwest,
southeast, or northeast
charges is the amount in dollars billed to the
individual for medical costs by health insurance
insurance has been imported into R using the
readr library, is displayed below using a data table
from the DT library, and visuals are made through the
tidyverse library. Modeling done later on in this
project is achieved through the modelr library.
library(tidyverse)
library(readr)
library(modelr)
library(DT)
insurance <- read_csv("insurance.csv")
datatable(insurance, options = list(scrollX = TRUE))
A logical first place to start when determining the relationship
between charges to men and women is to compare the averages for each
gender. This will give an initial idea to see if there is indeed a trend
of men being charged more. This can be inspected by grouping the same
sexes together and taking an average as the variable
avg_charges.
insurance_split <- insurance %>%
group_by(sex) %>%
summarize(count = n(),
avg_charges = mean(charges)) %>%
select(sex, avg_charges, count)
datatable(insurance_split, options = list(scrollX = TRUE))
The data table above shows that the 1,338 observations from the
entire insurance data set are divided as 662 females and
676 males. This is a very close to even split. However, less even is the
average amount charges to men and women. Women on average are charged
$12569.68 while men are charged over $1000 more on average with a rate
of $13,956.75. From this simple calculation it would appear men pay more
than women; however, there is more analysis to come to ensure this is
substantial statistical proof before confidently making that
assertion.
Taking things a step farther, a simple linear regression model of
sex as a predictor of charges would look like
the following:
model_insurance <- lm(charges~sex, data = insurance)
summary(model_insurance)
##
## 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
charges = 12569.6 + 1387.2 * (sex: male)
This linear regression model can be interpreted as saying an
individual can be expected to pay $12569.6 in medical costs, unless they
are male, in which case an additional $1387.2 is expected to be charged.
This is the same idea as the averages, but the summary of statistics
reveals some more insight. It can be seen there is a residual standard
error (RSE) of 12090, which means for the observations of insured
individuals, on average the equation above will be off by $12090 when
predicting charges based solely on sex. This
is a pretty big margin and the adjusted R-squared, which approximately
states the percentage of variation in charges explained by
sex, is just 0.0025 which means something more is going on
since only 0.25% is explained by this variable. Even so, the p-value is
0.0361 which is below 0.05 and indicates there is a statistically
significant relationship taking place here. A p-value is the probability
that a given result takes place under random conditions. Extremely small
p-values, like those beneath 0.05, are significant enough to suggest
there is more than a random relationship between variables. The small
p-value is enough to say the relationship between sex and
charges is statistically significant, but the very small
R-squared value means more investigating is wise.
As seen above, there appears to be a relationship between
sex and charges but there is reason to believe
other variables are just as, if not more, influential. Age is a big one
because typically young adults are healthier and accumulate fewer
medical costs than their elder counterparts. Although this does not
explain why men pay more than women, accounting for age in
the linear regression model can reveal if this is truly the case. It
could perhaps be that due to their shorter life expectancy, men lead a
more medically expensive lifestyle? Only the statistics can tell us.
model_insurance_w_age <- lm(charges~sex + age, data = insurance)
summary(model_insurance_w_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 new, multiple linear regression model hear is as follows:
charges = 2343.62 + 258.87 * (age) +
1538.83 * (sex: male)
This can be interpreted as an individual who is not male and 0 years in age will be charged $2343.62. For every year they age, an additional $258.87 will be charged and then if they are male, an additional total of $1538.83 is tacked on.
This new model has a slightly smaller RSE of $11540 meaning the model
is a bit better at predicting the actual charges now that
age and gender are both considerations. The
adjusted R-squared has also increased to 0.092 which suggests around 9%
of the variance is a result of age and sex.
The p-value for the model is well below 0.05 at < 2.2e-16. This means
there is very much reason to believe the relationship between
age, sex, and charges is
statistically significant. Looking at the individual variables reveals
that the p-value for just sex in this model is 0.0149,
which is still significant but far larger than the value for
age which is a mere < 2.2e-16. This suggests
age may be more influential than sex. Although
there is still evidence of an increased rate of charges for men compared
to women, the R-squared value is still quite close to 0 which means
there may be more variables contributing to the charges.
Considering this data set deals with health insurance, it is only
reasonable to include health variables to gain a more complete
understanding. bmi and smoker can be used as
indicators of healthiness. High BMIs and obesity can be linked to heart
issues while smoking is linked to lung cancer, all of which may increase
medical costs. By making a new multiple linear regression model with
these two variables added in alongside age and
sex as predictors of charges may be
beneficial.
model_insurance_3 <- lm(charges~sex + age + bmi + smoker, data = insurance)
summary(model_insurance_3)
##
## Call:
## lm(formula = charges ~ sex + age + bmi + smoker, 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 ***
## bmi 323.05 27.53 11.735 <2e-16 ***
## smokeryes 23833.87 414.19 57.544 <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 multiple linear regression model is as follows:
charges = -11633.49 - 109.04 * (sex: male)
+ 259.45 * (age) + 323.05 * (bmi) + 23833.87 *
(smoker: yes)
This can all be interpreted as meaning being male actually decreases the expected charges to an individual by $109.04 while every year of age adds an expected $259.04 in charges along with $323.05 for every increase of one on the BMI scale. All of this pales in comparison alongside the addition of an expected $23833.87 in charges if someone is a smoker.
This new model has an even better RSE of 6094, meaning the average
prediction will only be off by $6094. The adjusted R-squared value of
0.7467 means approximately 74.67% of the variation in
charges values in this data set can be explained by the
combination of the sex, age, bmi,
and smoker variables. The p-value remains quite strong at a
minuscule <2.2e-16 which is far below the statistical significance
threshold of 0.05. However, when looking at the individual variables,
one jumps out as different than the others. age,
bmi, and smoker all have positive coefficients
in the model with very tiny p-values while sex has a large
p-value of 0.745 and a negative coefficient of -109.04. With this model
being the most reliable yet for the insurance data set, it
seems there is less evidence than before to suggest men pay more than
women in charges. To further investigate this reversal of the earlier
trend, two final variables may be considered.
The last two variables remaining are children and
region. To test their influence, they will be incorporated
into the multiple linear regression model and from there whether or not
men pay more than women.
model_insurance_4 <- lm(charges~sex + age + bmi + smoker + children + region, data = insurance)
summary(model_insurance_4)
##
## Call:
## lm(formula = charges ~ sex + age + bmi + smoker + 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 ***
## bmi 339.2 28.6 11.860 < 2e-16 ***
## smokeryes 23848.5 413.1 57.723 < 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 new model can be expressed algebraically as:
charges = -11938.5 - 131.3 * (sex:male) +
256.9 * (age) + 339.2 * (bmi) + 23848.5 *
(smoker: yes) + 475.5 * (children) - 353.0 *
(region: northwest) - 1035.0 * (region:
southeast) - 960 * (region: southwest)
This means that every being a male decreases the expected charge by $131.3 while every year of age adds $256.9 in predicted insurance charges, every increase of 1 in BMI adds $339.2 in predicted costs, as does being a smoker which adds $23,848.5. Each child adds $475.5 in predicted costs, but being from the northwest region decreases the cost by an average of $353, while the southeast does so by $1035, and the southwest by $960.
Looking at this model with 6 variables considered as predictors for
charges, it has an RSE of 6062, an adjusted R-squared of
0.7494, and a p-value of < 2.2e-16. The RSE and R-squared indicate
this model is better at predicting than any of the previous iterations,
while the p-value maintains that there is statistical significance
supporting the relationship seen here. However, when considering the
influence of sex on charges, there is actually
not much support. The sexmale coefficient is -131.3 with a
p-value of 0.693, indicating there is not a statistically significant
relationship between sex and charges. Every
other variable except regionnorthwest has a p-value below
0.05. To test if the model is actually better off without
sex, it will be run below with just 5 variables as
predictors.
model_insurance_no_sex <- lm(charges~age + bmi + smoker + children + region, data = insurance)
summary(model_insurance_no_sex)
##
## Call:
## lm(formula = charges ~ age + bmi + smoker + children + region,
## data = insurance)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11367.2 -2835.4 -979.7 1361.9 29935.5
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -11990.27 978.76 -12.250 < 2e-16 ***
## age 256.97 11.89 21.610 < 2e-16 ***
## bmi 338.66 28.56 11.858 < 2e-16 ***
## smokeryes 23836.30 411.86 57.875 < 2e-16 ***
## children 474.57 137.74 3.445 0.000588 ***
## regionnorthwest -352.18 476.12 -0.740 0.459618
## regionsoutheast -1034.36 478.54 -2.162 0.030834 *
## regionsouthwest -959.37 477.78 -2.008 0.044846 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6060 on 1330 degrees of freedom
## Multiple R-squared: 0.7509, Adjusted R-squared: 0.7496
## F-statistic: 572.7 on 7 and 1330 DF, p-value: < 2.2e-16
Without diving into the exact interpretation of the linear model
itself, it can be seen there is some slight improvement in both RSE and
R-squared compared to the previous model. This indicates the model is
actually slightly better sex is not included.
To answer the initial question of is there statistical evidence that
men pay more in insurance charges than women, there is not enough
evidence to support that claim. Although the averages in this data set
show males pay more than females, in reality that appears to be a result
of confounding variables such as smoking and bmi, not sex itself. As
additional variables are incorporated as predictors to the multiple
linear regression model, sex becomes decreasingly
significant and even begins to suggest males pay less than females,
which goes completely against the initial inquiry.