ModelBinaryChoice: A light weight implementation of a logistic regression model.

Description Super classes Methods Examples

Description

A binary logistic model.

Super classes

dymiumCore::Generic -> dymiumCore::Model -> dymiumModel::ModelBase -> ModelBinaryChoice

Methods

Public methods

Inherited methods

Method new()

Initialisation function

Usage
ModelBinaryChoice$new(params, formula, preprocessing_fn = NULL)
Arguments
params

a data.frame object.

formula

a formula object.

preprocessing_fn

a pre-processing function that gets applied to the data given to the predict method before making the prediction.

Returns

NULL


Method predict()

This predict method returns probabilities generated from the parameters of this Model object.

Usage
ModelBinaryChoice$predict(newdata, link_function = c("logit"))
Arguments
newdata

a data.frame object.

link_function

:: character(1)
default as 'logit' using stats::binomial(link = "logit"). Choice of 'logit' and 'probit'. TODO: implement 'probit' option.

Returns

a numeric vector.


Method clone()

The objects of this class are cloneable with this method.

Usage
ModelBinaryChoice$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

1
2
3
4
5
6
.data <- cars
.data$fast_car <- ifelse(.data$speed > 20, 1, 0)
glm_model <- glm(fast_car ~ dist, data = .data)
Mod <- ModelBinaryChoice$new(glm_model$coefficients, formula = glm_model$formula)
Mod
head(Mod$predict(.data))

dymium-org/dymiumModel documentation built on June 23, 2020, 11:01 a.m.