dummy_regressor: dummy regressor for a numerical variable.

View source: R/dummy_regressor.R

dummy_regressorR Documentation

dummy regressor for a numerical variable.

Description

dummy regressor for a numerical variable.

Usage

dummy_regressor(y, strategy = "mean", quantile = NULL, constant = NULL)

Arguments

y

a numerical vector.

strategy

a strategy from "constant", "mean", "median", or "quantile".

quantile

used when using the quantile strategy. It is a value between 0 and 1.

constant

used when using the constant strategy. It is a numeric value.

Value

a list containing information of the model.

Examples

# Split the data into training and testing sets
set.seed(2023)
index <- sample(1:nrow(iris), nrow(iris) * 0.8)
train_data <- iris[index,]
test_data <- iris[-index,]
reg_model <- dummy_regressor(train_data$Sepal.Length, strategy = "median")
reg_model

basemodels documentation built on Aug. 9, 2023, 9:09 a.m.