Skip to contents

Returns the prediction of a binary variable by a gradual measurement using logistic regression.

Usage

get_prediction(data, dv, iv)

Arguments

data

A data frame.

dv

A binary variable in that data frame.

iv

A gradual variable in that data frame used for predicting dv.

Value

A factor with levels 0, 1.

Details

Predictions are considered '1' if the predicted probability is >= .5.

See also

Examples

data(mtcars)
mtcars$pred <- get_prediction(mtcars, mtcars$am, mtcars$drat)