R/predict.logistic_regression.R

Defines functions predict.logistic_regression

Documented in predict.logistic_regression

## File Name: predict.logistic_regression.R
## File Version: 0.17

predict.logistic_regression <- function( object, newdata=NULL, ...)
{
    if ( ! is.null(newdata) ){
        Xdes <- stats::model.matrix( object$formula, newdata )
        offset_values <- offset_values_extract(formula=object$formula, data=newdata )
    } else {
        Xdes <- object$X
        offset_values <- object$offset_values
    }
    beta <- coef(object)
    linear_predictor <- Xdes %*% beta + offset_values
    fitted.values <- stats::plogis( linear_predictor )
    return(fitted.values)
}
alexanderrobitzsch/mdmb documentation built on July 18, 2024, 11:14 p.m.