+ All Categories
Home > Documents > Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler Statistics, Data...

Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler Statistics, Data...

Date post: 30-Aug-2019
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
5
Dr. Michael O. Distler <[email protected]> Statistics, Data Analysis, and Simulation – SS 2017 1/1 Mainz, 18. Mai 2017 Statistics, Data Analysis, and Simulation – SS 2017 08.128.730 Statistik, Datenanalyse und Simulation Dr. Michael O. Distler <[email protected]>
Transcript
Page 1: Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler  Statistics, Data Analysis, and Simulation – SS 2017 2 / 1 Metropolis-Hastings

Dr. Michael O. Distler <[email protected]> Statistics, Data Analysis, and Simulation – SS 2017 1 / 1

Mainz, 18. Mai 2017

Statistics, Data Analysis, andSimulation – SS 2017

08.128.730 Statistik, Datenanalyse undSimulation

Dr. Michael O. Distler<[email protected]>

Page 2: Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler  Statistics, Data Analysis, and Simulation – SS 2017 2 / 1 Metropolis-Hastings

Markov chain Monte CarloMetropolis-Hastings Algorithmus

Aufgabe: Bestimmen Sie Mittelwert, Varianz und Schiefe derWahrscheinlichkeitsdichte

p(x) = C exp(− 1

50(x − 3.2)(x − 2)(x − 1.1)(x + 0.9)(x + 2)(x + 3.3)

)C ≡ 0.0824759

mit einer MCMC Methode (Metropolis-Hastings Algorithmus).

-4 -2 2 4

0.1

0.2

0.3

0.4

Dazu erzeugen Sie eine Folge vonZahlen xt , t = 1, . . . ,N (Markovchain), die der Dichte p(x) folgen.Nach den Regeln der MC Integrationgilt dann für den Erwartungswert

〈A〉 ≈ 1N

N∑t=1

A(xt ).

Dr. Michael O. Distler <[email protected]> Statistics, Data Analysis, and Simulation – SS 2017 2 / 1

Page 3: Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler  Statistics, Data Analysis, and Simulation – SS 2017 2 / 1 Metropolis-Hastings

Metropolis-Hastings Algorithmus1 Wählen Sie einen Startwert und legen Sie die Kettenlänge fest,

z.B. x1 = 1 und N = 10000.2 Wählen Sie eine Vorschlagsdichte q(x |x̄), z.B. die

Normalverteilung N (µ, σ2). Setzen Sie σ2 = 2. Je ähnlicher dieVorschlagsdichte der Dichte p(x) ist, desto besser funktioniertder Algorithmus.

3 Generieren Sie zufällig einen Vorschlag x∗ für xt+1 aus derVorschlagsdichte N (xt , σ

2).4 Generieren Sie eine gleichverteilte Zufallszahl u aus U(0,1).5 Der Vorschlag x∗ wird akzeptiert, falls:

p(x∗)

p(xt )

q(xt |x∗)

q(x∗|xt )≥ u

Für den Fall einer symmetrischen Vorschlagsdichte (hierNormalverteilung) gilt q(xt |x∗)/q(x∗|xt ) = 1.

6 Wird der Vorschlag nicht akzeptiert, setzen Sie xt+1 = xt .7 Fahren Sie mit Punkt ??. fort, bis die gewünschte Kettenlänge N

erreicht ist.Dr. Michael O. Distler <[email protected]> Statistics, Data Analysis, and Simulation – SS 2017 3 / 1

Page 4: Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler  Statistics, Data Analysis, and Simulation – SS 2017 2 / 1 Metropolis-Hastings

Metropolis-Hastings Algorithmus

Mögliche Optimierungen:Wenn der Startwert ungünstig gewählt wurde, dannbenötigt der Algorithmus einige Zeit um einzuschwingen(sog. burn-in). In der Praxis werden die ersten 100 oder1000 Werte verworfen und so das "‘Gedächtnis"’ (d.h. dieAbhängigkeit vom Startwert) gelöscht.Variieren Sie die Varianz der Vorschlagsdichte, z.B.σ2 = 0.1, 2, 10 und betrachten Sie jeweils den Anteil derakzeptierten Vorschläge und plotten einen Ausschnitt von1000 Werten der Kette. In der Praxis bewährt sich einAnteil von 50%.Wählen Sie eine ganz andere Vorschlagsdichte, z.B.U(−2 + xt ,2 + xt ). Funktioniert der Algorithmus damit?

(siehe auch http://de.wikipedia.org/wiki/Metropolisalgorithmus)

Dr. Michael O. Distler <[email protected]> Statistics, Data Analysis, and Simulation – SS 2017 4 / 1

Page 5: Statistics, Data Analysis, and Simulation – SS 2017 · Dr. Michael O. Distler  Statistics, Data Analysis, and Simulation – SS 2017 2 / 1 Metropolis-Hastings

Monte Carlo Integration

Theorem der Monte Carlo Integration:∫V

A(x)dnx

=VN

∑A(xi)±

V√N

√1N

∑A(xi)2 −

(1N

∑A(xi)

)2

Mögliche Verbesserungen:Reduktion der DimensionenReduktion der VarianzDurchbrechen der 1√

NMauer

Dr. Michael O. Distler <[email protected]> Statistics, Data Analysis, and Simulation – SS 2017 5 / 1


Recommended