TransMatrix: Transition Matrix Estimation

Description Usage Arguments Examples

Description

This function allows you to estimate transition matrices (probabilities or counts) for up-to-fifth-order discrete Markov chains. For n-order Markov chains with n greater than 1, you can access the estimated transition matrices through nested lists.

Usage

1
TransMatrix(sequence, order = 1, probs = TRUE)

Arguments

sequence

A vector of integers representing the sequence. The sequence must be in the form of 1,2,3,...

order

Integer from 1 to 5. Order of the Markov chain. By default is set to 1.

probs

Logical. If TRUE probability matrices are returned, otherwise count matrices are returned. By default is set to TRUE.

Examples

1
2
3
4
5
seq <- sample(c(1,2,3,4), size = 1000, replace = TRUE)
TransMatrix(seq, order = 1, probs = TRUE)
TransMatrix(seq, order = 2, probs = FALSE)
mc <- TransMatrix(seq, order = 4, probs = TRUE)
mc[[1]][[2]][[3]] # through nested lists you can access to the estimated transition matrices


Search within the MCTM package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.