Learn R Programming

stagedtrees (version 2.1.0)

sample_from: Sample from a staged event tree

Description

Generate a random sample from the distribution encoded in a staged event tree object.

Usage

sample_from(object, nsim = 1, seed = NULL)

Arguments

object

an object of class sevt with fitted probabilities.

nsim

number of observations to sample.

seed

an object specifying if and how the random number generator should be initialized (<U+2018>seeded<U+2019>). Either NULL or an integer that will be used in a call to set.seed.

Value

A data frame containing nsim observations from the variables in object.

Details

It samples nsim observations according to the transition probabilities (object$prob) in the model.

Examples

Run this code
# NOT RUN {
model <- stages_fbhc(full(PhDArticles, lambda = 1))
sample_from(model, 10)
# }

Run the code above in your browser using DataLab