make.categorical.draw: Function that makes a draw from a categorical distribution

View source: R/make.functions.R

make.categorical.drawR Documentation

Function that makes a draw from a categorical distribution

Description

Create a function that makes draws from a categorical distribution. Function calls sample(x=inheritances,size=1,prob=weights)

Usage

make.categorical.draw(inheritances, weights)

Arguments

inheritances

A vector of inheritance probabilities

weights

A vector of weights for each inheritance probability

Value

A function that makes draws from a categorical distribution.

Examples

set.seed(17)
inher_func<-make.categorical.draw(inheritances=c(0.25,0.50,0.75),weights=c(0.25,0.5,0.25))
net<-sim.bdh.age(1,1,5,2,1,c(1/3,1/3,1/3),hyb.inher.fxn = inher_func,
complete=TRUE)[[1]]

jjustison/SiPhyNetwork documentation built on Sept. 14, 2024, 8:58 a.m.