Simulation. Li Zhao, SJTU. Spring, Li Zhao Simulation 1 / 19

Similar documents
MLE and GMM. Li Zhao, SJTU. Spring, Li Zhao MLE and GMM 1 / 22

Latent Variable Models for Binary Data. Suppose that for a given vector of explanatory variables x, the latent

9 Drawing from Densities

I. Multinomial Logit Suppose we only have individual specific covariates. Then we can model the response probability as

Multivariate probit regression using simulated maximum likelihood

2 Random Variable Generation

Lecture 3 Optimization methods for econometrics models

Bayesian tsunami fragility modeling considering input data uncertainty

Bayesian Inference in GLMs. Frequentists typically base inferences on MLEs, asymptotic confidence

Direct Simulation Methods #2

Monte Carlo Composition Inversion Acceptance/Rejection Sampling. Direct Simulation. Econ 690. Purdue University

This exam is closed book and closed notes. (You will have access to a copy of the Table of Common Distributions given in the back of the text.

Patterns of Scalable Bayesian Inference Background (Session 1)

Math 151. Rumbos Fall Solutions to Review Problems for Exam 2. Pr(X = 1) = ) = Pr(X = 2) = Pr(X = 3) = p X. (k) =

Gaussian Processes. Le Song. Machine Learning II: Advanced Topics CSE 8803ML, Spring 2012

Chapter 5 continued. Chapter 5 sections

Efficient estimation of Probit models with correlated errors

Probabilistic Choice Models

Economics 583: Econometric Theory I A Primer on Asymptotics

A Model of Human Capital Accumulation and Occupational Choices. A simplified version of Keane and Wolpin (JPE, 1997)

Simulating Uniform- and Triangular- Based Double Power Method Distributions

Basic Sampling Methods

,..., θ(2),..., θ(n)

Econ 673: Microeconometrics

Multivariate Distribution Models

Properties of Random Variables

Statistical Distributions and Uncertainty Analysis. QMRA Institute Patrick Gurian

Mathematical statistics

Lecture 1: August 28

Efficient multivariate normal distribution calculations in Stata

Binary choice. Michel Bierlaire

Stat 451 Lecture Notes Simulating Random Variables

Financial Econometrics

Bayesian Inference for DSGE Models. Lawrence J. Christiano

Research Division Federal Reserve Bank of St. Louis Working Paper Series

conditional cdf, conditional pdf, total probability theorem?

Three hours. To be supplied by the Examinations Office: Mathematical Formula Tables and Statistical Tables THE UNIVERSITY OF MANCHESTER.

Multivariate Capability Analysis Using Statgraphics. Presented by Dr. Neil W. Polhemus

Discrete Choice Modeling

Gibbs Sampling in Endogenous Variables Models

Multivariate Distributions

Chapter 9 Regression with a Binary Dependent Variable. Multiple Choice. 1) The binary dependent variable model is an example of a

Density estimation Nonparametric conditional mean estimation Semiparametric conditional mean estimation. Nonparametrics. Gabriel Montes-Rojas

ML estimation: Random-intercepts logistic model. and z

Modeling Binary Outcomes: Logit and Probit Models

Binary Models with Endogenous Explanatory Variables

Max. Likelihood Estimation. Outline. Econometrics II. Ricardo Mora. Notes. Notes

Using the Delta Method to Construct Confidence Intervals for Predicted Probabilities, Rates, and Discrete Changes 1

Fundamentals. CS 281A: Statistical Learning Theory. Yangqing Jia. August, Based on tutorial slides by Lester Mackey and Ariel Kleiner

Spring 2012 Math 541B Exam 1

Web Appendix for The Value of Reputation in an Online Freelance Marketplace

Gibbs Sampling in Latent Variable Models #1

Formulas for probability theory and linear models SF2941

A heuristic for moment-matching scenario generation

STA 2201/442 Assignment 2

EXAMINATIONS OF THE ROYAL STATISTICAL SOCIETY

Session 5B: A worked example EGARCH model

Economics 520. Lecture Note 19: Hypothesis Testing via the Neyman-Pearson Lemma CB 8.1,

Simulating Random Variables

This paper is not to be removed from the Examination Halls

1 Outline. 1. MSL. 2. MSM and Indirect Inference. 3. Example of MSM-Berry(1994) and BLP(1995). 4. Ackerberg s Importance Sampler.

Sampling Distributions and Asymptotics Part II

Graduate Econometrics I: What is econometrics?

Review. December 4 th, Review

Estimation theory. Parametric estimation. Properties of estimators. Minimum variance estimator. Cramer-Rao bound. Maximum likelihood estimators

σ(a) = a N (x; 0, 1 2 ) dx. σ(a) = Φ(a) =

John Geweke Department of Economics University of Minnesota Minneapolis, MN First draft: April, 1991

Econometric Analysis of Cross Section and Panel Data

Linear Regression With Special Variables

A6523 Signal Modeling, Statistical Inference and Data Mining in Astrophysics Spring 2011

ECLT 5810 Linear Regression and Logistic Regression for Classification. Prof. Wai Lam

Lecture 12: Application of Maximum Likelihood Estimation:Truncation, Censoring, and Corner Solutions

Bayesian Inference for DSGE Models. Lawrence J. Christiano

Gaussian Processes for Machine Learning

Econometrica Supplementary Material

Bayesian Econometrics - Computer section

Spatial Discrete Choice Models

Week 9 The Central Limit Theorem and Estimation Concepts

Midterm Examination. STA 215: Statistical Inference. Due Wednesday, 2006 Mar 8, 1:15 pm

Testing an Autoregressive Structure in Binary Time Series Models

Identification and Estimation Using Heteroscedasticity Without Instruments: The Binary Endogenous Regressor Case

Stat 5101 Lecture Notes

R. Koenker Spring 2017 Economics 574 Problem Set 1

Lecture 21: Convergence of transformations and generating a random variable

Geometric Skew-Normal Distribution

f(x θ)dx with respect to θ. Assuming certain smoothness conditions concern differentiating under the integral the integral sign, we first obtain

Field Course Descriptions

CMPE 58K Bayesian Statistics and Machine Learning Lecture 5

Mixtures of Gaussians. Sargur Srihari

Irr. Statistical Methods in Experimental Physics. 2nd Edition. Frederick James. World Scientific. CERN, Switzerland

Recitation 2: Probability

A New Generalized Gumbel Copula for Multivariate Distributions

Machine learning - HT Maximum Likelihood

Fall 2017 STAT 532 Homework Peter Hoff. 1. Let P be a probability measure on a collection of sets A.

ECON 594: Lecture #6

Lecture 6: Discrete Choice: Qualitative Response

Bayesian Semiparametric GARCH Models

Bayesian Semiparametric GARCH Models

Rockefeller College University at Albany

Limited Dependent Variables and Panel Data

Transcription:

Simulation Li Zhao, SJTU Spring, 2017 Li Zhao Simulation 1 / 19

Introduction Simulation consists of drawing from a density, calculating a statistic for each draw, and averaging the results. Simulation methods play a very important role in Approximating integration (such as simulated maximum likelihood, simulated method of moments); Maximization; Forecasting; Counterfactual analysis; Bayesian analysis. Li Zhao Simulation 2 / 19

Outline 1 Simulate Random Variables 2 Approximate Expectation Simple Case Importance Sampling 3 Simulated-Assisted Estimation Maximum Simulated Likelihood Method of Simulated Moments 4 GHK Simulator Li Zhao Simulation 3 / 19

Simulate One Random Variable Statistical software can draw many types of random numbers. Uniform, binomial, normal, etc. Drawing a random variable from corresponding cumulative distribution F (ε). Step 1: Draw u (r) U[0,1]. A draw from the standard uniform provides a number between zero and one. Step 2: Solve ε (r) = F 1 (u (r) ). The cumulative distribution of ε (r) equals F ( ). Note that this procedure works only for univariate distributions. Li Zhao Simulation 4 / 19

Example: Simulate Type 1 Extreme Value Distribution The Type 1 extreme value distribution, which is the basis for logit model, has cumulative distribution F (ε) = exp( exp( ε)). A draw from this density if obtained as ε = ln( ln µ)). Suppose that (X 1,X 2,...) is a sequence of independent random variables, each with the standard exponential distribution G(x) = 1 e x. The distribution of Y = max{x 1,X 2,...X n ) ln(n) converges to the (type 1) standard extreme value distribution as n. We can verify this using simulation. Li Zhao Simulation 5 / 19

Simulate Multivariate Normals Suppose we want to draw ε N(b,Σ). ε is a p 1 vector. A Choleski factor of is dened as a lower-triangular matrix L such that L L = Σ. L is called the Choleski factor. Then we can generate η (r) N(0 3,I 3 ). Then b + Lη (r) N(b,Σ). For example, when p = 3, we generate ε 1 l 11 0 0 ε 2 = b + l 21 l 22 0 ε 3 l 31 l 32 l 33 η 1 η 2 η 3 Li Zhao Simulation 6 / 19

Outline 1 Simulate Random Variables 2 Approximate Expectation Simple Case Importance Sampling 3 Simulated-Assisted Estimation Maximum Simulated Likelihood Method of Simulated Moments 4 GHK Simulator Li Zhao Simulation 7 / 19

Approximate Expectation Suppose x F ( ). Principle of integration via simulation (Monte Carlo integration"): approximate an expectation as a sample average. If we are interested in E(x), we can draw ε (1),ε (2),...ε (R) independently from f (x). By law of large number, E(x) = ε f (ε) dε 1 R F R ε (r). r=1 If we are interested in E(t(x)), we can draw ε (1),ε (2),...ε (R) independently from f (x). By LLN, E(t(x)) = t(ε) f (ε) dε 1 R F R t(ε (r) ). r=1 Li Zhao Simulation 8 / 19

Importance Sampling Suppose we want to approximate. E(t(x)) = t(ε) f (ε) dε 1 R F R t(ε (r) ) r=1 What is is hard to fraw ε f ( ) but it is easy to draw ε g( )? We can draw ε (1),ε (2),...ε (R) independently from g( ) E(t(x)) = t(ε)f (ε)dε = t(ε) f (ε) F G t g(ε) g(ε)ds 1 R R t(ε (r) ) f (ε(r) ) r=1 g(ε (r) ) Sampling t(ε) from f ( ) distribution is equivalent to sampling t(ε) w(ε) from g( ) distribution, with importance sampling weight w(ε) = f (ε) g(ε). f and g should have the same support. Li Zhao Simulation 9 / 19

Importance Sampling - Algorithm Suppose ε has a density f (ε) that cannot be easily drawn from by the other procedures. Suppose further that there is another density, g(ε), that can easily be drawn from. Draws from f ( ) can be obtained as follows. 1) Take a draw from g(ε) and label it ε 1. 2) Weight the draw by f (ε 1 )/g(ε 2 ). 3) Repeat this process many times. The set of weighted draws is equivalent to a set of draws from f. Li Zhao Simulation 10 / 19

Importance Sampling - Example Suppose we want to simulate the mean of a standard normal distribution, truncated to the unit interval [0, 1]. The desired sampling density is: f (x) = φ(x) 1 0 φ(x)dx. We may draw ε N(0,1) and throw away observations outside [0,1]. Or, we can use importance sampling, draw ε U[0,1] so g(ε) = 1. For each draw, we multiple its weight w(ε) = f (x) g(x) = φ(x) 10 φ(x)dx. The simulated mean 1 R R r=1 ε (r) w(ε (r) ) is the mean of truncated normal. We will use importance sampling in discrete-outcome game-theoretic model. In that application, we are asked to draw truncated multivariate normal distribution. Li Zhao Simulation 11 / 19

Outline 1 Simulate Random Variables 2 Approximate Expectation Simple Case Importance Sampling 3 Simulated-Assisted Estimation Maximum Simulated Likelihood Method of Simulated Moments 4 GHK Simulator Li Zhao Simulation 12 / 19

Maximum Simulated Likelihood The log-likelihood function is: LL(θ) = lnp n (θ). n P n (θ) is the (exact) probability of the observed choice of observation n, and the summation is over a sample. Let P S n (θ) be a simulated approximation to P n (θ). The simulated log-likelihood function is SLL(θ) = lnpn S (θ). n Li Zhao Simulation 13 / 19

Method of Simulated Moments Method of moments: The moments, like the expectation of any variables, are functions of the parameters: E(g(x,y,θ)) = 0. For example. E(x(y x β)) = 0. g(x,yβ) = x(y x β). We take sample moments ĝ. The GMM estimator minimizes The MSM ĝ(θ) W ĝ(θ). If g(β) is dicult to calculate, we can simulate it, denote as g S (β). MSM estimator minimizes gˆ S (θ) W g ˆS (θ). Li Zhao Simulation 14 / 19

Outline 1 Simulate Random Variables 2 Approximate Expectation Simple Case Importance Sampling 3 Simulated-Assisted Estimation Maximum Simulated Likelihood Method of Simulated Moments 4 GHK Simulator Li Zhao Simulation 15 / 19

GHK simulator GewekeHajivassiliouKeane (GHK) multivariate normal simulator. Consider the Probit Model where ε 1 ε 2 ε 3 What is P 0? How to get ˆP 0? P 0 = N(0,Σ). u 0 = 0 u 1 = βx 1 + ε 1 u 2 = βx 2 + ε 2 u 3 = βx 3 + ε 3 P 0 = Pr(u 1 < 0,u 2 < 0,u 3 < 0). βx1 βx2 βx3 φ 123 (ε 1,ε 2,ε 3 ;Σ)dε 3 dε 2 dε 1. numerical approximations perform poorly in computing high order integrals. Li Zhao Simulation 16 / 19

GHK Simulator - Trivariate Case (1) Let us illustrate the GHK simulator in the trivariate case (generalization to higher orders is straightforward). We wish to evaluate P 0 = Pr(ε 1 < βx 1,ε 2 < βx 2,ε 3 < βx 3 ). The joint distribution can be rewritten as a product of conditional probabilities: Pr(ε 1 < βx 1 ) Pr(ε 2 < βx 2 ε 1 < βx 1 ) Pr(ε 3 < βx 2 ε 1 < βx 1,ε 2 < βx 2 ) Let L be the lower triangular Cholesky decomposition of Σ, such that: L L = Σ. ε 1 l 11 0 0 η 1 ε 2 = l 21 l 22 0 η 2 ε 3 l 31 l 32 l 33 η 3 Li Zhao Simulation 17 / 19

GHK simulator - Trivariate Case (2) Pr(ε 1 < βx 1 ) Pr(ε 2 < βx 2 ε 1 < βx 1 ) Pr(ε 3 < βx 2 ε 1 < βx 1,ε 2 < βx 2 ). Pr(ε 1 < βx 1 ) = Pr(η 1 < βx 1 l 11 ) Pr(ε 2 < βx 2 ε 1 < βx 1 ) = Pr(η 2 < βx 2 l 21 η 1 l 22 η 1 < βx 1 l 11 ) Pr(ε 3 < βx 2 ε 1 < βx 1,ε 2 < βx 2 ) =Pr(η 3 < βx 3 l 31 η 1 l 32 η 2 l 33 η 1 < βx 1 l 11,η 2 < βx 2 l 21 η 1 l 22 ) Because (η 1,η 2,η 3 ) are independent, we can draw η (s) 1, η (s) 2 from truncated normal, and approximate P 0 as a product of univariate CDF. P 0,GHK = 1 S S s=1 Φ( βx 1 l 11 )Φ( βx2 l η (s) 21 1 l 22 )Φ( βx 3 l 31 η (s) 1 l 32 η (s) 2 ). l 33 Li Zhao Simulation 18 / 19

Summarize Like other mathematically intensive sciences, economics is becoming increasingly computerized. Common software Stata / EViews / GAUSS/ R / Matlab / C / Fortran / Python / Julia. Econometrics: Approximate expectation, SML, MSM. Approximate standard error by bootstrap and subsampling. Optimization. Forecast and counterfactual analysis. Li Zhao Simulation 19 / 19