Previous Teaching

Bayesian Learning 2021

Course: BAYESIAN LEARNING  2021 – Professional Master in Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

Teaching assistant: Igor Ferreira Batista Martins – igorfbm@al.insper.edu.br

Syllabus

Midterm exam (take-home) (solution) +

Homework assignments

  1. HW1 (Solution) (Code)
  2. HW2 (Code with solution)
  3. HW3
  4. HW4

Examples developed in class: 

Course notes (+ R code & references)

Additional supporting material

Advanced Bayesian Econometrics 2021

Course: ADVANCED BAYESIAN ECONOMETRICS 2021 – Doctoral Program in Business Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

Objective: The end of the course goal is to allow the student to critically decide between a Bayesian, a frequentist or Bayesian-frequentist compromise when facing real world problems in the fields of micro- and macro-econometrics and finance, as well as in quantitative marketing, strategy and business administration.  With this end in mind, we will visit well known Bayesian issues, such as prior specification and model comparison and model averaging, but also study regularization via Bayesian LASSO, Spike-and-Slab and related schemes, “small n, large p” issues, Bayesian statistical learning via additive regression trees, random forests, large-scale VAR and (dynamic) factor models.

Course description: Basic ingredients: prior, posterior, and predictive distributions, sequential Bayes, conjugate analysis, exchangeability, principles of data reduction and decision theory.  Model criticism: Bayes factor, computing marginal likelihoods, Savage-Dickey ratio, reversible jump MCMC, Bayesian model averaging and deviance information criterion.  Modern computation via (Markov chain) Monte Carlo methods: Monte Carlo integration, sampling-importance resampling, Gibbs sampler, Metropolis-Hastings algorithms.  Mixture models, Hierarchical models, Bayesian regularization, Instrumental variables modeling, Large-scale (sparse) factor modeling, Bayesian additive regression trees (BART) and related topics, Dynamic models, Sequential Monte Carlo algorithms, Bayesian methods in microeconometrics, macroeconometrics, marketing and finance.

  • Part I Bayesian ingredients: i) Inference: likelihood, prior, predictive and posterior distributions; ii) Model criticism: Marginal likelihoods, Bayes factor, model averaging and decision theory; and iii) Computation: An introduction (Markov chain and sequencial) Monte Carlo methods.
  • Part II Multivariate models: i) Large-scale vector autoregressive models; ii) Factor models and other dimension reduction models; and iii) Time-varying high-dimensional covariance models.
  • Part III Modern Bayesian statistical learning: i) Mixture models and the Dirichlet process: handling non-Gaussian models; ii) Regularization: sparsity via shrinkage and variable selection; iii) Large vector-autoregressive and factor models: combining sparsity and parsimony; iv) Classification and support vector machines; v) Regression trees and random forests; and vi) Latent Dirichlet allocation: Text as data, text mining.

Take-home midterm exam: 9am February 18th to 12pm February 20th. (data) (solution)

Homework assignments

  1. HW1 – Due date: February 4th (12pm) (solution)
  2. HW2 – Due date: February 11th (12pm) (solution)
  3. HW3 – Due date: February 18th (9am) (solution + full conditionals + R code)
  4. HW4 – Due date: March 25th (9am) – GPA data + some code: Use the GPA data to fit classical and Bayesian model choice strategies, similar to the ones we discussed in class for the Stock and Waton’s macro data, the Stine & Foster’s automation data and Wooldridge’s wage data.

Paper presentations:  Your task is to read the manuscript very carefully (several times, possibly) and prepare a 20-minute video presentation (no more than 25 minutos!) plus a concise 5-page summary of the manuscript (up to additional 5 pages for tables and graphs) to be sent to me no later than 12pm, April 8th 2021.

Examples developed in class: 

COURSE NOTES

PART I: Bayesian ingredients

  1. Basic Bayes
  2. Exchangeability
  3. Principles of data reduction
  4. More on estimators
  5. Decision theory
  6. Bayesian model criticism (pages 1-6 & 32-34)
  7. Additional reading material:
    • Chapter 2 of Gamerman and Lopes (2006) – Compact, but easy to read.
    • Chapters 2-4 of Migon, Gamerman and Louzada (2014) – Integrates classical and Bayesian inference.
    • Chapter 1 and 2 of Gelman et al. (2013) – Application-oriented.
    • Chapter 4 (Sections 4.1-4.4) of Berger (1985) – More technical.
  8. Discussion about p-values

PART II: Bayesian Computation

  1. Monte Carlo (MC) methods
  2. Markov chain: a brief review
  3. Markov chain Monte Carlo (MCMC) algorithms
  4. Hamiltonian Monte Carlo: A toy example
  5. Stan/rstan for posterior inference: Hamiltonian MC (HMC) methods
  6. MC and MCMC: Key References
  7. More on Bayesian model criticism

PART III: Bayesian Learning

  1. Fundamentos de Aprendizagem Estatística + R code + MC exercise
  2. Multiple linear regression: selection, shrinkage, sparsity
  3. Classification: logistic regression and discriminant analysis
  4. Bayesian factor analysis (BFA)
  5. Principal components analysis (PCA), PCA-based and FA-based regressions
  6. Classification and regression trees (CART)
  7. Bayesian CART
  8. Bootstrap aggregating (bagging)
  9. Bayesian additive regression trees (BART)
  10. Latent Dirichlet Allocation (LDA)
  11. Neural Networks

Complementary material to PART III

  1. Boosting (weak/stronger learners)
  2. Random forests
  3. Bayesian instrumental variables
  4. General linear and hierarchical models
  5. Limited dependent variable models
  6. Finite mixture of distributions
  7. Spatial models
  8. P.Richard Hahn’s top 25 books on Statistics, Causal Inference, Statistical Computing, Machine Learning and Data Science

MATERIAL FROM PREVIOUS YEARS (2018-2020)

Homework assignments and take-home exams

  1. Take-home midterm exam – 2020 (Bruno Levy’s solution + Igor Martins’ solution)
  2. Take-home midterm exam – 2019
  3. Take-home midterm exam – 2018 (Rafael Pucci’s solution + Raphael Gondo’s solution)
  4. HW1 2019: Problems 2.26(a) and 2.26(c) (page 79), 3.1 (pages 106-107), 3.12 (page 110), 5.7 (page 185) and Example 5.1 (pages 143-146) – Gamerman and Lopes (2006) MCMC: Stochastic Simulation for Bayesian Inference. Errata of the numerator of the Bayes Factor of problem 2.26(a) + Errata of the denominator of the Bayes Factor of problem 2.26(a)
  5. HW2 2019: Apply “Machine Learning” tools to the communities data from UCI Machine Learning Repository (http://archive.ics.uci.edu/ml/datasets.html).  See my simple exploratory analysis of the data as a start-up here.

Examples developed in class

  1. Week of 01/13/2020: More on Bernoulli trials
  2. Week of 01/13/2020: Monte Carlo integration and MC via importance sampling
  3. Week of 01/20/2020: Student’s t: learning degree of freedom (Rmarkdown code)
  4. Week of 01/20/2020: Student’s t regression (Rmarkdown code)
  5. Week of 01/20/2020: Tobit linear regression (Dataset)
  6. Week of 01/27/2020: Two-component mixture of univariate Gaussians
  7. Week of 01/27/2020: SIR or Gibbs? The simple N-IG iid case
  8. Week of 01/27/2020: Our first Metropolis-Hastings algorithm
  9. Week of 01/27/2020: Linear model with the normal-gamma (NG) prior
  10. Week of 01/27/2020: Linear model with NG prior: comparing MCMC schemes
  11. Week of 02/03/2020: Bayesian skewed normal regression
  12. Week of 02/03/2020: Model comparison via prior predictives: Normal vs t exercise
  13. Week of 02/17/2020: A few R packages for Bayesian inference in linear models
  14. Week of 02/17/2020: Discussion about the fallacies of p-values
  15. Class of 01/15/2019: Posterior inference for the proportion of Bernoulli trial  (R code)
  16. Week of 01/13/2019: Posterior of proportion of Bernoulli trial  (R code)
  17. Class of 01/17/2019: Model comparison: Gaussian vs Student’s t
  18. Class of 01/24/2019: Multivariate Gaussian: joint vs univariate Gibbs sampling
  19. Class of 01/31/2019: Our 1st Metropolis-Hastings (MH) algorithm
  20. Class of 01/31/2019: Our 2nd MH algorithm – comparing proposals
  21. Class of 01/31/2019: Linear model with AR(1) errors (graphs)
  22. Class of 03/19/2019: Human development index (by municipaliity in Brazil)
  23. Class of May 3rd, 2018: Posterior inference for the variance in the normal case (R markdown code)
  24. Class of May 8th, 2018: Bayesian model comparison (R markdown code)
  25. Class of May 10th, 2018: Poisson model (Count data)(PDF with results)
  26. Class of May 15th, 2018: Beta regression (PDF with results) + Ex 3.6-3.7 from GL(2006)
  27. Class of May 17th, 2018: Comparing MC integration, SIR and Raoblackwellization 
  28. Class of May 22nd, 2018: Bayesian linear regression
  29. Class of May 24th, 2018: Sparse Bayesian linear regression (ridge, Bayesian lasso & horseshoe) – R code
  30. Class of June 14th, 2018: My book chapter on Modern Bayesian Factor Analysis
  31. Class of June 15th, 2018: Mixture of Poisson distributions (Rmd code)
  32. Class of July 2nd, 2018: PCA and FA for term-structure data (dataset)
  33. Class of July 10th, 2018: Bootstrap: sampling distribution of correlation coefficient

Bibliography: Bayesian econometrics

  1. Zellner (1971) An Introduction to Bayesian Inference in Econometrics
  2. Goel and Iyngar (1992) Bayesian Analysis in Statistics and Econometrics
  3. West and Harrison (1997) Bayesian Forecasting and Dynamic Models (2nd edition)
  4. Bauwens, Lubrano and Richard (2000) Bayesian Inference in Dynamic Econometric Models
  5. Koop (2003) Bayesian Econometrics
  6. Geweke (2005) Contemporary Bayesian Econometrics and Statistics
  7. Lancaster (2004) Introduction to Modern Bayesian Econometrics
  8. Rossi, Allenby and McCulloch (2005) Bayesian Statistics and Marketing
  9. Prado and West (2010) Time Series: Modeling, Computation and Inference
  10. Geweke, Koop and Van Dijk (2011) The Oxford Handbook of Bayesian Econometrics
  11. Greenberg (2013) Introduction to Bayesian Econometrics
  12. Herbst and Schorfheide (2015) Bayesian Estimation of DSGE Models
  13. Chan, Koop, Poirier and Tobias (2019) Bayesian Econometric Methods (2nd edition)
  14. Broemeling (2019) Bayesian Analysis of Time Series
  15. Bernardi, Grassi and Ravazzolo (2020) Bayesian Econometrics

Bibliography: Bayesian statistics

  1. Berger (1985) Statistical Decision Theory and Bayesian Analysis
  2. Bernardo and Smith (2000) Bayesian Theory
  3. Gelman and Hill (2006) Data Analysis Using Regression and Multilevel/Hierarchical Models
  4. Robert (2007) The Bayesian Choice: From Decision-Theoretic Foundations to Computational Implementation
  5. Hoff (2009) A First Course in Bayesian Statistical Methods
  6. Carlin and Louis (2009)  Bayesian Methods for Data Analysis (3rd edition)
  7. Gelman, Carlin, Stern, Dunson, Vehtari and Rubin (2016) Bayesian Data Analysis
  8. Migon, Gamerman and Louzada (2015) Statistical Inference: An Integrated Approach (2nd edition)
  9. Reich and Ghosh (2019) Bayesian Statistical Methods
  10. Held and Sabanes-Bove (2020) Likelihood and Bayesian Inference: With Applications in Biology and Medicine

Bibliography: Bayesian computation

  1. Gilks, Richardson and Spiegelhalter (1995) Markov Chain Monte Carlo in Practice
  2. Doucet, de Freitas and Gordon (2001) Sequential Monte Carlo Methods in Practice
  3. Robert and Casella (2004) Monte Carlo Statistical Methods (2nd edition)
  4. Gamerman and Lopes (2006) MCMC: Stochastic Simulation for Bayesian Inference, Second Edition
  5. Marin and Robert (2007) Bayesian Core: A Practical Approach to Computational Bayesian Statistics
  6. Albert (2009) Bayesian Computation with R
  7. Brooks, Gelman, Jones and Meng (2011) Handbook of Markov Chain Monte Carlo
  8. Givens and Hoeting (2012) Computational Statistics (2nd edition)
  9. Marin and Robert (2014) Bayesian Essentials with R (complete solution manual)
  10. Turkman, Paulino and Mueller (2019) Computational Bayesian Statistics: An Introduction
  11. McElreath (2020) Statistical Rethinking: A Bayesian course with Examples in R and STAN
  12. Chopin and Papaspiliopoulos (2020) An Introduction to Sequential Monte Carlo

Bibliography: (Bayesian) statistical learning

  1. Bishop (2006) Pattern Recognition and Machine Learning
  2. Hastie, Tibshirani and Friedman (2008) The Elements of Statistical Learning, 2nd edition
  3. Murphy (2012) Machine Learning: A Probabilistic Perspective
  4. Barber (2012) Bayesian Reasoning and Machine Learning
  5. James, Witten, Hastie and Tibshirani (2013) An Introduction to Statistical Learning
  6. Hastie, Tibshirani and Wainwright (2015) Statistical Learning with Sparsity
  7. Efron and Hastie (2016) Computer Age Statistical Inference: Algorithms, Evidence and Data Science
  8. Fernandez and Marques (2018) Data Science, Marketing and Business
  9. Izbicki & Santos (2020) Aprendizado de máquina: uma abordagem estatística

Bibliography: Classical Monte Carlo papers

Econometrics III 2021 (Time Series)

Course: ECONOMETRICS III 2021 (TIME SERIES) – Doctoral Program in Business Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

Objective: The main goal of the course is to make the student familiar with and able to implement univariate and multivariate time series models by using both frequentist and Bayesian approaches. All classroom examples and implementations as well as projects will be carried out by the open-source statistical software R.

Course description: Brief review of frequentist inference followed by the introduction of key ingredients of Bayesian inference, model selection and criticism. An introduction to the main Monte Carlo methods for Bayesian inference: MC integration, resampling, MCMC and sequential MC. Univariate time series models, including AR(F)IMA models, state-space models, Markov switching models, GARCH and stochastic volatility models. Multivariate time series models, including Bayesian VARs and factor-augmented VARs, dynamic factor models, time-varying covariance models.

  • PART I: Basic univariate time series models: AR, MA and ARMA models; Unit-root non-stationarity and long-memory processes; Seasonal models.
  • PART II: Bayesian ingredients (prior, likelihood, posterior, predictive, Bayes factor and posterior model probability); Monte Carlo (MC)  methods (MC integration, sampling importance resampling (SIR)) and Markov chain Monte Carlo (MCMC) methods (Gibbs sampler and Metropolis-Hastings (MH) algorithms).
  • PART III: More univariate time series: ARCH/GARCH models; EGARCH, GARCH-M, TGARCH; Bayesian GARCH; Bayesian inference in the local level model; Dynamic models; Stochastic volatility models.  We will use MCMC as well as sequential Monte Carlo (SMC) schemes to perform batch and online posterior inference.
  • PART IV: Multivariate time series models: Vector autoregressive (VAR) models; Large Bayesian VAR (BVAR) models, factor augmented VAR (FAVAR) models, time-varying parameter BVAR (TVP-BVAR) models, Bayesian FAVAR (BFAVAR) models; Factor models and time-varying covariance models.

Bibliography

Teaching assistant: Bruno do Prado Costa Levy (brunopcl at al dot insper dot edu dot br) – Wednesdays from 10am to 11:30am

Take-home midterm exam: 9am of Tuesday, February 23th to 12pm of Thursday, February 25th. (data)

Homework assignments

  1. HW1 – Due date: January 26th – Problems 1,2,3,8,19,20 and 21, chapter 1 of Shumway and Stoffer’s book (4th edition).
  2. HW2 – Due date: February 2nd – Problem 2.15 (page 107) of Tsay’s (2010) book.  However, download the up-to-date quarterly gross domestic implicit price deflator time series from the Federal Reserve Bank of St Louis.  Fit the ARIMA models with data up to the 4th quarter of 2018 and use 2019.I to 2020.III (7 quarters) for forecasting comparisons.
  3. HW3 – Due date: Tuesday, February 23rd 2021 at 9am
  4. HW4 – Due date: Tuesday, March 9th 2021 at 9am – Fit Gaussian and Student’s t GARCH(1,1) to Vale S.A. (VALE) using the R packages garchFit, bayesGARCH and RSTAN that I have provided when we studied Petrobras (PBR).  Feel free to add other (non-Bayesian) GARCH-type fits based on the ARCH-glossary that we have discussed in class.
  5. HW5 – Due Date: Tuesday, March 23rd 2021 at 9am – Collect meaningful time-series (suggestion: Apple & SP500 for US market or Vale & Ibovespa for the Brazilian market).  Use the time series in a simple CAP-M model which allows for  time-varying slope.  Repeat it by allowing ONLY time-varying slope.  Then, allow both time-varying intercept and slope.  Compare the three models to the benchmark OLS fit.  You can use whatever Bayesian R package (such as bsts) that produces posterior summaries of the latent variables (intercepts and slopes) as well as static parameters.  Comment your findings.  There are lots of papers out there, and I recommend a 16-year old one here: Jostova and Philipov (2005) Bayesian analysis of stochastic betas, Journal of Financial and Quantitative Analysis, 747-778.

Paper presentations: Prepare a 20min video plus 5-page summary of the paper to be sent to me and Bruno by 12pm on Tuesday, April 13th 2021.

  1. Pedro: Graziadei, Lopes and Marques (2020) Bayesian generalizations of the integer-valued autoregressive modelJournal of Applied Statistics. 
  2. Victoria: Silva, Lopes and Migon (2006) The extended generalized inverse Gaussian distribution for log-linear and stochastic volatility models, Brazilian Journal of Probability and Statistics, 67-91.
  3. Alexandre: Carvalho and Lopes (2006) Simulation-based sequential analysis of Markov switching stochastic volatility models, Computational Statistics and Data Analysis, 51 (9), 4526-4542.
  4. Vinicius: Warty, Lopes and Polson (2018) Sequential Bayesian learning for stochastic volatility with variance-gamma jumps in returnsApplied Stochastic Models in Business and Industry, 2018, 34, 460-483.
  5. Nathalia: Prado and Lopes (2013)  Sequential parameter learning and filtering in structured autoregressive state-space models, Statistics and Computing, 23 (1), 43-57.
  6. Livia: Primiceri (2005) Time Varying Structural Vector Autoregressions and Monetary Policy, The Review of Economic Studies, Vol. 72, No. 3, 821-852.
  7. Thaline: Carriero, Todd and Massimiliano (2019)  Large Bayesian vector autoregressions with stochastic volatility and non-conjugate priors, Journal of Econometrics, 212(1), 137-154.
  8. Guilherme: Shirota, Omori, Piao and Lopes (2017) Cholesky realized stochastic volatility model, Econometrics and Statistics, 2017, 3, 34-59.
  9. Giovanna: Kastner, Fruehwirth-Schnatter and Lopes (2017) Efficient Bayesian inference for multivariate factor SV models, Journal of Computational and Graphical Statistics, 26, 905-917.
  10. Rafael: Kastner and Huber (2020) Sparse Bayesian vector auto-regressions in huge dimensions, Journal of Forecasting, 30(7), 1142-1165.
  11. Thayla: Lopes, McCulloch and Tsay (2020) Parsimony inducing priors for large scale state-space models, Journal of Econometrics (Revised & Resubmitted).
  12. Octavio: Levy and Lopes (2021) Dynamic ordering learning in multivariate forecasting.

Examples developed in class

  1. Class of 01/12/2021 – Brief introduction to time series in R
  2. Class of 01/19/2021 – AR(1), random walk and AR(p) models
  3. Class of 01/19/2021 – ARMA & ARIMA models
  4. Class of 01/26/2021 – ARFIMA models
  5. Class of 01/26/2021 – Bayesian AR(1)
  6. Class of 02/02/2021 – Bayesian AR(1) with Normal and t priors
  7. Class of 02/02/2021 – Bayesian AR(2) with Normal and t priors
  8. Class of 02/02/2021 – Bayesian AR(2) with Normal and t models
  9. Class of 02/02/2021 – Bayesian nonlinear regression – SIR and RW-MH
  10. Class of 02/09/2021 – Bayesian AR(p) – conjugate analysis vs Gibbs sampler
  11. Class of 02/09/2021 – Comparing MCMC strategies – Gibbs, MH, block/single
  12. Class of 02/09/2021 – Nonlinear regression – comparing SIR and Gibbs+RWMH
  13. Class 0f 02/09/2021 – Bimodal posterior: comparing random-walk MH and independent MH + R code
  14. Class of 02/09/2021 – Linear Gaussian regression with Normal-Half-Cauchy prior – MCMC with Gibbs and  RWMH  steps + R code
  15. Class of 03/02/2021 – Petrobras (PBR): ARCH(1,1) + GARCH(1,1)
  16. Class of 03/02/2021 – Petrobras (PBR): garchFit – bayesGARCH – rstan (stan file)
  17. Class of 03/02/2021 – Modeling S&P 500 realized volatility & log returns (stan codegraphsdata)
  18. Class of 03/09/2021 – Modeling COVID-19 death: an exercise in state-space modeling
  19. Class of 03/09/2021 – Hamilton’s (2017) paper “Why you should never use the HP filter”
  20. Class of 03/23/2021 – SV-AR(1) for PBR: MCMC, SMC/particle filter and sequential MCMC (data)
  21. Class of 04/06/2021 – Univariate stochastic volatility, factor analysis, & factor stochastic volatility
  22. Class of 04/06/2021 – Bayesian time-varying covariance: DCC and FSV models (R code)

TEACHING MATERIAL

PART I: Basic univariate time series

  1. Autoregressive (AR) models and moving average (MA) models (HTML output)
  2. Unit-root nonstationarity and long-memory processes  (HTML output)
  3. Seasonal models

PART II: Basic Bayes

  1. Bayesian ingredients
  2. Monte Carlo (MC) methods
  3. Markov chain Monte Carlo (MCMC) methods
  4. Using stan/rstan for approximate Bayesian inference via Hamiltonian MC (HMC) methods
  5. MC and MCMC: Key References

PART III: Garch-type, dynamic linear and stochastic volatility models  – MCMC and SMC

  1. ARCH/GARCH-type models
  2. Dynamic linear models (DLMs)
  3. Nonlinear dynamic model – MCMC sampling individual states conditional on all other states
  4. Sequential Monte Carlo – pure filter
  5. Sequential Monte Carlo – parameter learning
  6. Stochastic volatility models
  7. Using R packages “stochvol” & “rstan” for SV with Gaussian or Student’s t errors

PART IV: Multivariate time series

  1. Vector autoregressive models
  2. Large BVAR, FAVAR, TVP-BVAR & BFAVAR
  3. Factor models (Standard factor analysis, Spatial dynamic factors, Factor stochastic volatility)
  4. Time-varying covariance models

Additional reading material on Bayesian time series

  1. Bayesian Statistics (a very brief introduction) – Ken Rice, April, 2014
  2. Lopes and Salazar (2006) Bayesian model uncertainty in smooth transition autoregressions, Journal of Time Series Analysis, 27, 99-117.
  3. Huerta and Lopes (2000) Bayesian forecasting and inference in latent structure for the Brazilian industrial production index, Brazilian Review of Econometrics, 20, 1-26.
  4. Kleibergen and Hoek (2000) Bayesian Analysis of ARMA Models. Tinbergen Institute Discussion Paper.
  5. Marriott, Ravishanker, Gelfand and Pai (1995) Bayesian Analysis of ARMA Processes: Complete Sampling Based Inference under Exact Likelihoods. Bayesian Statistics and Econometrics: Essays in honor of Arnold Zellner. Berry, Chaloner and Geweke, eds., John Wiley & sons, 241-254.

R stuff

Radford Neal’s 13 lectures about R

McLeod, Yu and Mahdi’s (2012) Time Series Analysis with R

MATERIAL FROM PREVIOUS YEARS (2018-2020)

Homework assignments and take-home exams

  1. Take-home midterm exam 2020
  2. Take-home midterm exam 2019
  3. Midterm exam 2017: solution
  4. HW1 2020
  5. HW2 2020
  6. HW3 2020: R code
  7. HW4 2020: VAR e BVAR para dados de consumo de energia em 7 estados brasileiros (R code)
  8. HW1 2019: Simple MA model + Exercises 1.1 to 1.5 and 2.1 to 2.4 of Tsay (2010).
  9. HW2 2019: dataset
  10. HW3 2019: VAR and BVAR (problems 2.4, 2.5 and 2.6 of Tsay (2014) Multivariate Time Series)
  11. HW2 2018: Turn in exercises 3.1 and 3.2 of Hamilton (1994)  and exercises 2.7, 2.8 and 2.9 of Tsay (2010).
  12. HW3 2018: MC Integration, SIR & Gibbs sampler
  13. HW1 2017: Solution to  2b and 2cAdditional MC exercise + Solution to 2d.
  14. HW2 2017: dataset

Paper presentations

  1. Del Negro and Schorfheide (2004) Priors from General Equilibrium Models for VARS. IER, 45, 643-673.
  2. Banbura, Giannone and Reichlin (2010) Large BVARs, JAE, 25(1), 71-92.
  3. Koop and Korobilis (2013) Large TVP VARs. JoE, 177, 185-198.
  4. Giannone, Lenza and Primiceri (2015) Prior selection for VARs. The Review of Economics and Statistics, 97,436-451.
  5. Carriero, Clark and Marcellino (2015) BVARs: Specification choices and forecast accuracy. JAE, 30, 46-73.
  6. Chan and Eisenstat (2018) Bayesian model comparison for TVP VARs with SV. JAE, 33, 509-532.
  7. Carriero, Clark and Marcellino (2019) Large BVARs with SV and flexible priors. JoE, 212, 137-154.
  8. Kastner and Huber (2020) Sparse Bayesian vector auto-regressions in huge dimensions, JoF, 30(7), 1142-1165.
  9. Korobilis and Pettenuzzo (2020) Adaptive hierarchical priors for high-dimensional VARs. JoE, 212(1), 241-271.
  10. Koop, Korobilis and Pettenuzzo (2019) Bayesian Compressed VARs. JoE, 210, 135-154.

Examples developed in class

  1. Week of 01/13/2020:  ACF of white noise and random walk processes
  2. Week of 01/13/2020: AR(3) simulation exercise(R markdown code)
  3. Week of 01/20/2020: AR(1) models: predictive analysis  (R markdown code)
  4. Week of 01/27/2020: AR(3) models: Gibbs sampler (html) (Rmarkdown code )
  5. Week of 01/27/2020: Our first Metropolis-Hastings algorithm
  6. Week of 01/27/2020: Bayesian regression with the normal-gamma prior
  7. Class of 01/15/2019: ACF of white noise and random walk processes
  8. Class of 01/22/2019: AR(3) simulation exercise(R markdown code)
  9. Class of 01/24/2019: Gaussian and non-Gaussian GARCH models + Rmarkdown  + Petrobras data
  10. Class of 01/29/2019: Our first state-space model: AR(1) plus noise model
  11. Class of 01/31/2019: Linear regression with AR(1) errors (graphs)
  12. Class of 02/05/2019: AR(1) plus noise model: FFBS
  13. Class of 02/07/2019: AR(1) plus noise model: block-move vs single-move
  14. Class of 02/26/2019: My first particle filter
  15. Class of 02/28/2019: SV-AR(1): MCMC & SMC  + (R code)
  16. Class of 03/01/2019: SV & FSV  + (R code) + (dados)
  17. Class of 03/26/2019: DCC-GARCH & FSV  + (R code)
  18. Class of April 19th, 2018: ACF of white noise and random walk processes
  19. Class of May 3rd, 2018: AR(3) simulation exercise(R markdown code)
  20. Class of May 8th, 2018: Sampling distribution of the Dickey-Fuller ratio
  21. Class of May 11th, 2018: SARIMA for unemployment rate in Sao Paulo (R code)
  22. Class of May 15th, 2018: Sequential Bayesian learning
  23. Class of May 17th, 2018: Monte Carlo integration/simulation
  24. Class of May 22nd, 2018: Gaussian AR(2) model with conditionally conjugate priors: Gibbs Sampler
  25. Class of May 24th, 2018: Bayesian linear regression
  26. Class of May 24th, 2018: Binomial model and mixture of betas prior: comparing SIR and Metropolis-Hastings schemes
  27. Class of May 25th, 2018: Bayesian CAPM
  28. Class of May 29th, 2018: Gaussian and non-Gaussian GARCH models + Rmarkdown  + Petrobras
  29. Class of June 5th, 2018:  Modeling time-varying variances via stochastic volatility (SV) models
  30. Class of June 14th, 2018: Hidden Markov model: forward filtering, backward sampling (Rmd code)
  31. Class of June 21st, 2018: VAR homework (Due date: July 5th 10:30 am)
  32. Class of April 18th, 2017: R code for the AR(2) example worked in class
  33. Class of April  18th, 2017: R for Shumway and Stoffer’s chapter 1
  34. Class of April  18th, 2017: More R code for the AR(1) and AR(2) processes  (Slides)
  35. Class of April  18th, 2017: R markdown script (run via Rstudio) (PDF output or HTML output)
  36. Class of April 25th, 2017: Monte Carlo exercise: studying the sampling behavior of the t test under unit root
  37. Class of May 1st, 2017: Bayesian inference for the Gaussian AR(2) model (R code)
  38. Class of May 8th, 2017: Computing pi via rejection sampling: our first MC sampling scheme
  39. Class of May 8th, 2017: MC integration for a simple normal-normal example
  40. Class of May 8th, 2017: Gibbs sampler for AR(1) model with a changing point (changing in the intercept)
  41. Class of May 16th, 2017: Brazilian monthly production of cement (January 2002 to February 2017)
  42. Class of May 16th, 2017: AR(1) plus noiseFigure 1 +Figure 2.
  43. Class of May 16th, 2017: AR(1) plus noise – Kalman filter and smoother + Figures.
  44. Class of May 16th, 2017: AR(1) plus noise – Bayesian inference via MCMC/FFBS + Figures.
  45. Class of May 16th, 2017: AR(1) plus noise – Modeling Alcoa realized volatilities via 1st order DLM + Data.
  46. Class of May 24th, 2017: AR(1) plus noise – Comparing block move (FFBS) with single move MCMC schemes
  47. Class of June 6th, 2017: Linear regression with Markov switching intercept – R code + Figures

Time-Series-PhD-ASU

Course: TIME SERIES (Spring 2023)

Professor: Hedibert Freitas Lopes – www.hedibert.org

Lectures: Mondays and Wednesdays, from 10:30am to 11:45am (January 10th to April 27th)

Office hours: Wednesdays, from 11am to 12pm (by appointment only)

Classroom: Social Sciences 205

ATTENTION: This is an advanced time series course (see course description below!). A strong background in calculus, probability, statistics and matrix algebra is highly beneficial. 

Syllabus

Course description: The main goal of the course is to make the student familiar with and able to implement univariate and multivariate modern time series models. Univariate time series models we will consider include the family of autoregressive (fractionally) integrated moving average (ARIMA) models, dynamic linear models (aka state-space) models, Markov switching models, generalized autoregressive conditionally heteroskedastic (GARCH) and stochastic volatility (SV) models. Multivariate time series models we will considere include vector autoregressive (VAR) models, factor-augmented VARs, dynamic factor models and various time-varying covariance models. The inferential approach of this course is predominantly Bayesian, so we will briefly introduce key ingredients of Bayesian inference, model selection and criticism. An introduction to the main Monte Carlo methods for Bayesian inference, such as MC integration, sampling-importance-resampling (SIR), Markov chain Monte Carlo (MCMC) and sequential MC (SMC), will also be introduced. All classroom examples and implementations as well as projects will be carried out by the open-source statistical software R.

Key topics covered will be:

  • PART I: Basic univariate time series models: AR, MA and ARMA models; unit-root non-stationarity and long-memory processes; seasonal models.
  • PART II: Bayesian ingredients (prior, likelihood, posterior, predictive, Bayes factor and posterior model probability); Monte Carlo (MC) methods (MC integration, sampling importance resampling (SIR)) and Markov chain Monte Carlo (MCMC) methods (Gibbs sampler and Metropolis-Hastings (MH) algorithms).
  • PART III: More univariate time series: ARCH/GARCH models; EGARCH, GARCH-M, TGARCH; Bayesian GARCH; Bayesian inference in the local level model; Dynamic models; Stochastic volatility models. We will use MCMC as well as sequential Monte Carlo (SMC) schemes to perform batch and online posterior inference.
  • PART IV: Multivariate time series models: Vector autoregressive (VAR) models; Large Bayesian VAR (BVAR) models, factor augmented VAR (FAVAR) models, time-varying parameter BVAR (TVP-BVAR) models, Bayesian FAVAR (BFAVAR) models; Factor models and time-varying covariance models.

Useful textbooks:

Homework assignments:  HW are to be delivered via a single PDF file to hedibert@gmail.com

  • HW1 – Due date: At the beginning of class on Tuesday, January 31st, 2023
  • HW2Due date: At the beginning of class on Thursday, February 23rd, 2023.
  • HW3 – Due date: At the beginning of class on Thursday, March 16th, 2023.
    • Fit Gaussian and Student’s t GARCH(1,1) to your favorite returns (Coke, Apple, Amazon, S&P, etc) using the R packages garchFit and bayesGARCH that I have used in class.  Feel free to add other (non-Bayesian) GARCH-type fits based on the ARCH-glossary that we have discussed in class.  Use data between January 2005 and December 2022, so you are including the 2007-2008 financial crisis, as well as the 2020-2021 COVID pandemic.  Comment your findings.
  • HW4 – Due date: At the beginning of class on Thursday, April 6th, 2023.
    • Inspired by HW3 (above), fit Gaussian and Student’s t SV-AR(1) models, as well their extended versions that contemplate leverage effect (skewed effect between large positive returns and large negative returns), to your favorite returns (Coke, Apple, Amazon, S&P, etc) using the R packages stochvol (by Gregor Kastner).  Use data between January 2005 and December 2022, so you are including the 2007-2008 financial crisis, as well as the 2020-2021 COVID pandemic.  Comment your findings, including comparisons with the GARCH-type models from HW3.  Hint:  We basically perform this task in Section 5 of the following example: sv-ar(1) for S&P500 returns.  Have fun! 

List of papers for final presentation – Due date: 12pm, May 2nd 2023.

Your final evaluation has two parts AND both need to be turned on May 2nd 2023 at noon: a) A five-page summary of the paper, and b) recorded 15-minute presentation of the paper plus slides.

  1. Stefano Chiaradonna – Cyber risk measurement via loss distribution approach and GARCH model, Communications for Statistical Applications and Methods, 2023, Vol. 30, No. 1, 75–94.  By Sanghee Kim and Seongjoo Song. https://doi.org/10.29220/CSAM.2023.30.1.075
  2. John Schiele – On the long run volatility of stocks: time-varying predictive systems, Journal of the American Statistical Association, 2018, 113, 1050-1069. By Carlos Carvalho, Hedibert Lopes & Robert McCulloch.
  3. Lydia Gabric – Bayesian prediction of risk measurements using copulas, in Bocker, K. (Ed.) Rethinking Risk Measurement and Reporting: Uncertainty, Bayesian Analysis and Expert Judgement, 2010, 553-578. By Ausin and Lopes.  https://hedibert.org/wp-content/uploads/2013/12/ausin-lopes-2010.pdf
  4. Shuai Zhu – Bayesian generalizations of the integer-valued autoregressive model, Journal of Applied Statistics.  By Graziadei, Lopes and Marques (2020)
  5. Chukwudi Obite – Simulation-based sequential analysis of Markov switching stochastic volatility models, Computational Statistics and Data Analysis, 51 (9), 4526-4542. By Carvalho and Lopes (2006) 
  6. Fan Wu – Time Varying Structural Vector Autoregressions and Monetary Policy, The Review of Economic Studies, Vol. 72, No. 3, 821-852. By Primiceri (2005)
  7. Xianjian Xie – Sparse Bayesian vector auto-regressions in huge dimensions, Journal of Forecasting, 30(7), 1142-1165. By Kastner and Huber (2020) 

TEACHING MATERIAL

PART I: Basic univariate time series

  1. Autoregressive (AR) models and moving average (MA) models (HTML output)
  2. Unit-root nonstationarity and long-memory processes  (HTML output)
  3. Seasonal models

PART II: Basic Bayes

  1. Bayesian ingredients
  2. Bayesian computation

PART III: Garch-type, dynamic linear and stochastic volatility models

  1. Glossary of ARCH models
  2. Dynamic models
  3. Sequential Monte Carlo – pure filter

PART IV: Multivariate time series

  1. Vector autoregressive models (VAR) part one
  2. VAR part two: Large BVAR, FAVAR, TVP-BVAR & BFAVAR
  3. Bayesian factor analysis (BFA)
  4. Time-varying covariance modeling

Bonus topic: Time series meet machine learning

Old homework assignments (spring 2022): HW1 (Solution) + HW2  + HW3 (Derivations + R code) + HW4: Fit Gaussian and Student’s t GARCH(1,1) to your favorite returns (Coke, Apple, Amazon, S&P, etc) using the R packages garchFit and bayesGARCH that I have used in class.  Feel free to add other (non-Bayesian) GARCH-type fits based on the ARCH-glossary that we have discussed in class.  Use data between January 2005 and December 2021, so you are including the 2007-2008 financial crisis, as well as the 2020-2021 COVID pandemic.  Comment your findings.

Advanced-Bayes-PhD-ASU

Course: ADVANCED BAYESIAN STATISTICAL LEARNING (Spring 2023)

Professor: Hedibert Freitas Lopes – www.hedibert.org

Lectures: Tuesdays and Thursdays, from 9:00am to 10:15am (January 10th to April 27th)

Office hours: Wednesdays, from 10am to 11am (by appointment only)

Classroom: Social Sciences 205

ATTENTION: This is an advanced Bayesian course (see course description below!). A strong background in calculus, probability, statistics and matrix algebra is highly beneficial. 

Syllabus

Course description: The end of the course goal is to expose the student to modern Bayesian solutions to highly structured and stochastic real world problems.  We will visit well known Bayesian issues, such as prior specification/sensitivity, model comparison/criticism and model averaging, as well as Bayesian computation via various Monte Carlo methods.  We approach regularization in linear and log-linear models via Bayesian LASSO, Spike-and-Slab priors and related sparsity-inducing priors.  We cover decoupling shrinkage and selection strategies in a fully Bayesian decision framework.  Other topics covered are finite and infinite mixtures for Bayesian semi- and non-parametric modeling, large-scale (dynamic/spatial) factor models, Bayesian additive regression trees (BART), Bayesian text modeling and modeling large-scale time-varying covariance matrices.  All classroom examples and implementations as well as projects will be carried out by the open-source statistical software R.

Useful textbooks:

  • Gamerman and Lopes (2006) MCMC: Stochastic Simulation for Bayesian Inference, Second Edition. Chapman & Hall/CRC. http://www.dme.ufrj.br/mcmc.
  • Gelman, Carlin, Stern, Dunson, Vehtari and Rubin (2020) Bayesian Data Analysis, Third Edition. Chapman & Hall/CRC. http://www.stat.columbia.edu/~gelman/book/BDA3.pdf
  • Hoff (2009) A First Course in Bayesian Statistical Methods. Springer.
  • Migon, Gamerman and Louzada (2015) Statistical Inference: An Integrated Approach, Second Edition, Chapman & Hall/CRC.

Homework assignments:  HW are to be delivered via a single PDF file to hedibert@gmail.com

  1. HW1 – Due at the beginning of class, February 7th, 2023.
  2. HW2 – Due at the beginning of class, February 23rd, 2023.
  3. HW3 – Due at the beginning of class, March 16th, 2023
  4. HW4 – Due at the beginning of class, April 13th, 2023

List of papers for final presentation – Due date: 12pm, May 2nd 2023.

Your final evaluation has two parts AND both need to be turned on May 2nd 2023 at noon: a) A five-page summary of the paper, and b) recorded 15-minute presentation of the paper plus slides.

  1. The illusion of the illusion of sparsity – Fava and Lopes (2021), Brazilian Journal of Probability and Statistics, 35(4), 699-720 https://arxiv.org/abs/2009.14296 (Bryan Lietz)
  2. A weakly informative default prior distribution for logistic and other regression models – Gelman, Jakulin, Pittau and Zu (2008), Annals of Applied Statistics, 2(4), 1360-1383. https://doi.org/10.1214/08-AOAS191 (Tyler Hoffman)
  3. Do forecasts of bankruptcy cause bankruptcy? A machine learning sensitivity analysis – Papakostas, Hahn, Murray, Zhou and Gerakos (2023), Annals of Applied Statistics, 17(1), 711-739.
    https://doi.org/10.1214/22-AOAS1648 (Yang Ba)
  4. Forecasting with many predictors using Bayesian additive regression trees – Pruser (2019), Journal of Forecasting, Volume38, Issue7, November 2019, Pages 621-631. https://doi.org/10.1002/for.2587 (Mina Jiang)

TEACHING MATERIAL

Bayesian ingredients

  1. Basic Bayes
  2. Exchangeability
  3. Principles of data reduction
    • Discussion about p-values – P-values not only violate conditionality principle, but it is commonly mistaken as “the probability that the null hypothesis is true”.  Recall that, Pr(H0 is true|data) is a well-defined Bayesian quantity, while the p-value is the probability of the data (or its more extreme versions) given that the null hypothesis is true: Pr(data|H0 is true); a totally different quantity!
  4. Decision theory + More on estimators
    • For those keen to learn a bit more about Bayesian statistical decision theory beyond my meager lecture notes, I recommend a few places: 1) Statistical Decision Theory and Bayesian Analysis (2nd edition) – Berger (1985); 2) The Bayesian Choice (2nd edition) – Robert (2007); 3) Decision Theory: Principles and Approaches – Parmigiani & Inoue (2009); 4) Lecture notes on “Bayes Methods and Elementary Decision Theory” by Wellner (University of Washington); and Lecture notes on “Evaluating the performance of estimators” by Pati (Texas A&M University).
  5. Bayesian model criticism
  6. Additional reading material:
    • Chapter 2 of Gamerman and Lopes (2006) – Compact, but easy to read.
    • Chapters 2-4 of Migon, Gamerman and Louzada (2014) – Integrates classical and Bayesian inference.
    • Chapter 1 and 2 of Gelman et al. (2013) – Application-oriented.
    • Chapter 4 (Sections 4.1-4.4) of Berger (1985) – More technical.

Bayesian Computation

  1. Monte Carlo (MC) methods
  2. Markov chain Monte Carlo (MCMC) algorithms

Bayesian Learning

  1. Multiple linear regression: selection, shrinkage, sparsity
  2. Classification: logistic regression and discriminant analysis
  3. Bayesian factor analysis (BFA)
  4. Principal components analysis (PCA), PCA-based and FA-based regressions
  5. Finite mixture of distributions
  6. Spatial models
  7. Bayesian CART
  8. Random forests
  9. Bayesian additive regression trees (BART)
  10. Latent Dirichlet Allocation (LDA)
  11.  Neural Networks

Old homework assignments (spring 2022): HW1 (Solution) + HW2 (Solution) + HW3 (Derivations + R code) + HW4 (Solution)

Pool of papers from final presentation (spring 2022)

Aprendizagem Bayesiana

Course: APRENDIZAGEM BAYESIANA  – Mestrado Profissional em Economia (MPE)
Professor: Hedibert Freitas Lopes – www.hedibert.org

Monitoria: Henrique Bolfarine

Syllabus: Baixe aqui

Homework assignments

  1. HW1: Use the your own y and X  in the attached R code (Due: 7:30pm, Monday, March 9th, 2020)
  2. HW2: PCA e FA para dados de consumo de energia em 7 estados brasileiros

Course notes (+ R code & references)

 

Additional supporting material

Econometrics III 2018

Course: ECONOMETRICS III 2018 – Doctoral Program in Business Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

We have 26 1.5h lectures between April 17th and July 12

Objective

The main goal of the course is to make the student familiar with and able to implement univariate and multivariate time series models by using both frequentist and Bayesian approaches. All classroom examples and implementations as well as projects will be carried out by the open-source statistical software R.

Course description

Brief review of frequentist inference followed by the introduction of key ingredients of Bayesian inference, model selection and criticism. An introduction to the main Monte Carlo methods for Bayesian inference: MC integration, resampling, MCMC and sequential MC. Univariate time series models, including AR(F)IMA models, state-space models, Markov switching models, GARCH and stochastic volatility models. Multivariate time series models, including Bayesian VARs and factor-augmented VARs, dynamic factor models, time-varying covariance models.

Course outline

  • PART I: Basic univariate time series models
    • AR, MA and ARMA models
    • Unit-root nonstationarity and long-memory processes
    • Seasonal models
  • PART II: Basic Bayes
    • Bayesian ingredients
    • Monte Carlo methods
    • Markov chain Monte Carlo methods
  • PART III: More univariate time series
    • ARCH/GARCH models
    • EGARCH, GARCH-M, TGARCH
    • Bayesian GARCH
    • Bayesian inference in the local level model
    • Dynamic models
    • Stochastic volatility models
  • PART IV: Multivariate time series models
    • Vector autoregressive models
    • Large BVAR, FAVAR, TVP-BVAR & BFAVAR models
    • Factor models
    • Time-varying covariance models

Bibliography

Teaching assistant: William Rojas (williamrojas1212 at gmail dot com)

Office hours: Wednesdays, from 8am to 9:30am, room 201.  Except on May 9th, room Mario Haberfeld.

Homework assignments

  1. HW1: Due date: April 19th, 10:30am – Read chapter one and chapter two (Sections 2.1 to 2.5) of Tsay (2010) and turn in exercises 1.1 to 1.5  (pages 25 to 28) and exercises 2.2 to 2.4 (pages 104 to 105).  You can work individually or in pairs.
  2. HW2: Due date: May 17th, 10:30am – Turn in exercises 3.1 and 3.2 (pages 70-71) of Hamilton’s (1994) Time Series Analysis and exercises 2.7, 2.8 and 2.9 (pages 105 to 106) of Tsay’s (2010) Analysis of Financial Time Series.  You can work individually or in pairs.
  3. HW3: Due date: May 29th, 10:30am – MC Integration, SIR, Gibbs sampler
  4. HW4: Due date: July 5th, 10:30amVAR and BVAR (problems 2.4, 2.5 and 2.6)

EXAMPLES DEVELOPED IN CLASS 

TEACHING MATERIAL

PART I: Basic univariate time series

PART II: Basic Bayes

PART III: More univariate time series

  1. ARCH/GARCH models
  2. EGARCH, GARCH-M, TGARCH
  3. Bayesian GARCH
  4. Dynamic models (aka state-space models) and stochastic volatility (SV) models

PART IV: Multivariate time series

  1. Vector autoregressive models
  2. Large BVAR, FAVAR, TVP-BVAR & BFAVAR
  3. Factor models (Standard factor analysis, Spatial dynamic factors, Factor stochastic volatility)
  4. Time-varying covariance models

Additional material on Bayesian time series

  1. Bayesian Statistics (a very brief introduction) – Ken Rice, April, 2014
  2. Lopes and Salazar (2006) Bayesian model uncertainty in smooth transition autoregressions, Journal of Time Series Analysis, 27, 99-117.
  3. Huerta and Lopes (2000) Bayesian forecasting and inference in latent structure for the Brazilian industrial production index, Brazilian Review of Econometrics, 20, 1-26.
  4. Kleibergen and Hoek (2000) Bayesian Analysis of ARMA Models. Tinbergen Institute Discussion Paper.
  5. Marriott, Ravishanker, Gelfand and Pai (1995) Bayesian Analysis of ARMA Processes: Complete Sampling Based Inference under Exact Likelihoods. Bayesian Statistics and Econometrics: Essays in honor of Arnold Zellner. Berry, Chaloner and Geweke, eds., John Wiley & sons, 241-254.

R stuff

Radford Neal’s 13 lectures about R

McLeod, Yu and Mahdi’s (2012) Time Series Analysis with R

Bayesian Econometrics 2017

Course: BAYESIAN ECONOMETRICS 2017 – Doctoral Program in Business Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

Syllabus

Objective

The end of the course goal is to allow the student to critically decide between a Bayesian, a frequentist or Bayesian-frequentist compromise when facing real world problems in the fields of micro-econometrics, macro-econometrics, marketing and finance.  With this end in mind, we will visit well known Bayesian issues, such as prior specification and model comparison and model averaging, but also study regularization, “small n, large p” issues, Bayesian statistical learning (additive regression trees) and large-scale factor models.

Course description

Basic ingredients: prior, posterior, and predictive distributions, sequential Bayes, conjugate analysis, exchangeability, principles of data reduction and decision theory.  Model criticism: Bayes factor, computing marginal likelihoods, Savage-Dickey ratio, reversible jump MCMC, Bayesian model averaging and deviance information criterion.  Modern computation via (Markov chain) Monte Carlo methods: Monte Carlo integration, sampling-importance resampling, Gibbs sampler, Metropolis-Hastings algorithms.  Mixture models, Hierarchical models, Bayesian regularization, Instrumental variables modeling, Large-scale (sparse) factor modeling, Bayesian additive regression trees (BART) and related topics, Dynamic models, Sequential Monte Carlo algorithms, Bayesian methods in microeconometrics, macroeconometrics, marketing and finance

Course notes (+ R code & references)

Miscellaneous

Econometrics III 2017

Course: ECONOMETRICS III 2017 – Doctoral Program in Business Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

Syllabus

Objective

The main goal of the course is to make the student familiar with and able to implement univariate and multivariate time series models by using both frequentist and Bayesian approaches. All classroom examples and implementations as well as projects will be carried out by the open-source statistical software R.

Course description

Brief review of frequentist inference followed by the introduction of key ingredients of Bayesian inference, model selection and criticism. An introduction to the main Monte Carlo methods for Bayesian inference: MC integration, resampling, MCMC and sequential MC. Univariate time series models, including AR(F)IMA models, state-space models, Markov switching models, GARCH and stochastic volatility models. Multivariate time series models, including Bayesian VARs and factor-augmented VARs, dynamic factor models, time-varying covariance models.

Bibliography

Teaching assistant: Paloma Uribe (paloma dot uribe at gmail dot com)

Office hours: Thursdays from 1pm to 2pm (Room 604)

Day-to-day announcements

Homework assignments & Exams

April, 18th to 24th 2017:

April, 25th to 30th 2017:

May, 1st to May 7th 2017:

May 8th to May 15th 2017:

This week we started talking about two relatively simple and well-known time series models with time-varying variances: ARCH(1) and GARCH(1,1) models.  We also considered a standard Bayesian approach to posterior inference regarding the GARCH(1,1) model.  Chapter 3 of Tsay’s (2010) book is good enough as an introduction to the subject, particularly sections 3.4 (ARCH model) and 3.5 (GARCH model).  A few exercises from his book are worth trying to fix most the ideas.  I recommend the following exercises: 3.1, 3.2, 3.3, 3.4, 3.5 and 3.6.

May, 16th to May 23rd 2017:

May, 24th to June 5th 2017:

  • AR(1) plus noise – Comparing block move (FFBS) with single move MCMC schemes:  HTML

June 6th to June 15th 2017:

COURSE SLIDES AND TEACHING MATERIAL

PART I: Basic univariate time series

PART II: Basic Bayes

PART III: More univariate time series

  1. ARCH/GARCH models
  2. EGARCH, GARCH-M, TGARCH
  3. Bayesian GARCH
  4. Dynamic models (aka state-space models) and stochastic volatility (SV) models

PART IV: Multivariate time series

  1. Vector autoregressive models
  2. Large BVAR, FAVAR, TVP-BVAR & BFAVAR
  3. Factor models (Standard factor analysis, Spatial dynamic factors, Factor stochastic volatility)
  4. Time-varying covariance models

Additional material

  1. Bayesian Statistics (a very brief introduction) – Ken Rice, April, 2014
  2. Lopes and Salazar (2006) Bayesian model uncertainty in smooth transition autoregressions, Journal of Time Series Analysis, 27, 99-117.
  3. Huerta and Lopes (2000) Bayesian forecasting and inference in latent structure for the Brazilian industrial production index, Brazilian Review of Econometrics, 20, 1-26.
  4. Kleibergen and Hoek (2000) Bayesian Analysis of ARMA Models. Tinbergen Institute Discussion Paper.
  5. Marriott, Ravishanker, Gelfand and Pai (1995) Bayesian Analysis of ARMA Processes: Complete Sampling Based Inference under Exact Likelihoods. Bayesian Statistics and Econometrics: Essays in honor of Arnold Zellner. Berry, Chaloner and Geweke, eds., John Wiley & sons, 241-254.

R stuff

Introduction to R (by Paloma Uribe, in Portuguese) 

Radford Neal’s 13 lectures about R

McLeod, Yu and Mahdi’s (2012) Time Series Analysis with R

Econometrics III 2016

Course: ECONOMETRICS III 2016 – Doctoral Program in Business Economics
Professor: Hedibert Freitas Lopes – www.hedibert.org

Syllabus

Objective

The main goal of the course is to make the student familiar with and able to implement univariate and multivariate time series models by using both frequentist and Bayesian approaches. All classroom examples and implementations as well as projects will be carried out by the open-source statistical software R.

Course description

Brief review of frequentist inference followed by the introduction of key ingredients of Bayesian inference, model selection and criticism. An introduction to the main Monte Carlo methods for Bayesian inference: MC integration, resampling, MCMC and sequential MC. Univariate time series models, including AR(F)IMA models, state-space models, Markov switching models, GARCH and stochastic volatility models. Multivariate time series models, including Bayesian VARs and factor-augmented VARs, dynamic factor models, time-varying covariance models.

Bibliography

Course material

  1. Bayesian ingredients
    • GL2006: Examples 2.1, 2.4, 2.5, section 2.3.2, problems 2.1, 2.2, 2.5, 2.8a, 2.10 and 2.11.
  2. Monte Carlo methods
  3. Markov chain Monte Carlo methods
  4. Autoregressive (AR) models and moving average (MA) models
    • Tsay (2010): Sections 2.1-2.6, sections 2.7 and 2.11, and sections 3.1-3.8
  5. Unit-root nonstationarity and long-memory processes
  6. Seasonal models
  7. ARCH/GARCH models (EGARCH, GARCH-M, TGARCH) (Bayesian GARCH)
  8. Dynamic models (aka state-space models) and stochastic volatility (SV) models
  9. Homework (due June 1st)  (solution)
  10. Vector autoregressive models
  11. Large BVAR, FAVAR, TVP-BVAR & BFAVAR
  12. Sequential Monte Carlo methods
  13. Factor models (Standard factor analysis, Spatial dynamic factors, Factor stochastic volatility)
  14. Time-varying covariance models

Additional material

  1. Bayesian Statistics (a very brief introduction) – Ken Rice, April, 2014
  2. Lopes and Salazar (2006) Bayesian model uncertainty in smooth transition autoregressions, Journal of Time Series Analysis, 27, 99-117.
  3. Huerta and Lopes (2000) Bayesian forecasting and inference in latent structure for the Brazilian industrial production index, Brazilian Review of Econometrics, 20, 1-26.
  4. Kleibergen and Hoek (2000) Bayesian Analysis of ARMA Models. Tinbergen Institute Discussion Paper.
  5. Marriott, Ravishanker, Gelfand and Pai (1995) Bayesian Analysis of ARMA Processes: Complete Sampling Based Inference under Exact Likelihoods. Bayesian Statistics and Econometrics: Essays in honor of Arnold Zellner. Berry, Chaloner and Geweke, eds., John Wiley & sons, 241-254.

Econometria 2016-2

Disciplina: ECONOMETRIA – Turma 4ECO (Economia)
Período Letivo: 2016/2
Professor: Hedibert Freitas Lopes – www.hedibert.org
Monitora: Paloma Vaissman Uribe – PalomaVU@insper.edu.br

Programa de Ensino 

Conteudo das aulas

  1. Apresentacao do curso
  2. Regressao Linear Simples – Parte 1: Minimos Quadrados Ordinarios & R2
  3. Regressao Linear Simples – Parte 2: formas funcionais
  4. Regressao Linear Simples – Parte 3: Suposicoes, propriedades e teste-t
  5. Analise de residuos
  6. Regressao linear multipla
  7. Regressao linear multipla – Vies de omissao de variable
  8. Regressao linear multipla – Teste F Parcial
  9. Heteroscedasticidade
  10. Endogeneidade: variaveis instrumentais (worked examples)
  11. Endogeneidade: estimacao
  12. Endogeneidade: tests
  13. Basic time series  – Codigo R

Listas de exercicios

Lista 1 (Regressao linear simples): Wooldridge – 2.2, 2.3, 2.4, 2.5, 2.7, 2.9, 2.11

Lista 2 (Regressao linear multipla): Wooldridge – 3.3, 3.4, 3.5, 3.7, 3.9, 4.2, 4.3, 4.6, 4.9, 4.11

Lista 3 (Heteroscedasticidade): Wooldridge – 8.1, 8.2, 8.3, 8.4, 8.5 + refazer os exemplos 8.1 (pg 250-251), 8.2 (pg 252), 8.4 (pg 257) e 8.7 (pg 268-269)

Lista 4 (Endogeneidade): Wooldridge – 15.1, 15.2, 15.3, 15.7, 15.8 e 15.10 + refazer os exemplos 5.1 (pg 476-477), 5.2 (pg 477-478), 5.3 (pg 480-481) e 5.4 (pg 484-486).

Lista 5 (Series temporais): Wooldridge – Refazer os exemplos 10.1, 10.2, 10.3, 10.4, 10.7, 10.9, 11.3, 11.4, 11.5, 11.6 e 11.7 + problemas 11.1, 11.2, 11.3, 11.4 e 11.5

Atividade 2

Dados por escola do ENEM2015 – Analise exploratoria dos dados  –  Codigo R

Econometria em R

  1. Tutorial de R: aula 1
  2. Tutorial de R: aula 2
  3. Tutorial de R: regressao
  4. Tutorial de R: R2
  5. Introducao ao uso do R (Paloma Uribe)
  6. Using R for Introductory Econometrics (Florian Heiss)
  7. Econometric and time series modeling using R (Cribari-Neto)
  8. Introduction to programmingEconometrics with R (Bruno Rodrigues)
  9. Econometrics in R: Past, Present, and Future (Achim Zeileis & Roger Koenker)
  10. CRAN Task View: Econometrics (Achim Zeileis)
  11. R-Econometrics – Learn R for applied economics in a comprehensive way

Econometria em outras linguagens/pacotes

  1. PYTHON: Introductory Econometrics – Jeffrey M. Wooldridge: Capítulos 2 ao 8 usando PYTHON
  2. Kevin Sheppard’s Python for Econometrics
  3. STATA: Introductory Econometrics – Jeffrey M. Wooldridge: Capítulos 2 ao 18 usando STATA
  4. Statistical Analysis in R, MATLAB, SAS, STATA and SPSS

Mais conjuntos de dados

Econometria 2016-1

Disciplina: ECONOMETRIA – Turma 4ECO (Economia)
Período Letivo: 2016/1
Professor: Hedibert Freitas Lopes – www.hedibert.org
Monitora: Paloma Vaissman Uribe – PalomaVU@insper.edu.br

Programa de Ensino 

Conteudo das aulas

  1. Apresentacao do curso
  2. Regressao Linear Simples – Parte 1: Minimos Quadrados Ordinarios & R2
  3. Regressao Linear Simples – Parte 2: formas funcionais
  4. Regressao Linear Simples – Parte 3: Suposicoes, propriedades e teste-t
  5. Analise de residuos
  6. Atividade 1 – Dados da PNAD 2009 + readme.txt + Analise exploratoria dos dados
    • Madalozzo and Mauriz (2012) Does investing in education reduce the gender wage gap? A Brazilian population study. Population Review, Volume 51, Number 2, pp. 59-84.
    • Bertrand, Kamenica and Pan (2015) Gender Identity and relative income within households.  Quarterly Journal of Economics.
    • USA data: Median usual weekly earnings (second quartile), Employed full time, Wage and salary workers.  U.S. Bureau of Labor Statistics, United States Department of Labor.
    • pnad2009.R: Codigo R para os dados brasileiros.
    • earnings.R: Codigo R para os dados americanos.
  7. Regressao linear multipla
  8. Regressao linear multipla – Teste F Parcial + Teste RESET
  9. Heteroscedasticidade
  10. Dados para atividade 2: sleep75.csv
  11. Endogeneidade: variaveis instrumentais (worked examples)
  12. Endogeneidade: estimacao
  13. Endogeneidade: tests
  14. Basic time series  – Codigo R

Listas de exercicios

  1. Lista 1
  2. Lista 2
  3. Lista 3
  4. Lista 4

Econometria em R

  1. Introducao ao uso do R (Paloma Uribe)
  2. Using R for Introductory Econometrics (Florian Heiss)
  3. Econometric and time series modeling using R (Cribari-Neto)
  4. Introduction to programmingEconometrics with R (Bruno Rodrigues)
  5. Econometrics in R: Past, Present, and Future (Achim Zeileis & Roger Koenker)
  6. CRAN Task View: Econometrics (Achim Zeileis)
  7. R-Econometrics – Learn R for applied economics in a comprehensive way

 

Econometria em outras linguagens/pacotes

  1. PYTHON: Introductory Econometrics – Jeffrey M. Wooldridge: Capítulos 2 ao 8 usando PYTHON
  2. Kevin Sheppard’s Python for Econometrics
  3. STATA: Introductory Econometrics – Jeffrey M. Wooldridge: Capítulos 2 ao 18 usando STATA
  4. Statistical Analysis in R, MATLAB, SAS, STATA and SPSS


Mais conjuntos de dados

Analise Multivariada 2015

Disciplina: ANALISE MULTIVARIADA 2015 (MPA)

Período Letivo: 2015/1

Professor: Hedibert Freitas Lopes – www.hedibert.org

Monitor: Leandro Augusto Ferreira

Objetivo: O objetivo do curso é apresentar os conceitos e métodos de análise multivariada de dados, aplicando-os a dados reais e interpretando os resultados de forma prática. No curso de análise multivariada são utilizados conceitos de estatística básica e inferência, com ênfase na resolução de problemas reais e interpretação dos resultados.  Na maioria dos estudos, a complexidade dos fenômenos estudados faz com seja necessário coletar informações sobre um conjunto de variáveis. A análise multivariada permite o estudo simultâneo de um conjunto de variáveis, aproveitando a estrutura de correlação existente entre as mesmas.  Nesta disciplina são apresentadas técnicas de análise de dados quantitativos e qualitativos, discutindo aplicações nas áreas de marketing, operações, recursos humanos e finanças.

Programa de Ensino

03/02/2015: Análise Exploratória de Dados Multivariados

06/02/2015: Inferencia Multivariada – MANOVA

10/02/2015: Análise de Componentes Principais

24/02/2015: Análise Fatorial – parte 1 + Análise Fatorial – parte 2

03/03/2015: Regressao logistica + Analise discriminante

10/03/2015: Correlacao canonica

17/03/2015: Cluster analysis

24/03/2015: Trabalho em sala de aula (terminado em casa) 31/03/2015: Correspondence analysis & multidimensional scaling

10/04/2015: Structural equation modeling

Conjunto de dados:

Bayesian Statistical Learning 2016

Course: Readings in Statistics and Econometrics 2016: Bayesian Statistical Learning

Professors: Hedibert Freitas Lopes & Paulo Marques

Objective: In this Second Readings in Statistics and Econometrics we will study and discuss, through a series of well established papers, the broad topic of Statistical Learning with an emphasis on its natural Bayesian solutions. The 5 lectures and 8 seminars will take place on Fridays between 10am and 12pm from January 29th to April 8th 2016. Paulo and I will give lectures discussing traditional Statistical Learning techniques, alternated with seminars given by the participants on papers presenting Bayesian counterparts to the techniques discussed in the lectures.

Outline of the meetings (5 lectures and 8 seminars)

Books

Papers

Causality 2015

Readings in Statistics and Econometrics 2015: Causality 

Organizer: Hedibert Freitas Lopes

Email: hedibertFL at insper.edu.br

In this First Readings in Statistics and Econometrics we will study and discuss, through a series of well established papers, the broad topic of causality.  The lectures are held at INSPER on Tuesdays, from 7:30am to 9:30am, from September 29th to December 1st, 2015, at classroom Paulo Renato de Souza, 2nd floor.

Annotated bibliographyHere you will find links to textbooks and edited books, special issues, articles with discussion and web material: slides of lectures, discussion of causality, video lectures and more (in chronological order).

Annotated bibliographyOnly articles and book chapters (in alphabetical order).

Outline of the lectures

      • September 29th – Hedibert Lopes – INSPER
        Haavelmo (1943) The statistical implications of a system of simultaneous equations. Econometrica, 11, 1-12.
        slides of the lecture
      • October 6th – Hedibert Lopes – INSPER
        Rubin (1974) Estimating causal effects of treatments in randomized and nonrandomized studies. Journal of Educational Psychology, 56, 688-701.
        slides of the lecture
      • October 13th – Andre Yoshizumi, IME/USP
        Holland (1986) Statistics and causal inference (with discussion). JASA, 81, 945-970.
        slides of the lecture
      • October 20th – Paloma Uribe, IME/USP
        Pearl (1995) Causal diagrams for empirical research (with discussion). Biometrika, 82, 669-710.
        slides of the lecture + slides of Joao M.P.De Mello’s talk
      • November 3rd – Sergio Firpo, EESP/FGV
        Angrist, Imbens and Rubin (1996) Identi cation of causal effects using instrumental variables (with discussion). JASA, 91, 444-472.
        slides of the lecture
      • November 10th – Julio Trecenti, IME/USP
        Dawid (2000) Causal inference without counterfactuals (with discussion). JASA, 95, 407-424.
        slides of the lecture
      • November 24th – Manasses Nobrega, UFABC
        Vansteelandt and Goetghebeur (2003) Causal inference with generalized structural mean
        models. JRSS-B, 65, 817-835.
      • December 1st – Hedibert Lopes – INSPER
        Heckman and Pinto (2015) Causal analysis after Haavelmo. Econometric Theory, 31,115-151.
        slides of the lecture

Books & special issues

Articles with discussion

From the web

Econometria Avancada 2015

Disciplina: ECONOMETRIA AVANCADA 2015

Período Letivo: 2015/1

Professor: Hedibert Freitas Lopes – www.hedibert.org

Monitor: Paloma Vaissman Uribe

Objetivo: O objetivo do curso é apresentar os conceitos e métodos de análise multivariada de dados, aplicando-os a dados reais e interpretando os resultados de forma prática. No curso de análise multivariada são utilizados conceitos de estatística básica e inferência, com ênfase na resolução de problemas reais e interpretação dos resultados.  Na maioria dos estudos, a complexidade dos fenômenos estudados faz com seja necessário coletar informações sobre um conjunto de variáveis. A análise multivariada permite o estudo simultâneo de um conjunto de variáveis, aproveitando a estrutura de correlação existente entre as mesmas.  Nesta disciplina são apresentadas técnicas de análise de dados quantitativos e qualitativos, discutindo aplicações nas áreas de marketing, operações, recursos humanos e finanças.

Programa de Ensino 

Introducao ao R by Paloma Uribe (Material apresentado na 1a monitoria) 

Lista de exercicios

Trabalhos em grupo

Prova intermediaria: Prova (solucao)

Prova final: Solucao

Notas de aula

Codigo R

Textos complementares

Conjuntos de dados

Alguns sites interessantes para o curso

Econometria 2014

Disciplina: ECONOMETRIA 2014 – Turma 4ECO (Economia)
Período Letivo: 2014/1

Professor: Hedibert Freitas Lopes – www.hedibert.org

Objetivo: Apresentar uma abordagem introdutória a Econometria dando ênfase tanto à base estatística quanto a aplicações econômicas.  Será discutido, em detalhes, o significado e as implicações das suposições do modelo linear geral. Ainda, serão descritos e aplicados testes de violações das hipóteses do modelo linear geral, bem como serão apresentados e aplicados estimadores alternativos ao de mínimos quadrados ordinários (MQO). Ao final desse curso, o aluno deverá ser capaz de utilizar técnicas estatísticas adequadas para mensurar quantidades de interesse e realizar previsões.

Programa de Ensino 

12/02/2014: Apresentacao do curso + Primeiro exemplo

14/02/2014: Regressao Linear Simples – Parte 1: Minimos Quadrados Ordinarios & R2

19/02/2014: Regressao Linear Simples – Parte 2: formas funcionais  

21/02/2014: Regressao Linear Simples – Parte 3: Suposicoes, propriedades e teste-t

26/02/2014: Regressao Linear Multipla – Parte 1: Estimacao

28/02/2014: Regressao Linear Multipla – Parte 2: R2 ajustado

07/03/2014: Regressao Linear Multipla – Parte 3: Suposicoes e propriedades

      • Data on monthly earnings, education, several demographic variables, and IQ scores for 935 men in 1980. (Dataset)  (Codigo R)
      • Data on 4,137 US college students.(Dataset)  (Codigo R)

12/03/2014: Regressao Linear Multipla – Parte 4: Inferencia

14/03/2014: Regressao Linear Multipla – Parte 5: Interacao e funcao quadratica

19,21&26/03/2014: Regressao Linear Multipla – Parte 6: Informacao qualitativa atraves de variaveis dummy

11/04/2014: Regressao Linear Multipla – Parte 7: Teste F parcial

16/04/2014: Regressao Linear Multipla – Parte 8: Teoria assintotica

23/04/2014: Regressao Linear Multipla – Parte 9: Teste do multiplicador de Lagrange

      • R code for hprice1 example
      • Sawyer (2002) The Method of Lagrange Multipliers.
      • Buse (1982) The Likelihood Ratio, Wald, and Lagrange Multiplier Tests: An Expository Note.  The American Statistician, Vol. 36, No. 3, Part 1 (Aug., 1982), pp. 153-157.
      • Engle (1983) Wald, Likelihood Ratio, and Lagrange Multiplier Tests in Econometrics.  In Intriligator and Griliches. Handbook of Econometrics II. Elsevier. pp. 796–801.

25/04/2014: Regressao Linear Multipla – Parte 10: Regression specification error test  (RESET)

30/04/2014: Real-time analysis of three datasets

07-09/05/2014: Regressao Linear Multipla – Parte 11: Homocedasticidade

14/05/2014: Trabalho em grupo

16 a 30/05/2014:  Endogeneidade & Equacoes simultaneas

Listas de exercicios + gabaritos

Conjuntos de dados

Business Statistics 2013

Course: Business Statistics 41000-81/82 – Spring Quarter 2013

Professor: Hedibert Freitas Lopes

Teaching Assistant: Samir Warty

Office hours: Sundays 3pm-4:30pm (April 28th and June 9th: 3pm-5pm)

Location: Gleacher 203 (April 28th and June 9th: Gleacher 204)

Course notes

Course syllabus

Course notes (2 per page) (3 per page)

Old exams

Homework assignments

Midterm and final exams

      • 41000-81: Midterm – 04/29/2013 – 6:00pm-8:00pm
      • 41000-81: Final – 06/10/2013 – 6:30pm-9:30pm
      • 41000-82: Midterm – 04/30/2013 – 6:00pm-8:00pm
      • 41000-82: Final – 06/11/2013 – 6:30pm-9:30pm

Additional class material

Class 8: May 20th and 21st

Class 7: May 13th and 14th

Class 5: April 29th and 39th

Class 4: April 22nd and 23rd

Class 3: April 15th and 16th

Class 2: April 8th and 9th

Class 1: April 1st and 2nd

Data sets