This function computes the marginal forward predictions for NHMMs and MNHMMs, where the marginalization is (by default) over individuals and time points, weighted by the latent state probabilities.
# S3 method for nhmm
predict(
object,
newdata,
newdata2 = NULL,
condition = NULL,
type = c("state", "response", "transition", "emission"),
probs = c(0.025, 0.975),
boot_idx = FALSE,
...
)# S3 method for mnhmm
predict(
object,
newdata,
newdata2 = NULL,
condition = NULL,
type = c("state", "response", "transition", "emission"),
probs = c(0.025, 0.975),
boot_idx = FALSE,
...
)
An object of class nhmm or mnhmm.
A data frame used for computing the predictions.
An optional data frame for predictions, in which case the
estimates are differences between predictions using newdata and newdata2.
An optional vector of variable names used for conditional predictions.
A character vector defining the marginal predictions of
interest. Can be one or multiple of "state", "response", "transition",
and "emission". Default is to compute all of these.
A numeric vector of quantiles to compute.
Logical indicating whether to use bootstrap samples in
marginalization when computing quantiles. Default is FALSE. Currently
only used in case where condition is NULL and
Ignored.