Learn R Programming

stagedtrees (version 2.1.0)

prob: Probabilities for a staged event tree

Description

Compute (marginal) probabilities of elementary events with respect to the probability encoded in a staged event tree.

Usage

prob(object, x, log = FALSE, na0 = TRUE)

Arguments

object

an object of class sevt with probabilities.

x

the vector or data.frame of observations.

log

logical, if TRUE log-probabilities are returned.

na0

logical, if NA should be converted to 0.

Value

the probabilities to observe each observation given in x.

Details

Computes probabilities related to a vector or a data.frame of observations.

Examples

Run this code
# NOT RUN {
DD <- generate_random_dataset(5, 100)
model <- full(DD, lambda = 1)
pr <- prob(model, expand.grid(model$tree[c(2, 3, 4)]))
sum(pr)
prob(model, DD[1:10, ])
# }

Run the code above in your browser using DataLab