compare_target_numeric: Comparison of numerical variables of train set and test set

View source: R/split.R

compare_target_numericR Documentation

Comparison of numerical variables of train set and test set

Description

Compare the statistics of the numerical variables of the train set and test set included in the "split_df" class.

Usage

compare_target_numeric(.data, ...)

Arguments

.data

an object of class "split_df", usually, a result of a call to split_df().

...

one or more unquoted expressions separated by commas. Select the numeric variable you want to compare. You can treat variable names like they are positions. Positive values select variables; negative values to drop variables. If the first expression is negative, compare_target_numeric() will automatically start with all variables. These arguments are automatically quoted and evaluated in a context where column names represent column positions. They support unquoting and splicing.

Details

Compare the statistics of the numerical variables of the train set and the test set to determine whether the raw data is well separated into two data sets.

Value

tbl_df. Variables for comparison:

  • variable : character. numeric variable name

  • train_mean : numeric. arithmetic mean of train set

  • test_mean : numeric. arithmetic mean of test set

  • train_sd : numeric. standard deviation of train set

  • test_sd : numeric. standard deviation of test set

  • train_z : numeric. the arithmetic mean of the train set divided by the standard deviation

  • test_z : numeric. the arithmetic mean of the test set divided by the standard deviation

Examples

library(dplyr)

# Credit Card Default Data
head(ISLR::Default)

# Generate data for the example
sb <- ISLR::Default %>%
  split_by(default)

sb %>%
  compare_target_numeric()

sb %>%
  compare_target_numeric(balance)


alookr documentation built on June 12, 2022, 5:08 p.m.