explore_corr: Explore correlations

View source: R/explore_corr.R

explore_corrR Documentation

Explore correlations

Description

Helps to explore associations (correlations between categorical variables) in the data or in the current (last) insuRglm model. It can be either through visual or tabular form. The metric used for strength of association is Cramer's V.

Usage

explore_corr(setup, type = c("visual", "tabular"))

Arguments

setup

Setup object. Created at the start of the workflow. Usually piped in from previous step.

type

Character scalar. Either visual or tabular.

Value

Either a dataframe or a ggplot2 chart.

See Also

explore_data, explore_target

Examples

require(dplyr) # for the pipe operator
data('sev_train')

setup <- setup(
  data_train = sev_train,
  target = 'sev',
  weight = 'numclaims',
  family = 'gamma',
  keep_cols = c('pol_nbr', 'exposure', 'premium')
)

explore_corr(setup, type = 'visual')
explore_corr(setup, type = 'tabular')

modeling <- setup %>%
  factor_add(pol_yr) %>%
  factor_add(agecat) %>%
  factor_add(veh_age) %>%
  factor_add(veh_value) %>%
  model_fit()

explore_corr(modeling, type = 'visual')
explore_corr(modeling, type = 'tabular')


realgabon/insuRglm documentation built on Jan. 2, 2023, 2:51 a.m.