mlformat: Format Multivariate Logistic Regression Output

View source: R/mlformat.R

mlformatR Documentation

Format Multivariate Logistic Regression Output

Description

Format output of multivariate logistic regression models.

Usage

mlformat(fit, mode = "B", ci = 0.95, digits = 3, names.x, names.y)

Arguments

fit

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

mode

Character scalar. Specifies which parameter set to summarize. When mode = "B" (the default), generates summaries of regression coefficient estimates. When mode = "R", generates summaries of residual correlation estimates (if mlreg is fit with multivariate = TRUE).

ci

Numeric scalar. Defines the credible interval for parameter summaries. When ci = 0.95 (the default), generates 95% credible intervals for parameter estimates. ci must be between 0 and 1.

digits

Numeric scalar. Positive integer value specifying the number of decimal places to which results will be rounded. The default is 3.

names.x

Character vector (optional). If provided, then supplies the names of predictor variables in the returned matrix. Names should match those of the predictor variables used to fit the mlreg model.

names.y

Character vector (optional). If provided, then supplies the names of response variables in the returned matrix. Names should match those of the response variables used to fit the mlreg model.

Details

Formats output of a multivariate logistic regression model fit using the mlreg function. When mode = "B" (the default), returns regression coefficient estimates. When mode = "R", returns residual correlation estimates (if mlreg is fit with multivariate = TRUE). Summarizes parameters by the quantiles of their posterior distributions, with a point estimate at the 50th percentile (i.e., the posterior median). Lower and upper limits are defined by the credible interval argument. At the default ci = 0.95, returns 95% credible intervals. When a credible interval does not overlap zero, the point estimate is appended with an asterisk.

Value

Numeric matrix of posterior summaries.

See Also

mlreg for fitting multivariate logistic regression models.

mlcoef for extracting regression coefficients from multivariate logistic regression models.

mlcor for extracting residual correlations from 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)

# Retrieve fitted regression model.
fit<-data$fit

# Retrieve predictor matrix.
X<-data$X

# Retrieve response matrix.
Y<-data$Y

# Extract regression coefficients.
B<-mlformat(fit=fit,mode="B",
            names.x=colnames(X),
            names.y=colnames(Y))

# Display regression coefficients.
print(B,quote=FALSE,right=TRUE)

# Extract residual correlations.
R<-mlformat(fit=fit,mode="R",
            names.y=colnames(Y))

# Display residual correlations.
print(R,quote=FALSE,right=TRUE)

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