Book Image

Machine Learning with R - Second Edition

By : Brett Lantz
Book Image

Machine Learning with R - Second Edition

By: Brett Lantz

Overview of this book

Table of Contents (19 chapters)
Machine Learning with R Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Example – predicting medical expenses using linear regression


In order for a health insurance company to make money, it needs to collect more in yearly premiums than it spends on medical care to its beneficiaries. As a result, insurers invest a great deal of time and money in developing models that accurately forecast medical expenses for the insured population.

Medical expenses are difficult to estimate because the most costly conditions are rare and seemingly random. Still, some conditions are more prevalent for certain segments of the population. For instance, lung cancer is more likely among smokers than non-smokers, and heart disease may be more likely among the obese.

The goal of this analysis is to use patient data to estimate the average medical care expenses for such population segments. These estimates can be used to create actuarial tables that set the price of yearly premiums higher or lower, depending on the expected treatment costs.

Step 1 – collecting data

For this analysis, we...