Data Analysis
Medical Insurance 비용 변화 분석 - Python
hyungminjeon
2025. 4. 8. 21:11
의료 보험료는 나이, 성별, BMI(체질량 지수), 자녀 수, 흡연 여부 등 다양한 요인에 따라 결정된다. 이번 실습에서는 Python을 사용해 특정 요인들이 보험료에 미치는 영향을 분석해보았다. 프로그램 툴로는 Anaconda의 Jupyter notebook을 이용하였다.
1. 보험료 계산 공식
보험료를 계산하는 공식은 다음과 같다.
insurance cost=250×age−128×sex+370×bmi+425×num_of_children+24000×smoker−12500
여기서:
- age: 나이
- sex: 성별 (0: 여성, 1: 남성)
- bmi: 체질량 지수
- num_of_children: 자녀 수
- smoker: 흡연 여부 (0: 비흡연자, 1: 흡연자)
기본적으로 28세 여성, BMI 26.2, 자녀 3명, 비흡연자의 보험료를 계산하면 다음과 같다.
age = 28
sex = 0
bmi = 26.2
num_of_children = 3
smoker = 0
insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
print("This person's insurance cost is " + str(insurance_cost) + " dollars")
출력 결과:
This person's insurance cost is 5469.0 dollars
2. 나이가 보험료에 미치는 영향
나이를 4살 증가시켜 보험료가 어떻게 변하는지 확인한다.
age += 4
new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
change_in_insurance_cost = new_insurance_cost - insurance_cost
print("The change in cost of insurance after increasing the age by 4 years is " + str(change_in_insurance_cost) + " dollars.")
출력 결과:
The change in cost of insurance after increasing the age by 4 years is 1000.0 dollars.
3. BMI가 보험료에 미치는 영향
BMI를 3.1 증가시켜 보험료 변화를 확인한다.
age = 28 # 원래 값으로 초기화
bmi += 3.1
new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
change_in_insurance_cost = new_insurance_cost - insurance_cost
print("The change in cost of insurance after increasing BMI by 3.1 is " + str(change_in_insurance_cost) + " dollars.")
출력 결과:
The change in cost of insurance after increasing BMI by 3.1 is 1147.0 dollars.
4. 성별이 보험료에 미치는 영향
성별을 여성(0)에서 남성(1)으로 변경한 후 보험료 변화를 확인한다.
bmi = 26.2 # 원래 값으로 초기화
sex = 1 # 남성으로 변경
new_insurance_cost = 250 * age - 128 * sex + 370 * bmi + 425 * num_of_children + 24000 * smoker - 12500
change_in_insurance_cost = new_insurance_cost - insurance_cost
print("The change in estimated cost for being male instead of female is " + str(change_in_insurance_cost) + " dollars.")
출력 결과:
The change in estimated cost for being male instead of female is -128.0 dollars.
→ 성별이 남성일 때 보험료가 128달러 감소한다.
5. 결론
- 나이가 많을수록 보험료가 증가한다. (4살 증가 시 +1000달러)
- BMI가 높을수록 보험료가 증가한다. (3.1 증가 시 +1147달러)
- 남성이 여성보다 보험료가 약간 낮다. (-128달러 차이)
이와같이 Python을 활용하면 보험료를 결정하는 다양한 요인들을 실험해보고, 데이터 분석을 통해 의미 있는 인사이트를 얻을 수 있다.