IDEAS home Printed from https://ideas.repec.org/c/boc/bocode/s459454.html
 

MARKOVFIRSTORDER: Stata module for assessing whether a sequence follows an independent state model or a first-order Markov chain model

Author

Listed:
  • Ariel Linden

    (Linden Consulting Group, LLC)

Programming Language

Stata

Abstract

markovfirstorder assesses whether a sequence of values follows an independent state model or a first-order Markov chain model (Avery and Henderson 1999). An independent state model assumes that the state in a particular position of the sequence is independent of the previous state. An independent state model is presented as a two-way table and evaluated using Pearson's chi-squared statistic. A statistically significant chi-squared indicates that the hypothesis of independent successive states should be rejected. Next, a first-order Markov chain model is assessed by analyzing a three-way table of the number of times that triplet (i, j, k) occurs where i, j, k = 1, 2, . . ., b. The Pearson's chi-squared statistic for a first-order Markov chain model is computed by summing the chi-squared statistic over all triplets (i, j, k), and where the degrees of freedom = k * (k - 1)^2. A statistically significant chi-squared statistic indicates that the sequence follows a higher order than a first-order Markov chain model. See Avery and Henderson (1999) for a comprehensive discussion.

Suggested Citation

  • Ariel Linden, 2025. "MARKOVFIRSTORDER: Stata module for assessing whether a sequence follows an independent state model or a first-order Markov chain model," Statistical Software Components S459454, Boston College Department of Economics, revised 12 May 2025.
  • Handle: RePEc:boc:bocode:s459454
    Note: This module should be installed from within Stata by typing "ssc install markovfirstorder". The module is made available under terms of the GPL v3 (https://www.gnu.org/licenses/gpl-3.0.txt). Windows users should not attempt to download these files with a web browser.
    as

    Download full text from publisher

    File URL: http://fmwww.bc.edu/repec/bocode/m/markovfirstorder.ado
    File Function: program code
    Download Restriction: no

    File URL: http://fmwww.bc.edu/repec/bocode/m/markovfirstorder.sthlp
    File Function: help file
    Download Restriction: no

    File URL: http://fmwww.bc.edu/repec/bocode/m/matchi2.ado
    File Function: program code
    Download Restriction: no

    File URL: http://fmwww.bc.edu/repec/bocode/m/matchi2.sthlp
    File Function: help file
    Download Restriction: no

    File URL: http://fmwww.bc.edu/repec/bocode/a/Avery_preproglucacon.dta
    File Function: sample data set
    Download Restriction: no
    ---><---

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:boc:bocode:s459454. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Christopher F Baum (email available below). General contact details of provider: https://edirc.repec.org/data/debocus.html .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.