| dmpredict | R Documentation |
Generate predictions for Dirichlet-multinomial regression models.
dmpredict(X, H, fit, names)
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 |
H |
Numeric vector or matrix (optional). If provided, then hierarchical effects are included in the predictions. Vector or matrix elements contain integer identifiers for values of hierarchical variables. If vector, then a single hierarchical variable is included, with each element corresponding to a record in |
fit |
A |
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. |
Generates posterior predictions for Dirichlet-multinomial regression models fit with the dmreg function. Predictions can either include or omit hierarchical effects, depending on whether argument H is provided. 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.
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.
dmreg for fitting Dirichlet-multinomial regression models.
dmWAIC for computing widely applicable information criteria for Dirichlet-multinomial regression models.
# Define example data file path.
path<-system.file("extdata",
"example_regression_data.rds",
package="LocaTT",
mustWork=TRUE)
# Read in example regression data.
data<-readRDS(file=path)
# Predict with fitted Dirichlet-multinomial regression.
out<-dmpredict(X=data$X,fit=data$fit,names=colnames(data$Y))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.