cross_plot: Cross-plotting input variable vs. target variable

View source: R/cross_plot.R

cross_plotR Documentation

Cross-plotting input variable vs. target variable

Description

The cross_plot shows how the input variable is correlated with the target variable, getting the likelihood rates for each input's bin/bucket .

Usage

cross_plot(data, input, target, path_out, auto_binning, plot_type = "both")

Arguments

data

data frame source

input

input variable name (if empty, it runs for all numeric variable), it can take a single character value or a character vector.

target

variable name to predict

path_out

path directory, if it has a value the plot is saved

auto_binning

indicates the automatic binning of input variable based on equal frequency (function 'equal_freq'), default value=TRUE

plot_type

indicates if the output is the 'percentual' plot, the 'quantity' or 'both' (default).

Value

cross plot

Examples


## Example 1:
cross_plot(data=heart_disease, input="chest_pain", target="has_heart_disease")

## Example 2: Disabling auto_binning:
cross_plot(data=heart_disease, input="oldpeak",
		target="has_heart_disease", auto_binning=FALSE)

## Example 3: Saving the plot into a folder:
#cross_plot(data=heart_disease, input="oldpeak",
#		target="has_heart_disease", path_out = "my_folder")

## Example 4: Running with multiple input variables at the same time:
cross_plot(data=heart_disease, input=c("age", "oldpeak", "max_heart_rate"),
		target="has_heart_disease")


funModeling documentation built on May 29, 2024, 3:24 a.m.