• Home
  • Swinburne University of Technology
  • Data Mining
  • Introduction to Motor Insurance Claim Data Analysis

Introduction to Motor Insurance Claim Data Analysis

STA30004: Data Mining Assignment 2019 Week 1 This assignment relates to motor insurance claim data. In every tutorial class we will spend some time working on this assignment and at the end of week 10 you will be expected to submit your final report together with your CSV data files and powerpoint presentation. All your data files should be named as ABXXX.csv where AB denotes your initials and all your script files should be named as ABweekJJ.scr where AB denotes your initials and JJ denotes the semester week. Week 1: Introduction to the data: See Chapter 1 in Williams (2011) There is data for more than 73000 policies in the data file motor20pct.csv that are associated with claims in a particular year. The variables for each of the policies in this data set are explained below :- CAR_AGE measures the age of the insured car in years DRIVERS measures the number of people who are specified as designated drivers EXPOSURE measures the fraction of the year for which the policy was active MILEAGE measures the expected mileage travelled in a single year PRIMAGE gives the age of the primary driver in years TOTAL gives the total amount claimed on the policy in the year EXCESS = 0, 75 or 100 indicating the excess claim amount associated with each policy. The insurance company will not pay out claims below this excess amount. USAGE specifies how the car is used (S=only social, SB=strictly business, SC=social and business, ST=social and taxi) CLAIM=1 if there was at least one claim during the year, 0 otherwise. In week 1 you are expected to do the following with this data using R software. a) Create a script file for week 1 entitled ABscript1.scr where AB represents your initials. All R instructions used to carry out your work on the assignment in week 1 should be saved in this script file. b) Calculate the quantity LOG(TOTAL+1). motor <- read.csv(file.choose(),header=T) #read the dataset through R motor.table <- data.frame(motor) #put the dataset in to a DATA FRAME names(motor.table) #To show the column headers lntotal<-log(1+(motor.table$total)) #Create a variable called "lntotal" c) Extract a random sample of 5000 policies with CLAIM=1 and a random sample of 5000 policies with CLAIM=0. Save this data file with the name ABmotor.csv where AB represents your initials. You will need to submit this data file with your report at the end of week 10. claim.t <- subset(motor.table,claim == 1) #create a subset of the data where "claim=1" claim.f <- subset(motor.table,claim == 0) #create a subset of the data where "claim=0" set.seed(10) # replace 10 by your student ID claim.tsrows <- sample(1:nrow(claim.t),5000) #Taking a Sample of rows from the 'claim.t' table claim.ts <- claim.t[claim.tsrows,] #Assign a table called 'claim.ts' for the sampled rows claim.fsrows <- sample(1:nrow(claim.f),5000) #Taking a Sample of rows from the 'claim.t' table claim.fs <- claim.f[claim.fsrows,] #Assign a table called 'claim.ts' for the sampled rows motor <- rbind(claim.ts, claim.fs) #merge the claim.ts and claim.fs files vertically write.csv(motor, file = "C/R/motorAB.csv") #Create a csv file