Presentation is loading. Please wait.

Presentation is loading. Please wait.

Simulation techniques Summary of the methods we used so far Other methods –Rejection sampling –Importance sampling Very good slides from Dr. Joo-Ho Choi.

Similar presentations


Presentation on theme: "Simulation techniques Summary of the methods we used so far Other methods –Rejection sampling –Importance sampling Very good slides from Dr. Joo-Ho Choi."— Presentation transcript:

1

2 Simulation techniques Summary of the methods we used so far Other methods –Rejection sampling –Importance sampling Very good slides from Dr. Joo-Ho Choi of Korea Aersopace University, so very minor modifications and kept his format but added his Matlab scripts to notes.

3 - 2 - Overview of simulation Posterior distribution and posterior prediction –Plot shape of the distribution. –Calculate its statistical properties and confidence bounds. –Additional analysis if necessary. Phase I: analytical approach –Use analytical functions of standard pdfs. Posterior distribution Available pdf Available pdf for Predict. distribution  of Binom.. NA,  of N(     2 of N(    NA

4 Questions What are the important differences between the binomial and normal distribution as distributions? Assume that the wind speed of hurricanes reaching Gainesville is distributed lognormally and you use the data on all hurricanes in the last century to make predictions. –Give an example of a prediction you will make from the posterior distribution? –Give an example of a prediction you will make from the predictive distribution. –How do we use the results of the previous slide for making these predictions?

5 - 4 - Overview of simulation Phase II: sampling approach based on factorization –Use sampling technique of standard pdfs. 1.Draw  2 from the marginal pdf 2.Draw  from the conditional pdf Posterior distribution Available Pdf Available pdf for Predict. distribution  2 of N(    NA

6 - 5 - Overview of simulation Phase III: sampling approach based on factorization –Use sampling technique of inverse CDF for general case. 1.Draw  from the marginal pdf p(  |y). 2.Draw  from the conditional pdf p(  y). Posterior distribution Available Pdf Available pdf for Predict. distribution  of regress for death prob.  Too complex to express in closed form NA

7 Questions You have recorded the results of a very large number of throws of a pair of dice. All the possible pairs except (5,5) and (6,6) appeared at the same frequency, but these two appeared twice as often as the others. Note that we count (2,3) and (3,2) as separate pairs. –What is the observed marginal distribution of one die? –What is the observed marginal distribution of one die give that the other die fell on 5?

8 - 7 - Overview of simulation Remark –For more complicated & practical problems, analytic treatment of posterior distribution become more and more difficult or impossible. –A battery of powerful methods has been developed over the past few decades for simulating from probability distributions. References –Chap10 & 11 of Gelman et al. (BDA) –Andrieu, C., et al. (2003). An Introduction to MCMC for Machine Learning. Machine Learning, 50, 5–43. Methods of simulation –Grid method (inverse CDF method) –Rejection sampling –Importance sampling –Markov Chain Monte Carlo (MCMC) method

9 - 8 - Grid method (inverse CDF method) Procedure –In order to generate samples following pdf f(v), 1.Construct approx. cdf F(v) which is the integral of f(v). 2.Draw random value U from the uniform distribution on [0,1]. 3.let v=F -1 (U). Then the value v will be a random draw from f(v). Practice with matlab Remarks –Effective only when we have knowledge of the range and we miss nothing outside their ranges. –Not good for higher-dimensional multivariate problems, where computing at every point in the multidimensional grid becomes prohibitively expensive. –Conclusion: this method is not used well in practice.

10 - 9 - Rejection sampling Procedure –In order to generate samples for pdf p(x), introduce an arbitrary pdf q(x) that has sampling capability, such that Mq(x) bounds p(x). 1.Sample  at random from the proposal pdf q(x). 2.With probability p(x)/(Mq(x)), accept x as a draw from p. –M is just chosen such that Mq exceeds p at everywhere. Pseudo-code & illustration

11 Triangular distribution example p(x)=2x for x in [0,1] –Select q(x)=U[0,1] –Then M=3 is large enough. qsamp=rand(1,5) = 0.8147 0.9058 0.1270 0.9134 0.6324. px=2*qsamp = 1.6294 1.8116 0.2540 1.8268 1.2647 qx=ones(1,5) = 1 1 1 1 1 paccept=px./(3*qx) = 0.5431 0.6039 0.0847 0.6089 0.4216 accepttest=rand(1,5)=0.0975 0.2785 0.5469 0.9575 0.9649 accept=sign(paccept-accepttest)= 1 1 -1 -1 -1

12 - 11 - Rejection sampling Practice with matlab –generate samples of this distribution. Remarks –it is not always possible to bound p/q with reasonable amount M over the whole space. If M is too large, the acceptance probability Pr(x accepted) ~ 1/M is too small.

13 Homework For the triangular pdf defined in Slide 10, compare the accuracy of calculating the median and 95% percentile using 1,000 samples with the following techniques: –Using the inverse CDF (please obtain it analytically) –Rejection sampling using the uniform distribution with M=2,3, and10. Denoting the triangular distribution pt(x), consider the joint pdf f(x,y)=pt(x)pt(y). Estimate by sampling the mean of |x- y| without taking advantage of independence using the following techniques: –Grid method –Rejection sampling How many samples do you need for 1% accuracy for each technique ? Source: Smithsonian Institution


Download ppt "Simulation techniques Summary of the methods we used so far Other methods –Rejection sampling –Importance sampling Very good slides from Dr. Joo-Ho Choi."

Similar presentations


Ads by Google