Learn R Programming

markovchain (version 0.9.5)

probabilityatT: Calculating probability from a ctmc object

Description

This function returns the probability of every state at time t under different conditions

Usage

probabilityatT(C,t,x0,useRCpp)

Value

returns a vector or a matrix in case x0 is provided or not respectively.

Arguments

C

A CTMC S4 object

t

final time t

x0

initial state

useRCpp

logical whether to use RCpp implementation

Author

Vandit Jain

Details

The initial state is not mandatory, In case it is not provided, function returns a matrix of transition function at time t else it returns vector of probaabilities of transition to different states if initial state was x0

References

INTRODUCTION TO STOCHASTIC PROCESSES WITH R, ROBERT P. DOBROW, Wiley

Examples

Run this code
states <- c("a","b","c","d")
byRow <- TRUE
gen <- matrix(data = c(-1, 1/2, 1/2, 0, 1/4, -1/2, 0, 1/4, 1/6, 0, -1/3, 1/6, 0, 0, 0, 0),
nrow = 4,byrow = byRow, dimnames = list(states,states))
ctmc <- new("ctmc",states = states, byrow = byRow, generator = gen, name = "testctmc")
probabilityatT(ctmc,1,useRCpp = TRUE)

Run the code above in your browser using DataLab