Monte Carlo Simulations and PcNaive Heino Bohn Nielsen 1 of 21 - - PDF document

monte carlo simulations and pcnaive
SMART_READER_LITE
LIVE PREVIEW

Monte Carlo Simulations and PcNaive Heino Bohn Nielsen 1 of 21 - - PDF document

Econometrics 2 Fall 2005 Monte Carlo Simulations and PcNaive Heino Bohn Nielsen 1 of 21 Monte Carlo Simulations MC simulations were introduced in Econometrics 1. Formalizing the thought experiment underlying the data sampling. In


slide-1
SLIDE 1

Econometrics 2 — Fall 2005

Monte Carlo Simulations and PcNaive

Heino Bohn Nielsen

1 of 21

Monte Carlo Simulations

  • MC simulations were introduced in Econometrics 1.

Formalizing the thought experiment underlying the data sampling.

  • In this course we will frequently use MC simulations.

Standard tool in econometrics.

  • Underlying the econometric results is a layer of difficult statistical theory.

(1) Many asymptotic results are technically demanding.

Sometimes also difficult to firmly understand.

→ Use MC simulations to obtain intuition.

(2) The finite sample properties are often analytically intractable.

→ Analyze finite sample properties.

2 of 21

slide-2
SLIDE 2

Outline of the Lecture

(1) The basic idea in Monte Carlo simulations. (2) Example 1: Sample mean (OLS) of IID normals. (3) Example 2: Illustration of a Central Limit Theorem. (4) Introduction to PcNaive. (5) Example 3: Consistency and unbiasedness of OLS in a cross-sectional regression.

Genereal-to-Specific or Specific-to-General?

3 of 21

The Monte Carlo Idea

The basic idea of the Monte Carlo method: “Replace a difficult deterministic problem with a stochastic problem with the same solution.” If we can solve the stochastic problem by simulations, labour intensive work can be replaced by cheap capital intensive simulations. Problem:

  • How can we be sure that the deterministic and stochastic problem have the same

solution? General answer is the law of large numbers (LLN): sample moments converge to population moments.

4 of 21

slide-3
SLIDE 3

Example

  • Consider a regression

yi = x0

iβ + i,

i = 1, 2, ..., N,

(∗) where xi and i have some specified properties; and the OLS estimator

b β = Ã N X

i=1

xix0

i

!−1 Ã N X

i=1

xiyi ! .

We are often interested in E[b

β] to check for bias. This is difficult in most situations.

  • But if we could draw realizations of b

β, we could estimate E[b β].

MC simulation:

(1) Construct M artificial data sets from the model (∗). (2) Find the estimator, b

βm, for each data set, m = 1, 2, ..., M.

Then from the LLN:

M−1

M

X

m=1

b βm → E[b β]

for

M → ∞.

5 of 21

Note of Caution

The Monte Carlo method is a useful tool in econometrics. BUT:

(1) Simulations do not replace theory.

Simulation can illustrate but not prove theorems.

(2) Simulations results are not general.

Results are specific to the chosen setup. We have to totally specify the model.

(3) Work like good examples.

In this course we hope to give you a Monte Carlo intuition.

6 of 21

slide-4
SLIDE 4

Example 1: Mean of IID Normals

  • Consider a model where we know the finite sample properties:

yi = µ + i, i ∼ N(0, η2), i = 1, 2, ..., N.

(∗∗)

  • The OLS estimator b

µ of µ is the sample mean b µ = N−1

N

X

i=1

yi.

Note, that b

µ is consistent, unbiased and (exactly) normally distributed b µ ∼ N(µ, N−1η2).

  • The standard deviation of the estimate, in PcNaive called the estimated standard

error, can be calculated as ESE(b

µ) = q N−1b η2 = v u u tN−2

N

X

i=1

(yi − b µ)2.

7 of 21

  • Ex. 1 (cont.): Illustration by Simulation

We can illustrate the results, if we can generate data from (∗∗). We need:

(1) A fully specified Data Generating Process (DGP), e.g.

yi = µ + i, i ∼ N(0, η2), i = 1, 2, ..., N

(#)

µ = 5 η2 = 1.

An algorithm for drawing random numbers from N(·, ·). Specify a sample length, e.g. N = 50 or N ∈ {10, 20, 30, ..., 100}.

(2) An estimation model for yi and an estimator. Consider OLS in

yi = β + ui.

(##) Note that the statistical model (#) and the DGP (##) need not coincide.

8 of 21

slide-5
SLIDE 5
  • Ex. 1 (cont.): Four Realizations
  • Suppose we draw 1, ..., 50 from N(0, 1) and construct a data set,

y1, ..., y50.

  • We then apply OLS to the regression model

yi = β + ui,

to obtain the sample mean and the standard deviation in one realization,

b β = 4.98013, ESE(b β) = 0.1477.

  • We can look at more realizations

Realization, m

b βm

ESE(b

βm)

1 4.98013 0.1477 2 5.04104 0.1320 3 4.99815 0.1479 4 4.82347 0.1504 Mean 4.96070 0.1445

9 of 21

Four Realization

4 6

First realization, Mean=4.98013

4 6

Second realization, Mean=5.04104

2.5 5.0 7.5

Third realization, Mean=4.99815

2.5 5.0 7.5

Fourth realization, Mean=4.82347

10 of 21

slide-6
SLIDE 6
  • Ex. 1 (cont.): Formalization

Now suppose we generate data from (#) M times,

ym

1 , ..., ym 50,

m = 1, 2, ..., M.

For each m we obtain a sample mean b

βm.

  • We look at the mean estimate and the Monte Carlo standard deviation:

MEAN(b

β) = M−1

M

X

m=1

b βm

MCSD(b

β) = v u u tM−1

M

X

m=1

³ b βm − MEAN(b β) ´2

  • For large M we expect:

MEAN(b

β) to be close to the true µ (LLN). The small sample bias is

BIAS = MEAN(b

β) − µ.

11 of 21

  • Ex. 1 (cont.): Measures of Uncertainty

Note, that MEAN(b

β) is also an estimator (stochastic variable).

The standard deviation of MEAN(b

β) is the Monte Carlo standard error

MCSE(b

β) = M−1

2MCSD(b

β).

Note the difference

  • MCSD(b

β) measures the uncertainty of b β

(≈ESE(b

βm)).

  • MCSE(b

β) measures the uncertainty of MEAN(b β) in the simulation.

MCSE(b

β) → 0 for M → ∞.

12 of 21

slide-7
SLIDE 7
  • Ex. 1 (cont.): Results

Consider the results for N = 50, M = 5000 :

b βm

ESE(b

βm)

1 4.98013 0.1477 2 5.04104 0.1320 . . . . . . . . . 5000 4.92140 0.1254 MEAN(b

β)=4.9985

MEAN(ESE)=0.14083 MCSD(b

β)=0.14061

MCSE(b

β)=0.0019886

13 of 21

  • Ex. 1 (cont.): Results for Different N

3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 0.5 1.0

Density, T=5

3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 0.5 1.0

Density, T=10

3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 1 2 3

Density, T=50

50 100 150 200 250 4.5 5.0 5.5

Estimates, different T

14 of 21

slide-8
SLIDE 8

Example 2: A Central Limit Theorem (CLT)

Recall the idea of a CLT (Lindeberg-Levy):

  • Let z1, ..., zN be IID with E [zi] = µ and V [zi] = σ2. Then

1 √ N

N

X

i=1

zi − µ σ → N (0, 1) for N → ∞.

This can be extended to

  • Heterogeneous processes.
  • (Limited) time dependence.

We will illustrate this for two examples

  • Uniform distribution.
  • Exponential distribution.

15 of 21

  • Ex. 2 (cont.): Uniform Distribution

Consider as an example

zi ∼ Uniform (0 : 1) , i = 1, 2, ..., N.

It holds that

E [zi] = 1 2 V [zi] = (1 − 0)2 12 = 1 12.

We look at the estimated distribution of

1 √ N

N

X

i=1

zi − µ σ = 1 √ N

N

X

i=1

√ 12 · µ zi − 1 2 ¶ ,

based on M = 20000 replications.

16 of 21

slide-9
SLIDE 9
  • Ex. 2 (cont.): Uniform Distribution
  • 4
  • 2

2 4 0.5 1.0

N=1

  • 4
  • 2

2 4 0.2 0.4

N=2

  • 4
  • 2

2 4 0.2 0.4

N=5

  • 4
  • 2

2 4 0.2 0.4

N=10

17 of 21

  • Ex. 2 (cont.): Exponential Distribution

Consider as a second example

zi ∼ Exp (1) , i = 1, 2, ..., N.

It holds that

E [zi] = 1 V [zi] = 12 = 1.

We look at the estimated distribution of

1 √ N

N

X

i=1

zi − µ σ = 1 √ N

N

X

i=1

(zi − 1) ,

based on M = 20000 replications.

18 of 21

slide-10
SLIDE 10
  • Ex. 2 (cont.): Exponential Distribution
  • 2.5

0.0 2.5 5.0 7.5 0.25 0.50 0.75

N=1

  • 2.5

0.0 2.5 5.0 0.2 0.4

N=2

  • 4
  • 2

2 4 6 0.2 0.4

N=5

  • 4
  • 2

2 4 0.2 0.4

N=50

19 of 21

PcNaive

  • PcNaive is a menu-driven module in GiveWin.
  • Technically, PcNaive generates Ox code, which is then executed by Ox. Output is

returned in GiveWin.

  • Outline:

(1) Set up the DGP.

— AR(1) — Static — PcNaive — General

(2) Specify the estimation model. (3) Choose estimators and test statistics to analyze. (4) Set specifications: M, N etc. (5) Select output to generate. (6) Save and run.

20 of 21

slide-11
SLIDE 11

Example 3: PcNaive Static DGP

DGP:

yi = α1 · x1i + α2 · x2i + i, i ∼ N(0, 1) µ x1i x2i ¶ ∼ N ∙µ ¶ , µ 1 c c 1 ¶¸

for i = 1, 2, ..., N. Estimation model: Apply OLS to the linear regression model

yi = β0 + β1 · x1i + β2 · x2i + ui.

Example:

(1) Unbiasedness and consistency of OLS in this setting. (2) Effect of including a redundant regressor. (3) Effect of excluding a relevant regressor.

21 of 21