Learn R Programming

markovchain

R package providing classes, methods and function for easily handling Discrete Time Markov Chains (DTMC), performing probabilistic analysis and fitting.

Install the current release from CRAN:

install.packages('markovchain')

Install the development version from GitHub:

devtools::install_github('spedygiorgio/markovchain')

Copy Link

Version

Install

install.packages('markovchain')

Monthly Downloads

7,544

Version

0.10.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Giorgio Spedicato

Last Published

February 2nd, 2026

Functions in markovchain (0.10.3)

kullback

Example from Kullback and Kupperman Tests for Contingency Tables
markovchainListFit

markovchainListFit
meanFirstPassageTime

Mean First Passage Time for irreducible Markov chains
createSequenceMatrix

Function to fit a discrete Markov chain
meanAbsorptionTime

Mean absorption time
markovchainSequence

Function to generate a sequence of states from homogeneous Markov chains.
markovchain-package

Easy Handling Discrete Time Markov Chains
markovchainList-class

Non homogeneus discrete time Markov Chains class
markovchain-class

Markov Chain class
meanNumVisits

Mean num of visits for markovchain, starting at each state
names,markovchain-method

Returns the states for a Markov chain object
predictiveDistribution

predictiveDistribution
predictHommc

Simulate a higher order multivariate markovchain
meanRecurrenceTime

Mean recurrence time
ones

Returns an Identity matrix
probabilityatT

Calculating probability from a ctmc object
preproglucacon

Preprogluccacon DNA protein bases sequences
noofVisitsDist

return a joint pdf of the number of visits to the various states of the DTMC
multinomialConfidenceIntervals

A function to compute multinomial confidence intervals of DTMC
priorDistribution

priorDistribution
rctmc

rctmc
verifyMarkovProperty

Various functions to perform statistical inference of DTMC
rain

Alofi island daily rainfall
zeros

Matrix to create zeros
period

Various function to perform structural analysis of DTMC
rmarkovchain

Function to generate a sequence of states from homogeneous or non-homogeneous Markov chains.
transition2Generator

Return the generator matrix for a corresponding transition matrix
steadyStates

Stationary states of a markovchain object
name<-

Method to set name of markovchain object
states

Defined states of a transition matrix
sales

Sales Demand Sequences
transitionProbability

Function to get the transition probabilities from initial to subsequent states.
tm_abs

Single Year Corporate Credit Rating Transititions
conditionalDistribution

conditionalDistribution of a Markov Chain
blanden

Mobility between income quartiles
ctmcFit

Function to fit a CTMC
HigherOrderMarkovChain-class

Higher order Markov Chains class
committorAB

Calculates committor of a markovchain object with respect to set A, B
expectedRewards

Expected Rewards for a markovchain
ExpectedTime

Returns expected hitting time from state i to state j
absorptionProbabilities

Absorption probabilities
fitHighOrderMultivarMC

Function to fit Higher Order Multivariate Markov chain
firstPassageMultiple

function to calculate first passage probabilities
hittingProbabilities

Hitting probabilities for markovchain
freq2Generator

Returns a generator matrix corresponding to frequency matrix
fitHigherOrder

Functions to fit a higher order Markov chain
hommc-class

An S4 class for representing High Order Multivariate Markovchain (HOMMC)
is.accessible

Verify if a state j is reachable from state i.
is.TimeReversible

checks if ctmc object is time reversible
ctmc-class

Continuous time Markov Chains class
holson

Holson data set
craigsendi

CD4 cells counts on HIV Infects between zero and six month
inferHyperparam

Function to infer the hyperparameters for Bayesian inference from an a priori matrix or a data set
expectedRewardsBeforeHittingA

Expected first passage Rewards for a set of states in a markovchain
is.CTMCirreducible

Check if CTMC is irreducible
ictmc-class

An S4 class for representing Imprecise Continuous Time Markovchains
impreciseProbabilityatT

Calculating full conditional probability using lower rate transition matrix
show,hommc-method

Function to display the details of hommc object
firstPassage

First passage across states
is.regular

Check if a DTMC is regular
name

Method to retrieve name of markovchain object
generatorToTransitionMatrix

Function to obtain the transition matrix from the generator
is.irreducible

Function to check if a Markov chain is irreducible (i.e. ergodic)