R: Calculating probability from a ctmc object

probabilityatT {markovchain} | R Documentation

## 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)

### Arguments

`C` | A CTMC S4 object
`t` | final time t
`x0` | initial state
`useRCpp` | logical whether to use RCpp implementation

### 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`

### Value

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

### Author(s)

Vandit Jain

### References

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

### Examples

    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)

[Package markovchain version 0.8.6 Index]