Generates predictions from a fitted cumulative link model.
Arguments
- object
A
clmstanobject returned byclm_stan().- newdata
Optional data frame for prediction. If
NULL(default), predictions are made for the original training data.- type
Type of prediction:
"class": Predicted category (most likely class)"probs": Predicted probabilities for each category
- summary
Logical. If
TRUE(default), return summary statistics (mean, SD, quantiles). IfFALSE, return raw posterior draws.- robust
Logical. If
TRUE, use median instead of mean for point estimates. Default isFALSE.- probs
Numeric vector of probabilities for quantiles. Default is
c(0.025, 0.975)for 95% credible intervals.- ndraws
Number of posterior draws to use. If
NULL(default), all available draws are used.- ...
Additional arguments (currently ignored).
Value
Depending on type and summary:
type = "class",summary = TRUE: A data frame with columnsEstimate(mean/median predicted class),Est.Error(SD), quantile columns, andClass(modal predicted category).type = "class",summary = FALSE: An S x N integer matrix of predicted categories (1 to K), where S is the number of posterior draws and N is the number of observations.type = "probs",summary = TRUE: A data frame with columns for each category probability (P[Y=1],P[Y=2], etc.).type = "probs",summary = FALSE: An S x N x K array of predicted probabilities.
See also
fitted.clmstan() for expected probabilities,
posterior_predict.clmstan() for posterior predictive samples.