Learn R Programming

wxgenR (version 1.4.4)

selectState: Select transition state

Description

Function selects and returns the transition state given a uniform random number between 0 and 1 and the cumulative probability vector of the state sequence.

Usage

selectState(uni, wt)

Value

Returns an object containing the transition state(s) based on the given cumulative probability vector and random numbers.

Arguments

uni

Uniform random number between 0 and 1.

wt

Cumulative probability vector of states.

Examples

Run this code

 rand = runif(1)

 print(rand)

 selectState(uni = rand, wt = c(0.25, .55, 0.85, 1))


Run the code above in your browser using DataLab