MCfunctions: Simple functions for MCMC demonstrations

MCR Documentation

Simple functions for MCMC demonstrations

Description

Function MC creates random Markov Chain from a transitions matrix. Function Rf presents proportional summaries of discrete states from MC. Function mat.pow finds the exponential expansion of a matrix. Required for finding the expectations of a transition matrix.

Usage

MC(T, start, length)
Rf(res)
mat.pow(mat, pow)

Arguments

T

A symmetric transition matrix.

start

Starting state

length

Length of the chain to be created

res

Results from MC.

mat

A symmetric matrix.

pow

Power the matrix is to be raised to.

Author(s)

Ken Aho

Examples

A <- matrix(nrow = 4, ncol = 4, c(0.5, 0.5, 0, 0, 0.25, 0.5, 0.25,0, 0, 0.25, 0.5, 0.25, 
0, 0, 0.5, 0.5), byrow = TRUE)
pi.0 <- c(1, 0, 0, 0)
Tp10 <- mat.pow(A, 10)
chain <- MC(A, 1, 100)
Rf(chain)

asbio documentation built on May 29, 2024, 5:57 a.m.