Predict Method for rhierMnlRwMixture Objects
predict.rhierMnlRwMixture.RdPredict Method for rhierMnlRwMixture Objects
Usage
# S3 method for class 'rhierMnlRwMixture'
predict(
object,
newdata = NULL,
type = "DeltaZ+mu",
burn = 0,
nsim = 10,
mode = "coefficients",
r_verbose = TRUE,
force_tree_eval = FALSE,
...
)Arguments
- object
A fitted rhierMnlRwMixture object.
- newdata
Optional list containing data for prediction. Structure depends on
modeandtype:For
mode = "coefficients"withtype %in% c("DeltaZ", "DeltaZ+mu", "SigmaZ"): requiresnewdata$Z, a matrix withnpredrows for prediction units (if model was fit with Z).For
mode = "posterior"withtype = "choice_probs": requiresnewdata$nlgtdata, a list of lengthnlgt(original number of units). Each element\\[[i]]must contain$X, the design matrix(T_i*p) x nvarfor uniti. Also requiresnewdata$p, the number of alternatives.For
mode = "prior"withtype = "choice_probs": requiresnewdata$Z(if model fit with Z, determiningnpred),newdata$p, andnewdata$X(a list of lengthnpred, each element\\[[i]]having design matrix(T_i*p) x nvar).
- type
Type of prediction within the selected
mode:"DeltaZ": Expected part-worths of the representative consumer, \(\Delta(Z)\)."DeltaZ+mu": Expected part-worths plus the mean of the unobserved heterogeneity component, \(\Delta(Z) + \mu_1\). The package supports onlyncomp = 1."choice_probs": Predictive choice probabilities (use withmode = "posterior"ormode = "prior")."SigmaZ": Draws of the heteroscedastic covariance matrix \(\Sigma(Z)\). Available only for models fit withPrior$vartree(class marker"bayesm.HART.HeterCov").
- burn
Integer, number of initial MCMC draws to discard.
- nsim
Integer, number of draws from the heterogeneity distribution per posterior draw for
mode = "prior"andtype = "choice_probs".- mode
Prediction mode:
"coefficients": coefficient-level outputs (DeltaZ,DeltaZ+mu,SigmaZ)."posterior": posterior predictive output (type = "choice_probs")."prior": prior predictive output (type = "choice_probs").
- r_verbose
Logical, print progress updates?
- ...
Additional arguments passed to underlying prediction functions (e.g.,
mc.cores,verbosefor BARTDeltaZpredictions viapwbart).
Value
Depends on type:
For
type %in% c("DeltaZ", "DeltaZ+mu"): 3D array[npred, nvar, ndraws_out]of predicted expected part-worths.For
type = "SigmaZ": 4D array[npred, nvar, nvar, ndraws_out]of covariance draws at each prediction unit.For
mode = "posterior", type = "choice_probs": List of lengthnlgt. Each element\\[[i]]is a 3D array[T_i, p, ndraws_out]of posterior predictive choice probabilities for uniti.For
mode = "prior", type = "choice_probs": List of lengthnpred. Each element\\[[i]]is a 3D array[T_i, p, ndraws_out]of prior predictive choice probabilities for prediction uniti.