mlpredict: Predictions for Multivariate Logistic Regression Models

View source: R/mlpredict.R

mlpredictR Documentation

Predictions for Multivariate Logistic Regression Models

Description

Generate predictions for multivariate logistic regression models.

Usage

mlpredict(X, fit, names)

Arguments

X

Numeric predictor matrix. Predictions are made for each record. Each field represents a predictor variable, and the predictor variables must match (in order) those used to fit the mlreg model. Matrix cells contain predictor values. Element names in the returned list are taken from the row names of X.

fit

A stanfit object returned from the mlreg function. The fitted multivariate logistic regression model.

names

Vector (optional). If provided, then field names in the matrices of the returned list will receive these values. If omitted, then the matrices in the returned list will lack field names.

Details

Generates posterior predictions for multivariate logistic regression models fit with the mlreg function. Returns a list where each element contains a matrix of posterior predictions for the respective record of X. Field names for the element matrices can optionally be provided with the names argument.

Value

A list whose elements contain numeric matrices of posterior predictions. Within the list, one element is returned for each record of X. Element names are taken from the row names of X.

See Also

mlreg for fitting multivariate logistic regression models.

mlformat for formatting output of multivariate logistic regression models.

mlWAIC for computing widely applicable information criteria for multivariate logistic regression models.

Examples

# Define example data file path.
path<-system.file("extdata",
                  "example_mvlogistic_data.rds",
                  package="LocaTT",
                  mustWork=TRUE)

# Read in example regression data.
data<-readRDS(file=path)

# Predict with fitted multivariate logistic regression.
out<-mlpredict(X=data$X,fit=data$fit,names=colnames(data$Y))

LocaTT documentation built on June 14, 2026, 1:06 a.m.