Learn R Programming

stagedtrees (version 2.1.0)

sevt_fit: 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.

Value

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

Details

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

Examples

Run this code
# NOT RUN {
#########
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)
# }

Run the code above in your browser using DataLab