create_options: Generate Random Options Matrix for a Given Tree

View source: R/option.R

create_optionsR Documentation

Generate Random Options Matrix for a Given Tree

Description

Creates random options based on the RangeScale and Probability attributes of tree nodes. This function is useful for generating random scenarios for simulations or analyses.

Usage

create_options(tree, num_options = 1, seed = NULL)

Arguments

tree

A Tree object.

num_options

A single numeric value specifying the number of options to generate. Defaults to 1.

seed

A single numeric value for random number generation seed. Default is NULL, which means no seed will be set.

Details

The function creates a matrix of random options based on the attributes of tree nodes. Specifically, it leverages the RangeScale and Probability attributes of tree nodes to generate random options.

Value

A matrix where rows represent tree leaves and columns represent sampled options.

Examples

tree <- dexisensitivity::masc2
option <- create_options(tree, num_options=3, seed = 42)


dexisensitivity documentation built on Oct. 30, 2024, 1:08 a.m.