predicted_probability {BGGM} | R Documentation |
Predicted Probabilities
Description
Compute the predicted probabilities for discrete data, with the possibility of conditional predictive probabilities (i.e., at fixed values of other nodes)
Usage
predicted_probability(object, outcome, Y, ...)
Arguments
object |
An object of class |
outcome |
Character string. Node for which the probabilities are computed. |
Y |
Matrix (or data frame) of dimensions n (observations) by p (variables). This must include the column names. |
... |
Compute conditional probabilities by specifying a column name in |
Value
A list containing a matrix with the computed probabilities (a row for each predictive sample and a column for each category).
Note
There are no checks that the conditional probability exists, i.e., suppose you wish to condition on, say, B3 = 2 and B4 = 1, yet there is no instance in which B3 is 2 AND B4 is 1. This will result in an uninformative error.
Examples
Y <- ptsd
fit <- estimate(as.matrix(Y), iter = 150, type = "mixed")
pred <- posterior_predict(fit, iter = 100)
prob <- predicted_probability(pred,
Y = Y,
outcome = "B3",
B4 = 0,
B5 = 0)