mtrglm: Generalized linear model metrics

View source: R/code.R

mtrglmR Documentation

Generalized linear model metrics

Description

mtrglm() generates different performance metrics and graphs associated with a confusion matrix of a binary variable. It also includes graphs constructed from the predicted values. Although the function is not focused on creating a generalized linear model, it includes options for basic elaboration.

Usage

mtrglm(
  x,
  basic_model = FALSE,
  y = NULL,
  link = "logit",
  partition = 0.75,
  seed = 200,
  type_ks = 2,
  type_pr = 2
)

Arguments

x

List that has Values and Probabilities of the response variable in training and test set (the columns must be in this specific order). In case of creating a GLM through the stats::glm() function, you must provide a data frame that includes the response variable and the model covariates.

basic_model

Indicates whether a GLM should be created.

y

In case of preparing a GLM, this parameter corresponds to the column name of the response variable.

link

In case of preparing a GLM, this parameter corresponds to the link function of the binomial family ("logit", "probit", or "cloglog", default is "logit").

partition

In case of preparing a GLM, this parameter corresponds to training set size ratio, default is 0.75.

seed

Seed for partition random processes, default is 200.

type_ks

Value 0, 1, or 3 indicating the type of KS curve graph that you want to create, look at the type argument of the function model_ks().

type_pr

Value 0, 1, or 3 indicating the type of PR curve graph that you want to create, look at the type argument of the function model_pr().

Value

Confusion matrix, Recall, Precision, Accuracy y F1 Score. ROC, PR, KS and Gain curves.

See Also

metrics() to calculate the metrics associated with the confusion matrix, model_roc() to plot ROC curve, model_pr() to plot Precision - Recall curve, model_ks() to plot Kolmogorov - Smirnov curve, model_gain() to plot Gain curve.

Examples

# example code

sleep_data$Gender = as.numeric(ifelse(sleep_data$Gender == "Male", 0 , 1))
mtrglm(y = "Gender", x = sleep_data, basic_model = TRUE, type_ks = 3, type_pr = 3)


Dfranzani/MTRGLM documentation built on March 28, 2024, 1:34 a.m.