Homework #2: Insurance

Author

Christina Wright

Auto Insurance Policies: Investigating the likelihood of accidents & potential costs of damage

Introduction

Context & Motivation

In 2023, the auto insurance industry exceeded $360B, with the costs of individual auto insurance policies rapidly increasing. Annual premiums have increased over 60% the last 10 years, with a median policy running over $2,000 (Forbes, 2024). With these industry wide statistics in mind, it is crucial for us, as key player in the market, to better understand the risk factors of auto accidents and develop stronger models to predict the costs of the related damages.

Methodology

Throughout this report, we will be using a set of data from our customers with a collection of variables from our records - ranging from personal information, driving records, and insurance claim histories. We have broken this analysis into four distinct sections:

  1. Exploratory data analysis
  2. Preparing our data for model development
  3. Constructing our models
  4. Selecting & evaluating our models

The main deliverable here will consist of two models, with the goal of providing a critical tool in predicting a customer’s likelihood of being in an accident and estimating the potential cost of the damages to better inform our policy pricing strategy.

# load all necessary packages
library(stargazer)

Please cite as: 
 Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
 R package version 5.2.3. https://CRAN.R-project.org/package=stargazer 
library(corrplot)
corrplot 0.92 loaded
library(ggplot2) 
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(visdat)
library(broom)
library(patchwork)
Warning: package 'patchwork' was built under R version 4.2.3
library(car)
Loading required package: carData

Attaching package: 'car'
The following object is masked from 'package:dplyr':

    recode
library(MASS)
Warning: package 'MASS' was built under R version 4.2.3

Attaching package: 'MASS'
The following object is masked from 'package:patchwork':

    area
The following object is masked from 'package:dplyr':

    select
# load the CSV files for the training and test datasets
training_data <- read.csv("~/Downloads/insurance-training-data2.csv")
test_data <- read.csv("~/Downloads/insurance-testing-data2.csv")

Exploring the data

First, we will take a look at some summary statistics for our data set to provide a general overview of what we have on hand to conduct this analysis.

In total, there are 8,000 records in this data set, each representing one of our customers.