Commit 3a7b7d64 authored by Carl Corder's avatar Carl Corder
Browse files

Update transform_data_famd.r

parent 5f31326d
......@@ -6,7 +6,6 @@ library("factoextra")
# phase 2 excel
input <- "C:/Users/its-student/Desktop/Phase2In.xlsx"
output <- "C:/Users/its-student/Desktop/Phase2OutFAMD.xlsx"
# read in sheets
data <- read_excel(input, sheet = "Data")
......@@ -133,20 +132,8 @@ data <- data %>%
MAX_LIVES >= 1000 & TRUE_GROUP_VOL == "V" & POLICY_DURATION < 4 ~ 1.0000,
MAX_LIVES >= 1000 & TRUE_GROUP_VOL == "V" & POLICY_DURATION >= 4 ~ 1.0200))
# calculate needed premium
#data <- data %>% mutate(NEEDED_PREMIUM = PREM / RTN)
# calculate expected claims
#data <- data %>% mutate(EXPECTED_CLAIMS = NEEDED_PREMIUM * TLR)
# calcualte actual claims
#data <- data %>% mutate(ACTUAL_CLAIMS = PAID_CLAIMS + IBNR)
# calculate actual to expected ratio
#data <- data %>% mutate(ACTUAL_TO_EXPECTED = ACTUAL_CLAIMS / EXPECTED_CLAIMS)
# numerics -> pca + factors -> mca
# famd = pca (numerics) + mca (factors)
data <- data %>% select("REGION", "INDUSTRY",
"COVG_CODE", "LTD_INDICATOR",
"AVG_SALARY", "AVG_AGE", "PCT_FEMALE",
......@@ -156,9 +143,7 @@ data <- data %>% select("REGION", "INDUSTRY",
"PAID_COMMISSION", "PAID_CLAIMS", "CLAIM_COUNT", "IBNR",
"PERCENT_COMMISSION", "PREMIUM_TAX", "INTERNAL_EXPENSES", "PERCENT_PEPM")
save(data, file = "C:/Users/its-student/Desktop/phase2.rdata")
# use FactoMineR for PCA
# use FactoMineR for FAMD
data.famd <- FAMD(data, graph = FALSE)
summary(data.famd)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment