sevt_fit: Fit a staged event tree

View source: R/1b-base-model-function.R

sevt_fitR Documentation

Fit a staged event tree

Description

Estimate transition probabilities in a staged event tree from data. Probabilities are estimated with the relative frequencies plus, eventually, an additive (Laplace) smoothing.

Usage

sevt_fit(object, data = NULL, lambda = object$lambda)

Arguments

object

an object of class sevt.

data

data.frame or contingency table with observations of the variables in object.

lambda

smoothing parameter or pseudocount.

Details

The data in form of contingency tables and the log-likelihood of the model is stored in the returned staged event tree.

Value

A fitted staged event tree, that is an object of class sevt with ctables, prob and ll components.

Examples


#########
model <- sevt(list(
  X = c("good", "bad"),
  Y = c("high", "low")
))
D <- data.frame(
  X = c("good", "good", "bad"),
  Y = c("high", "low", "low")
)
model.fit <- sevt_fit(model, data = D, lambda = 1)

stagedtrees documentation built on April 29, 2022, 1:06 a.m.