IDEAS home Printed from
   My bibliography  Save this paper

Adaptive Markov chain Monte Carlo sampling and estimation in Mata



I describe algorithms for drawing from distributions using adaptive Markov chain Monte Carlo (MCMC) methods, introduce a Mata function for per- forming adaptive MCMC, amcmc(), and a suite of functions amcmc_*() allowing an implementation of adaptive MCMC using a structure. To ease use in application to estimation problems, amcmc() and amcmc_*() can be used in conjunction with models set up to work with Mata’s moptimize( ) or optimize( ), or with stand-alone functions. I apply the routines in a simple estimation problem, in drawing from a distributions without a normalizing constant, and in Bayesian estimation of a mixed logit model.

Suggested Citation

  • Matthew J. Baker, 2013. "Adaptive Markov chain Monte Carlo sampling and estimation in Mata," Economics Working Paper Archive at Hunter College 440, Hunter College Department of Economics.
  • Handle: RePEc:htr:hcecon:440

    Download full text from publisher

    File URL:
    Download Restriction: no

    Other versions of this item:

    References listed on IDEAS

    1. Chernozhukov, Victor & Hong, Han, 2003. "An MCMC approach to classical estimation," Journal of Econometrics, Elsevier, vol. 115(2), pages 293-346, August.
    2. Powell, James L., 1984. "Least absolute deviations estimation for the censored regression model," Journal of Econometrics, Elsevier, vol. 25(3), pages 303-325, July.
    3. Train,Kenneth E., 2009. "Discrete Choice Methods with Simulation," Cambridge Books, Cambridge University Press, number 9780521747387, November.
    4. Arne Risa Hole, 2007. "Fitting mixed logit models by using maximum simulated likelihood," Stata Journal, StataCorp LP, vol. 7(3), pages 388-401, September.
    Full references (including those not matched with items on IDEAS)


    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.

    Cited by:

    1. Matthew J. Baker, 2023. "Using bayesmixedlogit and bayesmixedlogitwtp in Stata," Papers 2302.01775,
    2. Erik Figueiredo & Luiz Renato Lima & Gianluca Orefice, 2016. "Migration and Regional Trade Agreements: A (New) Gravity Estimation," Review of International Economics, Wiley Blackwell, vol. 24(1), pages 99-125, February.
    3. Sunny Kumar Singh & Chandan Kumar Jha, 2023. "Are financial development and financial stability complements or substitutes in poverty reduction?," The European Journal of Finance, Taylor & Francis Journals, vol. 29(17), pages 2001-2031, November.
    4. Tu D. Q. Le & Thanh Ngo & Tin H. Ho & Dat T. Nguyen, 2022. "ICT as a Key Determinant of Efficiency: A Bootstrap-Censored Quantile Regression (BCQR) Analysis for Vietnamese Banks," IJFS, MDPI, vol. 10(2), pages 1-15, June.
    5. BELAÏD, Fateh & Elsayed, Ahmed H. & Omri, Anis, 2021. "Key drivers of renewable energy deployment in the MENA Region: Empirical evidence using panel quantile regression," Structural Change and Economic Dynamics, Elsevier, vol. 57(C), pages 225-238.
    6. Fateh Belaid & Ahmed H. Elsayed, 2019. "What drives renewable energy production in MENA Region? Investigating the roles of political stability, governance and financial sector," Working Papers 1322, Economic Research Forum, revised 21 Aug 2019.
    7. O.S. Mariev & N.B. Davidson & O.S. Emelianova, 2020. "The Impact of Urbanization on Carbon Dioxide Emissions in the Regions of Russia," Journal of Applied Economic Research, Graduate School of Economics and Management, Ural Federal University, vol. 19(3), pages 286-309.
    8. Panagiotidis, Theodore & Printzis, Panagiotis, 2021. "Investment and uncertainty: Are large firms different from small ones?," Journal of Economic Behavior & Organization, Elsevier, vol. 184(C), pages 302-317.
    9. Choudhury, Atrayee & Sahu, Sohini, 2023. "Reconciling the mixed evidence in the fiscal decentralization-government size nexus using panel quantile regression," Economic Modelling, Elsevier, vol. 125(C).
    10. Pourya Valizadeh & Travis A Smith, 2020. "How Did The American Recovery and Reinvestment Act Affect the Material Well‐Being of SNAP Participants? A Distributional Approach," Applied Economic Perspectives and Policy, John Wiley & Sons, vol. 42(3), pages 455-476, September.
    11. Andrew Myburgh & Jordi Paniagua, 2016. "Does International Commercial Arbitration Promote Foreign Direct Investment?," Journal of Law and Economics, University of Chicago Press, vol. 59(3), pages 597-627.
    12. Ryan A. Fitch & Julie M. Mueller & Rebecca Ruiz & Wade Rousse, 2022. "Recreation Matters: Estimating Millennials’ Preferences for Native American Cultural Tourism," Sustainability, MDPI, vol. 14(18), pages 1-11, September.
    13. Mallela, Keerti & Singh, Sunny Kumar & Srivastava, Archana, 2023. "Remittances, financial development, and income inequality: A panel quantile regression approach," International Economics, Elsevier, vol. 175(C), pages 171-186.
    14. Panagiotidis, Theodore & Printzis, Panagiotis, 2021. "Investment and uncertainty: Are large firms different from small ones?," Journal of Economic Behavior & Organization, Elsevier, vol. 184(C), pages 302-317.
    15. Cuadros, Ana & Martín-Montaner, Joan & Paniagua, Jordi, 2019. "Migration and FDI: The role of job skills," International Review of Economics & Finance, Elsevier, vol. 59(C), pages 318-332.
    16. Valizadeh, Pourya & Smith, Travis A., 2017. "How Did the American Recovery and Reinvestment Act (ARRA) Impact the Material Well-being of SNAP Participants? A Distributional Approach," 2017 Annual Meeting, July 30-August 1, Chicago, Illinois 258496, Agricultural and Applied Economics Association.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Yamada, Katsunori & Sato, Masayuki, 2013. "Another avenue for anatomy of income comparisons: Evidence from hypothetical choice experiments," Journal of Economic Behavior & Organization, Elsevier, vol. 89(C), pages 35-57.
    2. Grzybowski, Lukasz & Hasbi, Maude & Liang, Julienne, 2018. "Transition from copper to fiber broadband: The role of connection speed and switching costs," Information Economics and Policy, Elsevier, vol. 42(C), pages 1-10.
    3. Carlos Omar Trejo-Pech & Roselia Servín-Juárez & Álvaro Reyes-Duarte, 2023. "What sets cooperative farmers apart from non-cooperative farmers? A transaction cost economics analysis of coffee farmers in Mexico," Agricultural and Food Economics, Springer;Italian Society of Agricultural Economics (SIDEA), vol. 11(1), pages 1-24, December.
    4. Carlos Barros, 2012. "Sustainable Tourism in Inhambane-Mozambique," CEsA Working Papers 105, CEsA - Centre for African and Development Studies.
    5. Parente, Paulo M.D.C. & Smith, Richard J., 2011. "Gel Methods For Nonsmooth Moment Indicators," Econometric Theory, Cambridge University Press, vol. 27(1), pages 74-113, February.
    6. Wu Wang & Zhongyi Zhu, 2017. "Conditional empirical likelihood for quantile regression models," Metrika: International Journal for Theoretical and Applied Statistics, Springer, vol. 80(1), pages 1-16, January.
    7. Arne Hole & Julie Kolstad, 2012. "Mixed logit estimation of willingness to pay distributions: a comparison of models in preference and WTP space using data from a health-related choice experiment," Empirical Economics, Springer, vol. 42(2), pages 445-469, April.
    8. Yan, Zhen & Zhou, Jie-hong, 2015. "Measuring consumer heterogeneous preferences for pork traits under media reports: choice experiment in sixteen traceability pilot cities, China," 2015 Conference, August 9-14, 2015, Milan, Italy 212609, International Association of Agricultural Economists.
    9. Rimjha, Mihir & Hotle, Susan & Trani, Antonio & Hinze, Nicolas, 2021. "Commuter demand estimation and feasibility assessment for Urban Air Mobility in Northern California," Transportation Research Part A: Policy and Practice, Elsevier, vol. 148(C), pages 506-524.
    10. Szabó, Andrea & Pham, Vinh, 2022. "Net neutrality and consumer demand in the video on-demand market," Information Economics and Policy, Elsevier, vol. 61(C).
    11. Gantchev, Nickolay, 2013. "The costs of shareholder activism: Evidence from a sequential decision model," Journal of Financial Economics, Elsevier, vol. 107(3), pages 610-631.
    12. Malmendier, Ulrike M. & Botsch, Matthew J., 2020. "The Long Shadows of the Great Inflation: Evidence from Residential Mortgages," CEPR Discussion Papers 14934, C.E.P.R. Discussion Papers.
    13. Johannes Geyer & Thorben Korfhage, 2015. "Long‐term Care Insurance and Carers' Labor Supply – A Structural Model," Health Economics, John Wiley & Sons, Ltd., vol. 24(9), pages 1178-1191, September.
    14. Daniele Pacifico, 2012. "Fitting nonparametric mixed logit models via expectation-maximization algorithm," Stata Journal, StataCorp LP, vol. 12(2), pages 284-298, June.
    15. Meles, Tensay Hadush & Ryan, Lisa & Mukherjee, Sanghamitra C., 2022. "Heterogeneity in preferences for renewable home heating systems among Irish households," Applied Energy, Elsevier, vol. 307(C).
    16. Lippi Bruni, Matteo & Ugolini, Cristina & Verzulli, Rossella, 2021. "Should I wait or should I go? Travelling versus waiting for better healthcare," Regional Science and Urban Economics, Elsevier, vol. 89(C).
    17. Shyamal Chowdhury & J. V. Meenakshi & Keith I. Tomlins & Constance Owori, 2010. "Are Consumers in Developing Countries Willing to Pay More for Micronutrient-Dense Biofortified Foods? Evidence from a Field Experiment in Uganda," American Journal of Agricultural Economics, Agricultural and Applied Economics Association, vol. 93(1), pages 83-97.
    18. Cranford, Matthew & Mourato, Susana, 2014. "Credit-Based Payments for Ecosystem Services: Evidence from a Choice Experiment in Ecuador," World Development, Elsevier, vol. 64(C), pages 503-520.
    19. Carole Ropars-Collet & Mélody Leplat & Philippe Le Goffe & Marie Lesueur, 2015. "La pêche professionnelle est-elle un facteur d’attractivité récréative sur le littoral ?," Revue économique, Presses de Sciences-Po, vol. 66(4), pages 729-754.
    20. Svenningsen, Lea S. & Jacobsen, Jette Bredahl, 2018. "Testing the effect of changes in elicitation format, payment vehicle and bid range on the hypothetical bias for moral goods," Journal of choice modelling, Elsevier, vol. 29(C), pages 17-32.

    More about this item


    Stata; Mata; Markov chain Monte Carlo; drawing from distributions; Bayesian estimation; mixed logit;
    All these keywords.

    JEL classification:

    • C11 - Mathematical and Quantitative Methods - - Econometric and Statistical Methods and Methodology: General - - - Bayesian Analysis: General
    • C13 - Mathematical and Quantitative Methods - - Econometric and Statistical Methods and Methodology: General - - - Estimation: General
    • C15 - Mathematical and Quantitative Methods - - Econometric and Statistical Methods and Methodology: General - - - Statistical Simulation Methods: General
    • C18 - Mathematical and Quantitative Methods - - Econometric and Statistical Methods and Methodology: General - - - Methodolical Issues: General

    NEP fields

    This paper has been announced in the following NEP Reports:


    Access and download statistics


    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:htr:hcecon:440. 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.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with 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: Jonathan Conning (email available below). General contact details of provider: .

    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.