Advanced Simulation - Lecture 2 Patrick Rebeschini January 17th, - - PowerPoint PPT Presentation

advanced simulation lecture 2
SMART_READER_LITE
LIVE PREVIEW

Advanced Simulation - Lecture 2 Patrick Rebeschini January 17th, - - PowerPoint PPT Presentation

Advanced Simulation - Lecture 2 Patrick Rebeschini January 17th, 2018 Patrick Rebeschini Lecture 2 1/ 18 Outline Monte Carlo methods rely on random numbers to approximate integrals. Bayesian statistics in particular yields many intractable


slide-1
SLIDE 1

Advanced Simulation - Lecture 2

Patrick Rebeschini January 17th, 2018

Patrick Rebeschini Lecture 2 1/ 18

slide-2
SLIDE 2

Outline

Monte Carlo methods rely on random numbers to approximate integrals. Bayesian statistics in particular yields many intractable integrals. In this lecture we’ll see some statistical problems involving integrals, and discuss the properties of the basic Monte Carlo estimator.

Patrick Rebeschini Lecture 2 2/ 18

slide-3
SLIDE 3

Bayesian Inference: Gaussian Data

Let Y = (Y1, ..., Yn) be i.i.d. random variables with Yi ∼ N

θ, σ2 with σ2 known and θ unknown.

Assign a prior distribution on the parameter: ϑ ∼ N

µ, κ2, then one can check that

p (θ| y) = N

  • θ; ν, ω2

where ω2 = κ2σ2 nκ2 + σ2 , ν = σ2 nκ2 + σ2 µ + nκ2 nκ2 + σ2 y. Thus E (ϑ|y) = ν and V (ϑ|y) = ω2.

Patrick Rebeschini Lecture 2 3/ 18

slide-4
SLIDE 4

Bayesian Inference: Gaussian Data

If C :=

ν − Φ−1 (1 − α/2) ω, ν + Φ−1 (1 − α/2) ω , then

P (ϑ ∈ C| y) = 1 − α. If Yn+1 ∼ N

θ, σ2 then

p (yn+1| y) =

  • Θ

p (yn+1| θ) p (θ| y) dθ = N

  • yn+1; ν, ω2 + σ2

. No need to do Monte Carlo approximations: the prior is conjugate for the model.

Patrick Rebeschini Lecture 2 4/ 18

slide-5
SLIDE 5

Bayesian Inference: Logistic Regression

Let (xi, Yi) ∈ Rd × {0, 1} where xi ∈ Rd is a covariate and P (Yi = 1| θ) = 1 1 + e−θT xi Assign a prior p (θ) on ϑ. Then Bayesian inference relies on p (θ| y1, ..., yn) = p (θ)

n

  • i=1

P (Yi = yi| θ) P (y1, ..., yn) If the prior is Gaussian, the posterior is not a standard distribution: P (y1, ..., yn) cannot be computed.

Patrick Rebeschini Lecture 2 5/ 18

slide-6
SLIDE 6

S&P 500 index

200 300 400 01/01/84 01/01/86 01/01/88 01/01/90 01/01/92

time S&P500

Figure: S&P 500 daily price index (pt) between 1984 and 1991.

Patrick Rebeschini Lecture 2 6/ 18

slide-7
SLIDE 7

S&P 500 index

−0.2 −0.1 0.0 0.1 01/01/84 01/01/86 01/01/88 01/01/90 01/01/92

time log returns

Figure: Daily returns yt = log(pt/pt−1) between 1984 and 1991.

Patrick Rebeschini Lecture 2 7/ 18

slide-8
SLIDE 8

Bayesian Inference: Stochastic Volatility Model

Latent stochastic volatility (Xt)t≥1 of an asset is modeled through Xt = ϕXt−1 + σVt, Yt = β exp (Xt) Wt where Vt, Wt ∼ N (0, 1) . Intuitively, log-returns are modeled as centered Gaussians with dependent variances. Popular alternative to ARCH and GARCH models (Engle, 2003 Nobel Prize). Estimate the parameters (ϕ, σ, β) given the observations. Estimate Xt given Y1, ..., Yt on-line based on p (xt| y1, ..., yt) . No analytical solution available!

Patrick Rebeschini Lecture 2 8/ 18

slide-9
SLIDE 9

Monte Carlo Integration

We are interested in computing I =

  • X

ϕ (x) π (x) dx where π is a pdf on X and ϕ : X → R. Monte Carlo method: sample n independent copies X1, . . . , Xn of X ∼ π, compute ˆ In = 1 n

n

  • i=1

ϕ(Xi). Remark: You can think of it as having the following empirical measure approximation of π (dx)

  • πn (dx) = 1

n

n

  • i=1

δXi (dx) where δXi (dx) is the Dirac measure at Xi.

Patrick Rebeschini Lecture 2 9/ 18

slide-10
SLIDE 10

Monte Carlo Integration: Limit Theorems

Proposition (LLN): Assume E (|ϕ (X)|) < ∞ then In is a strongly consistent estimator of I. Proposition (CLT): Assume I and σ2 = V (ϕ (X)) =

  • X

[ϕ (x) − I]2 π (x) dx are finite then (see computation in previous lecture) E

  • In − I

2

= V

  • In
  • = σ2

n and √n σ

  • In − I

D

→ N (0, 1) .

Patrick Rebeschini Lecture 2 10/ 18

slide-11
SLIDE 11

Monte Carlo Integration: Variance Estimation

Proposition: Assume σ2 = V (ϕ (X)) exists then S2

n =

1 n − 1

n

  • i=1
  • ϕ (Xi) −

In

2

is an unbiased sample variance estimator of σ2. Proof: let Yi = ϕ (Xi) then we have E

  • S2

n

  • =

1 n − 1

n

  • i=1

E

  • Yi − Y

2

= 1 n − 1E

n

  • i=1

Y 2

i − nY 2

  • =

1 n − 1

  • n
  • V (Y ) + I2

− n

  • V
  • Y
  • + I2

= V (Y ) = V (ϕ (X)) .

Patrick Rebeschini Lecture 2 11/ 18

slide-12
SLIDE 12

Monte Carlo Integration: Error Estimates

Chebyshev’s inequality yields the bound P

  • In − I
  • > c σ

√n

V

  • In
  • c2σ2/n = 1

c2 . An estimate follows from the CLT for large n √n σ

  • In − I
  • ≈ Z ∼ N (0, 1) ,

so that P

  • In − I
  • > c σ

√n

  • ≈ 2 (1 − Φ (c)) .

Hence by choosing c = cα s.t. 2 (1 − Φ (cα)) = α, an approximate (1 − α) 100%-CI for I is

  • In ± cα

σ √n

  • In ± cα

Sn √n

  • and the rate is in 1/√n whatever X.

Patrick Rebeschini Lecture 2 12/ 18

slide-13
SLIDE 13

Toy Example

Consider the case where we have a square say S ⊆R2, the sides being of length 2, with inscribed disk D of radius 1. We want to compute through Monte Carlo the area I of D. I = π =

D

dx1dx2 =

S

ID (x1, x2) dx1dx2 as D ⊂ S = 4

R2 ID (x1, x2) π (x1, x2) dx1dx2

where S := [−1, 1] × [−1, 1] and π (x1, x2) = 1 4IS (x1, x2) is the uniform density on the square S.

Patrick Rebeschini Lecture 2 13/ 18

slide-14
SLIDE 14

Toy Example

  • 0.0

0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0

X Y

inside

  • FALSE

TRUE

Figure: In = 4 nD

n where nD is the number of samples which fell

within the disk.

Patrick Rebeschini Lecture 2 14/ 18

slide-15
SLIDE 15

Toy Example

−0.2 0.0 0.2 250 500 750 1000

number of samples error

Figure: Relative error of In against the number of samples.

Patrick Rebeschini Lecture 2 15/ 18

slide-16
SLIDE 16

Drawing random numbers

Computing intricate high-dimensional integrals boils down to generating random variables from complicated distributions. How does a computer simulate random variables? In R, the command runif(100) returns 100 realizations of a uniform random variable in (0, 1). Strictly speaking, these are only “pseudo-random numbers”.

Patrick Rebeschini Lecture 2 16/ 18

slide-17
SLIDE 17

Drawing random numbers

Henceforth, we will assume that we have access to a sequence of independent random variables (Ui, i ≥ 1) that are uniformly distributed on [0, 1]. To simulate from π (x1, x2) = 1

4IS (x1, x2), we draw U1 and

U2 uniformly and define X1 = 2U1 − 1, X2 = 2U2 − 1. Then the point (X1, X2) is distributed uniformly within S. In the following lectures we will see various methods to simulate probability distributions.

Patrick Rebeschini Lecture 2 17/ 18

slide-18
SLIDE 18

Galton’s machine to draw normal samples

Patrick Rebeschini Lecture 2 18/ 18