View source: R/get_marginals.R
get_marginals | R Documentation |
get_marginals
returns the marginal state, response, transition, and emission
probabilities, optionally per grouping defined by condition
. By default,
the marginalization weights sequences by the corresponding posterior
probabilities of the latent states, i.e., conditional probabilities of the
latent states given all data (weighting = "posterior"
). If
weighting = "forward"
, marginalization is based on forward probabilities,
i.e. state probabilities given data up to that point which allows you to
compute, for example, state marginals of form
P(state_t | data_1, \ldots, data_t)
(whereas in posterior probability
weighting the conditioning is on data_1,\ldots,data_T
.
If weighting = "none"
, all individuals and time points are treated equally,
without accounting for the probability that individual is at particular
state at particular time.
get_marginals(
model,
probs = NULL,
condition = NULL,
newdata = NULL,
type = c("state", "response", "transition", "emission"),
weighting = c("posterior", "forward", "none")
)
model |
An object of class |
probs |
Vector defining the quantiles of interest. Default is
|
condition |
An optional vector of variable names used for conditional
marginal probabilities. Default is |
newdata |
An optional data frame containing the new data to be used in computing the probabilities. |
type |
A character vector defining the marginal probabilities of
interest. Can be one or multiple of |
weighting |
A character string defining the type of weighting used in
marginalization. One of |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.