join_unobserved {stagedtrees} | R Documentation |
Join situations with no observations
Description
Join situations with no observations
Usage
join_unobserved(
object,
fit = TRUE,
trace = 0,
name = "UNOBSERVED",
scope = sevt_varnames(object)[-1],
lambda = object$lambda
)
Arguments
object |
an object of class |
fit |
if TRUE update model's probabilities. |
trace |
if |
name |
character, name for the new stage storing unobserved situations. |
scope |
character vector, list of variables in |
lambda |
smoothing parameter for the fitting. |
Details
It takes as input a (fitted) staged event tree object and it joins, in the same stage, all the situations with zero recorded observations. Since such joining does not change the log-likelihood of the model, it is a useful (time-wise) pre-processing prior to others model selection algorithms.
Unobserved situations can be joined directly in
full
or indep
, by setting
join_unobserved = TRUE
.
Value
a staged event tree with at most one stage per variable with
no observations.
If, as default, fit=TRUE
the model will be re-fitted, if
fit=FALSE
probabilities in the output model are not estimated.
Examples
DD <- generate_xor_dataset(p = 5, n = 10)
model_full <- full(DD, lambda = 1, join_unobserved = FALSE)
model <- join_unobserved(model_full)
logLik(model_full)
logLik(model)
BIC(model_full, model)