Learn R Programming

stagedtrees (version 2.1.0)

join_unobserved: 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 sevt with associated data.

fit

if TRUE update model's probabilities.

trace

if > 0 print information to console.

name

character, name for the new stage storing unobserved situations.

scope

character vector, list of variables in object.

lambda

smoothing parameter for the fitting.

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.

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.

Examples

Run this code
# NOT RUN {
DD <- generate_xor_dataset(n = 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)
# }

Run the code above in your browser using DataLab