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,
r_verbose = TRUE,
...
)Arguments
- object
A fitted rhierMnlRwMixture object.
- newdata
Optional list containing data for prediction. Structure depends on
type:For
type %in% c("DeltaZ", "DeltaZ+mu"): Requiresnewdata$Z, a matrix withnpredrows for prediction units (if model was fit with Z).For
type = "posterior_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
type = "prior_probs": Requiresnewdata$Z(if model fit with Z, determiningnpred),newdata$p, andnewdata$X(a list of lengthnpred, each element\\[[i]]having the design matrix(T_i*p) x nvar).
- type
Type of prediction:
"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_j\). Note: for mixtures (ncomp > 1), this uses the mean \(\mu_1\) from the first component."posterior_probs": Posterior predictive choice probabilities for the original estimation units using storedbetadraw."prior_probs": Prior predictive choice probabilities for new prediction units (based onnewdata$Zor the overall mixture if no Z was used). Probabilities are averaged overnsimdraws from the heterogeneity mixture distribution per posterior draw.
- burn
Integer, number of initial MCMC draws to discard.
- nsim
Integer, number of draws from the heterogeneity mixture distribution per posterior draw for
type = "prior_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 = "posterior_probs": List of lengthnlgt. Each element\\[[i]]is a 3D array[T_i, p, ndraws_out]of posterior predictive choice probabilities for uniti.For
type = "prior_probs": List of lengthnpred. Each element\\[[i]]is a 3D array[T_i, p, ndraws_out]of prior predictive choice probabilities for prediction uniti.