Package: markovchain 1.2

Giorgio Alfredo Spedicato
markovchain: Easy Handling Discrete Time Markov Chains
Description: Functions and S4 classes to create, manage and analyse discrete time Markov chains. Includes probabilistic analysis of chain structure (state classification, hitting times, stationary distributions, spectral and mixing diagnostics), statistical inference (maximum likelihood and Bayesian estimation, tests of the Markov property, homogeneity, stationarity and order, simulation), higher-order and multivariate chains, state aggregation, and import/export to JSON, YAML and CSV. Basic support for continuous time Markov chains is also provided; some of these functions depend on the suggested 'ctmcd' package. See Spedicato (2017) <doi:10.32614/RJ-2017-036>.
Authors:
markovchain_1.2.tar.gz
markovchain_1.2.zip(r-4.7-x86_64)markovchain_1.2.zip(r-4.7-arm64)markovchain_1.2.zip(r-4.6-x86_64)markovchain_1.2.zip(r-4.6-arm64)markovchain_1.2.zip(r-4.5-x86_64)
markovchain_1.2.tgz(r-4.6-x86_64)markovchain_1.2.tgz(r-4.6-arm64)markovchain_1.2.tgz(r-4.5-x86_64)markovchain_1.2.tgz(r-4.5-arm64)
markovchain_1.2.tar.gz(r-4.7-arm64)markovchain_1.2.tar.gz(r-4.7-x86_64)markovchain_1.2.tar.gz(r-4.6-arm64)markovchain_1.2.tar.gz(r-4.6-x86_64)
markovchain_1.2.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
- 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
ctmcdtmcmarkov-chainmarkov-modelr-programmingrcppquartoopenblascpp
Last updated from:a796eb9486. Checks:13 OK, 2 ERROR. Indexed: yes.
| Target | Result | Time | Files | Syslog |
|---|---|---|---|---|
| linux-devel-arm64 | OK | 218 | ||
| linux-devel-x86_64 | OK | 273 | ||
| source / vignettes | OK | 365 | ||
| linux-release-arm64 | OK | 257 | ||
| linux-release-x86_64 | OK | 256 | ||
| macos-release-arm64 | OK | 255 | ||
| macos-release-x86_64 | OK | 630 | ||
| macos-oldrel-arm64 | OK | 279 | ||
| macos-oldrel-x86_64 | OK | 353 | ||
| windows-devel-arm64 | ERROR | 473 | ||
| windows-devel-x86_64 | OK | 295 | ||
| windows-release-arm64 | ERROR | 451 | ||
| windows-release-x86_64 | OK | 294 | ||
| windows-oldrel-x86_64 | OK | 283 | ||
| wasm-release | OK | 127 |
Exports:.markovchainFitRcppabsorbingStatesabsorptionProbabilitiesaggregateStatesassessIndependenceassessOrderassessStationarityautoLumpbirthDeathcanonicFormclosestReversiblecoercecommittorABcommunicatingClassesconditionalDistributioncreateSequenceMatrixctmcFitdirichletChainentropyRateexpectedRewardsexpectedRewardsBeforeHittingAExpectedTimefirstPassagefirstPassageMultiplefitHigherOrderfitHighOrderMultivarMCfitMTDfreq2GeneratorfromDictionaryfromFilefundamentalMatrixgamblersRuingeneratorToTransitionMatrixhigherOrderLogLikhigherOrderPredicthigherOrderSimulatehittingProbabilitieshommcidentityChainimpliedTimescalesimpreciseProbabilityatTinferHyperparamis.accessibleis.CTMCirreducibleis.irreducibleis.lumpableis.regularis.reversibleis.stochasticallyMonotoneis.TimeReversiblekemenyConstantlazyChainlumpmarkovchainFitmarkovchainListFitmarkovchainSequencemeanAbsorptionTimemeanFirstPassageTimemeanNumVisitsmeanRecurrenceTimemergeWithmixingTimemultinomialConfidenceIntervalsnamename<-noofVisitsDistnormalizedEntropyRateperiodplotpopulationGeneticsModelpredictpredictHommcpredictiveDistributionprintpriorDistributionprobabilityatTrandomMarkovChainrctmcrecurrentClassesrecurrentStatesredistributerelaxationTimermarkovchainrouwenhorstselectOrdersensitivityseq2freqProbseq2matHighshowslemspectralGapstatessteadyStatessubchainsummaryttauchentimeCorrelationstimeRelaxationstoBoundedChaintoDictionarytoDottoFiletoMermaidtoNthOrdertopologicalEntropytransientClassestransientStatestransition2GeneratortransitionProbabilityurnModelverifyEmpiricalToTheoreticalverifyHomogeneityverifyMarkovProperty
Dependencies:clicpp11expmglueigraphlatticelifecyclemagrittrMatrixpkgconfigRcppRcppArmadilloRcppParallelrlangvctrs
Last update: 2026-10-08
Started: 2018-12-31
Last update: 2026-10-08
Started: 2026-08-15
Last update: 2026-10-08
Started: 2026-08-15
Readme and manuals
Help Manual
| Help page | Topics |
|---|---|
| Easy Handling Discrete Time Markov Chains | markovchain-package markovchain |
| Absorption probabilities | absorptionProbabilities |
| Aggregate a Markov chain's state space by Kullback-Leibler minimization | aggregateStates aggregateStates,markovchain-method |
| Test independence of consecutive states of an empirical sequence | assessIndependence |
| Automatically aggregate a Markov chain by spectral clustering | autoLump autoLump,markovchain-method |
| Plot a Markov chain with ggplot2 | autoplot.markovchain |
| Build a birth-death Markov chain | birthDeath |
| Mobility between income quartiles | blanden |
| Closest reversible approximation of a Markov chain | closestReversible closestReversible,markovchain-method |
| Calculates committor of a markovchain object with respect to set A, B | committorAB |
| 'conditionalDistribution' of a Markov Chain | conditionalDistribution |
| CD4 cells counts on HIV Infects between zero and six month | craigsendi |
| Continuous time Markov Chains class | ctmc-class dim,ctmc-method initialize,ctmc_method plot,ctmc,missing-method states,ctmc-method steadyStates,ctmc-method |
| Function to fit a CTMC | ctmcFit |
| Markov chain from a Dirichlet process | dirichletChain |
| Entropy rate of a Markov chain | entropyRate entropyRate,markovchain-method |
| Expected Rewards for a markovchain | expectedRewards |
| Expected first passage Rewards for a set of states in a markovchain | expectedRewardsBeforeHittingA |
| Returns expected hitting time from state i to state j | ExpectedTime |
| First passage across states | firstPassage |
| function to calculate first passage probabilities | firstPassageMultiple |
| Functions to fit a higher order Markov chain | fitHigherOrder seq2freqProb seq2matHigh |
| Function to fit Higher Order Multivariate Markov chain | fitHighOrderMultivarMC |
| Fit a mixture transition distribution (MTD) model | fitMTD |
| Returns a generator matrix corresponding to frequency matrix | freq2Generator |
| Fundamental matrix of an absorbing Markov chain | fundamentalMatrix |
| Build a gambler's ruin Markov chain | gamblersRuin |
| Function to obtain the transition matrix from the generator | generatorToTransitionMatrix |
| Log-likelihood, deviance and information criteria of a higher order Markov chain | higherOrderLogLik |
| Higher order Markov Chains class | HigherOrderMarkovChain-class |
| Next-state probabilities and simulation for higher order Markov chains | higherOrderPredict higherOrderSimulate |
| Hitting probabilities for markovchain | hittingProbabilities |
| Holson data set | holson |
| An S4 class for representing High Order Multivariate Markovchain (HOMMC) | hommc hommc-class |
| An S4 class for representing Imprecise Continuous Time Markovchains | ictmc ictmc-class |
| Identity Markov chain | identityChain |
| Implied timescales of a Markov chain | impliedTimescales impliedTimescales,markovchain-method |
| Calculating full conditional probability using lower rate transition matrix | impreciseProbabilityatT |
| Function to infer the hyperparameters for Bayesian inference from an a priori matrix or a data set | inferHyperparam |
| Verify if a state j is reachable from state i. | is.accessible |
| Check if CTMC is irreducible | is.CTMCirreducible |
| Function to check if a Markov chain is irreducible (i.e. ergodic) | is.irreducible |
| Check exact lumpability of a Markov chain | is.lumpable is.lumpable,markovchain-method |
| Check if a DTMC is regular | is.regular |
| Check whether a Markov chain is reversible | is.reversible is.reversible,markovchain-method |
| Check if a Markov chain is stochastically monotone | is.stochasticallyMonotone is.stochasticallyMonotone,ANY-method is.stochasticallyMonotone,markovchain-method is.stochasticallyMonotone,matrix-method |
| checks if ctmc object is time reversible | is.TimeReversible |
| Kemeny's constant of a Markov chain | kemenyConstant kemenyConstant,markovchain-method |
| Example from Kullback and Kupperman Tests for Contingency Tables | kullback |
| Build a lazy version of a Markov chain | lazyChain lazyChain,markovchain-method |
| Aggregate a Markov chain over a partition | lump lump,markovchain-method |
| 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 |
| Function to fit a discrete Markov chain | .markovchainFitRcpp createSequenceMatrix markovchainFit |
| Non homogeneus discrete time Markov Chains class | dim,markovchainList-method markovchainList-class predict,markovchainList-method print,markovchainList-method show,markovchainList-method [[,markovchainList-method |
| markovchainListFit | markovchainListFit |
| Function to generate a sequence of states from homogeneous Markov chains. | markovchainSequence |
| Mean absorption time | meanAbsorptionTime |
| Mean First Passage Time for irreducible Markov chains | meanFirstPassageTime |
| Mean num of visits for markovchain, starting at each state | meanNumVisits |
| Mean recurrence time | meanRecurrenceTime |
| Merge two Markov chains by convex combination of their transition matrices | mergeWith mergeWith,markovchain,markovchain-method |
| Mixing time of a Markov chain | mixingTime mixingTime,markovchain-method |
| A function to compute multinomial confidence intervals of DTMC | multinomialConfidenceIntervals |
| Method to retrieve name of markovchain object | name name,markovchain-method |
| Method to set name of markovchain object | name<- name<-,markovchain-method |
| Returns the states for a Markov chain object | names,markovchain-method |
| Expected fraction of the first N steps spent in each state | noofVisitsDist |
| Normalized entropy rate of a Markov chain | normalizedEntropyRate normalizedEntropyRate,markovchain-method |
| Returns an Identity matrix | ones |
| Various function to perform structural analysis of DTMC | absorbingStates canonicForm communicatingClasses period recurrentClasses recurrentStates transientClasses transientStates |
| Build a population-genetics Markov chain (Moran or Wright-Fisher) | populationGeneticsModel |
| Simulate a higher order multivariate markovchain | predictHommc |
| predictiveDistribution | predictiveDistribution |
| Preprogluccacon DNA protein bases sequences | preproglucacon |
| priorDistribution | priorDistribution |
| Calculating probability from a ctmc object | probabilityatT |
| Alofi island daily rainfall | rain |
| Random Markov chain | randomMarkovChain |
| rctmc | rctmc |
| Evolution of a distribution over time | redistribute redistribute,markovchain-method |
| Relaxation time of a Markov chain | relaxationTime relaxationTime,markovchain-method |
| Function to generate a sequence of states from homogeneous or non-homogeneous Markov chains. | rmarkovchain |
| Discretize an AR(1) process into a Markov chain (Rouwenhorst's method) | rouwenhorst |
| Sales Demand Sequences | sales |
| Select the order of a Markov chain by information criteria | selectOrder |
| Sensitivity of the stationary distribution to a state's transition row | sensitivity sensitivity,markovchain-method |
| Function to display the details of hommc object | show,hommc-method |
| Second largest eigenvalue modulus (SLEM) of a Markov chain | slem slem,markovchain-method |
| Spectral gap of a Markov chain | spectralGap spectralGap,markovchain-method |
| Defined states of a transition matrix | states states,markovchain-method |
| Stationary states of a 'markovchain' object | steadyStates |
| Restrict a Markov chain to a subset of states | subchain subchain,markovchain-method |
| Discretize an AR(1) process into a Markov chain (Tauchen's method) | tauchen |
| Time correlations and time relaxations of observed sequences | timeCorrelations timeCorrelations,markovchain-method timeRelaxations timeRelaxations,markovchain-method |
| Single Year Corporate Credit Rating Transititions | tm_abs |
| Apply a boundary condition to a Markov chain's first and last state | toBoundedChain toBoundedChain,markovchain-method |
| Represent a Markov chain as a plain R list | fromDictionary toDictionary toDictionary,markovchain-method |
| Export the transition graph as Graphviz DOT or Mermaid text | toDot toDot,markovchain-method toMermaid toMermaid,markovchain-method |
| Write or read a Markov chain to or from a file | fromFile toFile toFile,markovchain-method |
| Return the n-step transition chain | toNthOrder |
| Topological entropy of a Markov chain | topologicalEntropy topologicalEntropy,markovchain-method |
| Return the generator matrix for a corresponding transition matrix | transition2Generator |
| Function to get the transition probabilities from initial to subsequent states. | transitionProbability transitionProbability,markovchain-method |
| Build an Ehrenfest urn model Markov chain | urnModel |
| Test the first-order Markov property of an empirical sequence | assessOrder assessStationarity verifyEmpiricalToTheoretical verifyHomogeneity verifyMarkovProperty |
| Matrix to create zeros | zeros |