Package: markovchain 0.10.3

Giorgio Alfredo Spedicato

markovchain: Easy Handling Discrete Time Markov Chains

Functions and S4 methods to create and manage discrete time Markov chains more easily. In addition functions to perform statistical (fitting and drawing random variates) and probabilistic (analysis of their structural proprieties) analysis are provided. See Spedicato (2017) <doi:10.32614/RJ-2017-036>. Some functions for continuous times Markov chains depend on the suggested ctmcd package.

Authors:Giorgio Alfredo Spedicato [aut, cre], Tae Seung Kang [aut], Sai Bhargav Yalamanchi [aut], Mildenberger Thoralf [ctb], Deepak Yadav [aut], Ignacio Cordón [aut], Vandit Jain [ctb], Toni Giorgino [ctb], Richèl J.C. Bilderbeek [ctb], Daniel Ebbert [ctb], Shreyash Maheshwari [ctb], Reinhold Koch [ctb]

markovchain_0.10.3.tar.gz
markovchain_0.10.3.zip(r-4.7)markovchain_0.10.3.zip(r-4.6)markovchain_0.10.3.zip(r-4.5)
markovchain_0.10.3.tgz(r-4.6-x86_64)markovchain_0.10.3.tgz(r-4.6-arm64)markovchain_0.10.3.tgz(r-4.5-x86_64)markovchain_0.10.3.tgz(r-4.5-arm64)
markovchain_0.10.3.tar.gz(r-4.7-arm64)markovchain_0.10.3.tar.gz(r-4.7-x86_64)markovchain_0.10.3.tar.gz(r-4.6-arm64)markovchain_0.10.3.tar.gz(r-4.6-x86_64)
markovchain_0.10.3.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
markovchain/json (API)

# Install 'markovchain' in R:
install.packages('markovchain', repos = c('https://spedygiorgio.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/spedygiorgio/markovchain/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:
  • blanden - Mobility between income quartiles
  • craigsendi - CD4 cells counts on HIV Infects between zero and six month
  • holson - Holson data set
  • kullback - Example from Kullback and Kupperman Tests for Contingency Tables
  • preproglucacon - Preprogluccacon DNA protein bases sequences
  • rain - Alofi island daily rainfall
  • sales - Sales Demand Sequences
  • tm_abs - Single Year Corporate Credit Rating Transititions

On CRAN:

Conda:

ctmcdtmcmarkov-chainmarkov-modelr-programmingrcppopenblascpp

12.82 score 113 stars 4 packages 896 scripts 7.2k downloads 9 mentions 65 exports 15 dependencies

Last updated from:1ae4487e59. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK230
linux-devel-x86_64OK220
source / vignettesOK349
linux-release-arm64OK234
linux-release-x86_64OK223
macos-release-arm64OK228
macos-release-x86_64OK291
macos-oldrel-arm64OK295
macos-oldrel-x86_64OK345
windows-develOK183
windows-releaseOK272
windows-oldrelOK196
wasm-releaseOK206

Exports:absorbingStatesabsorptionProbabilitiesassessOrderassessStationaritycanonicFormcoercecommittorABcommunicatingClassesconditionalDistributioncreateSequenceMatrixctmcFitexpectedRewardsexpectedRewardsBeforeHittingAExpectedTimefirstPassagefirstPassageMultiplefitHigherOrderfitHighOrderMultivarMCfreq2GeneratorgeneratorToTransitionMatrixhittingProbabilitiesimpreciseProbabilityatTinferHyperparamis.accessibleis.CTMCirreducibleis.irreducibleis.regularis.TimeReversiblemarkovchainFitmarkovchainListFitmarkovchainSequencemeanAbsorptionTimemeanFirstPassageTimemeanNumVisitsmeanRecurrenceTimemultinomialConfidenceIntervalsnamename<-noofVisitsDistperiodplotpredictpredictHommcpredictiveDistributionprintpriorDistributionprobabilityatTrctmcrecurrentClassesrecurrentStatesrmarkovchainseq2freqProbseq2matHighshowstatessteadyStatessummaryttransientClassestransientStatestransition2GeneratortransitionProbabilityverifyEmpiricalToTheoreticalverifyHomogeneityverifyMarkovProperty

Dependencies:clicpp11expmglueigraphlatticelifecyclemagrittrMatrixpkgconfigRcppRcppArmadilloRcppParallelrlangvctrs

The markovchain Package: A Package for Easily Handling Discrete Markov Chains in R
Introduction | Review of core mathematical concepts | General Definitions | Properties and classification of states | A short example | The structure of the package | Creating markovchain objects | Handling markovchain objects | Probability with markovchain objects | Conditional distributions | Stationary states | Classification of states | First passage time distributions and means | Mean recurrence time | Absorption probabilities and mean absorption time | Committor probability | Hitting probabilities | Statistical analysis | Simulation | Estimation | Prediction | Predicting from a markovchain object | Predicting from a markovchainList object | Statistical Tests | Assessing the Markov property of a Markov chain sequence | Assessing the order of a Markov chain sequence | Assessing the stationarity of a Markov chain sequence | Divergence tests for empirically estimated transition matrices | Continuous Times Markov Chains | Intro | Stationary Distributions | Expected Hitting Time | Probability at time t | Examples | Pseudo - Bayesian Estimation | Bayesian Estimation | Notation and set-up | Methods | Predictive distribution | Choosing the hyper-parameters | Usage and examples | Applications | Weather forecasting | Land of Oz | Alofi Island Rainfall | Finance and Economics | Finance | Economics | Actuarial science | MPTL Bonus Malus | Health insurance example | Sociology | Genetics and Medicine | Genetics | Medicine | Discussion, issues and future plans | Acknowledgments | References

Last update: 2024-10-07
Started: 2018-12-31

Higher order Markov chains
Higher Order Markov Chains | Higher Order Multivariate Markov Chains | Introduction | Representation of parameters in the code | Definition of HOMMC class | How to create an object of class HOMMC | Fit HOMMC | A Marketing Example | References

Last update: 2024-02-25
Started: 2018-12-31

Google Summer of Code 2017 Additions
Expected Hitting Time using CTMC | Calculating Probability at time T using ctmc | Plotting generator matrix of continuous-time markovchains | Imprecise Continuous-Time Markov chains | Types of ICTMCs | Lower Transition Rate Operators for ICTMCs | Lower Transition Operators | ImpreciseprobabilityatT function | Continuous time markovchain generator using frequency Matrix | Committor of a markovchain | First Passage probability for set of states | Joint PDF of number of visits to the various states of a markovchain | Expected Rewards for a markovchain | Expected Rewards for a set of states in a markovchain process | Checking Irreducibly of a CTMC | Simulation of Higher Order Multivariate Markovchains | Check Time Reversibility of Continuous-time markovchains | References

Last update: 2024-02-25
Started: 2019-07-21

Readme and manuals

Help Manual

Help pageTopics
Easy Handling Discrete Time Markov Chainsmarkovchain-package markovchain
Absorption probabilitiesabsorptionProbabilities
Mobility between income quartilesblanden
Calculates committor of a markovchain object with respect to set A, BcommittorAB
'conditionalDistribution' of a Markov ChainconditionalDistribution
CD4 cells counts on HIV Infects between zero and six monthcraigsendi
Function to fit a discrete Markov chaincreateSequenceMatrix markovchainFit
Continuous time Markov Chains classctmc-class dim,ctmc-method initialize,ctmc_method plot,ctmc,missing-method states,ctmc-method steadyStates,ctmc-method
Function to fit a CTMCctmcFit
Expected Rewards for a markovchainexpectedRewards
Expected first passage Rewards for a set of states in a markovchainexpectedRewardsBeforeHittingA
Returns expected hitting time from state i to state jExpectedTime
First passage across statesfirstPassage
function to calculate first passage probabilitiesfirstPassageMultiple
Functions to fit a higher order Markov chainfitHigherOrder seq2freqProb seq2matHigh
Function to fit Higher Order Multivariate Markov chainfitHighOrderMultivarMC
Returns a generator matrix corresponding to frequency matrixfreq2Generator
Function to obtain the transition matrix from the generatorgeneratorToTransitionMatrix
Higher order Markov Chains classHigherOrderMarkovChain-class
Hitting probabilities for markovchainhittingProbabilities
Holson data setholson
An S4 class for representing High Order Multivariate Markovchain (HOMMC)hommc hommc-class
An S4 class for representing Imprecise Continuous Time Markovchainsictmc ictmc-class
Calculating full conditional probability using lower rate transition matriximpreciseProbabilityatT
Function to infer the hyperparameters for Bayesian inference from an a priori matrix or a data setinferHyperparam
Verify if a state j is reachable from state i.is.accessible
Check if CTMC is irreducibleis.CTMCirreducible
Function to check if a Markov chain is irreducible (i.e. ergodic)is.irreducible
Check if a DTMC is regularis.regular
checks if ctmc object is time reversibleis.TimeReversible
Example from Kullback and Kupperman Tests for Contingency Tableskullback
Markov Chain class!=,markovchain,markovchain-method *,markovchain,markovchain-method *,markovchain,matrix-method *,markovchain,numeric-method *,matrix,markovchain-method *,numeric,markovchain-method ==,markovchain,markovchain-method absorbingStates,markovchain-method absorptionProbabilities,markovchain-method canonicForm,markovchain-method coerce,data.frame,markovchain-method coerce,etm,markovchain-method coerce,markovchain,data.frame-method coerce,markovchain,igraph-method coerce,markovchain,matrix-method coerce,markovchain,sparseMatrix-method coerce,Matrix,markovchain-method coerce,matrix,markovchain-method coerce,msm,markovchain-method coerce,msm.est,markovchain-method coerce,sparseMatrix,markovchain-method coerce,table,markovchain-method communicatingClasses,markovchain-method conditionalDistribution,markovchain-method dim,markovchain-method hittingProbabilities,markovchain-method initialize,markovchain-method is.accessible,markovchain,character,character-method is.accessible,markovchain,missing,missing-method is.irreducible,markovchain-method is.regular,markovchain-method markovchain-class meanAbsorptionTime,markovchain-method meanFirstPassageTime,markovchain,character-method meanFirstPassageTime,markovchain,missing-method meanNumVisits,markovchain-method meanRecurrenceTime,markovchain-method names<-,markovchain-method plot,markovchain,missing-method predict,markovchain-method print,markovchain-method recurrentClasses,markovchain-method recurrentStates,markovchain-method show,markovchain-method sort,markovchain-method steadyStates,markovchain-method summary,markovchain-method t,markovchain-method transientClasses,markovchain-method transientStates,markovchain-method [,markovchain,ANY,ANY,ANY-method ^,markovchain,numeric-method
Non homogeneus discrete time Markov Chains classdim,markovchainList-method markovchainList-class predict,markovchainList-method print,markovchainList-method show,markovchainList-method [[,markovchainList-method
markovchainListFitmarkovchainListFit
Function to generate a sequence of states from homogeneous Markov chains.markovchainSequence
Mean absorption timemeanAbsorptionTime
Mean First Passage Time for irreducible Markov chainsmeanFirstPassageTime
Mean num of visits for markovchain, starting at each statemeanNumVisits
Mean recurrence timemeanRecurrenceTime
A function to compute multinomial confidence intervals of DTMCmultinomialConfidenceIntervals
Method to retrieve name of markovchain objectname name,markovchain-method
Method to set name of markovchain objectname<- name<-,markovchain-method
Returns the states for a Markov chain objectnames,markovchain-method
return a joint pdf of the number of visits to the various states of the DTMCnoofVisitsDist
Returns an Identity matrixones
Various function to perform structural analysis of DTMCabsorbingStates canonicForm communicatingClasses period recurrentClasses recurrentStates transientClasses transientStates
Simulate a higher order multivariate markovchainpredictHommc
predictiveDistributionpredictiveDistribution
Preprogluccacon DNA protein bases sequencespreproglucacon
priorDistributionpriorDistribution
Calculating probability from a ctmc objectprobabilityatT
Alofi island daily rainfallrain
rctmcrctmc
Function to generate a sequence of states from homogeneous or non-homogeneous Markov chains.rmarkovchain
Sales Demand Sequencessales
Function to display the details of hommc objectshow,hommc-method
Defined states of a transition matrixstates states,markovchain-method
Stationary states of a 'markovchain' objectsteadyStates
Single Year Corporate Credit Rating Transititionstm_abs
Return the generator matrix for a corresponding transition matrixtransition2Generator
Function to get the transition probabilities from initial to subsequent states.transitionProbability transitionProbability,markovchain-method
Various functions to perform statistical inference of DTMCassessOrder assessStationarity verifyEmpiricalToTheoretical verifyHomogeneity verifyMarkovProperty
Matrix to create zeroszeros