Download presentation
Presentation is loading. Please wait.
Published byReynold Scott Modified over 9 years ago
1
Module 1: Statistical Issues in Micro simulation Paul Sousa
2
Overview Numerical Solution Numerical Solution Simulation Simulation Random number generation Random number generation Transformation Transformation Techniques: Gibbs sampling, Metropolis Hasting algorithm Techniques: Gibbs sampling, Metropolis Hasting algorithm Variance reduction techniques Variance reduction techniques Conclusion Conclusion
3
Numerical Solution Monte Carlo TechniqueSimulation Deterministic Simulation Stochastic Simulation Monte Carlo Simulation
4
Introduction Model Solution: Analytical vs Numerical Model Solution: Analytical vs Numerical Numerical solution: Substitutes Numbers for Independent Variables and Parameters--------Needs Iteration Technique. Numerical solution: Substitutes Numbers for Independent Variables and Parameters--------Needs Iteration Technique. Numerical Technique: Monte Carlo Method & Simulation Numerical Technique: Monte Carlo Method & Simulation Simulation: Deterministic Simulation & Stochastic Simulation. Simulation: Deterministic Simulation & Stochastic Simulation. Deterministic Simulation: Does not Necessarily Imply the Use of Random Number Deterministic Simulation: Does not Necessarily Imply the Use of Random Number Stochastic Simulation: Uses Random Numbers---Denoted as Monte Carlo Simulation. Stochastic Simulation: Uses Random Numbers---Denoted as Monte Carlo Simulation.
5
Linear Congruential Generators A sequence of integers I 1, I 2,…, each between 0 and m-1 (a large number) is generated by the recurrence relation: A sequence of integers I 1, I 2,…, each between 0 and m-1 (a large number) is generated by the recurrence relation: I j+1 = mod (a I j + c, m) where a and c are positive integers known as the multiplier and increment, and m is the modulus To calculate mod (X, m) divide X by m, then take the remainder term and multiply it by m To calculate mod (X, m) divide X by m, then take the remainder term and multiply it by m e.g. mod (12, 7) = 512/7 = 1.71430.7143 x 7 =5 Finally, divide I j by m gives a uniform variable between 0 and 1 Finally, divide I j by m gives a uniform variable between 0 and 1 Linear congruential methods are very fast, but are not completely free of sequential correlation on successive calls. Linear congruential methods are very fast, but are not completely free of sequential correlation on successive calls.
6
Transformation to other Distributions Consider a random variable with density function f (x) and corresponding cumulative density function F (x). If the inverse of cumulative density function for X can be calculated, then X can be obtained from U. Consider a random variable with density function f (x) and corresponding cumulative density function F (x). If the inverse of cumulative density function for X can be calculated, then X can be obtained from U. By definition, F (x) = k means that the probability of obtaining a draw equal to or below x is k, where k is between 0 and 1. A draw u from the standard uniform provides a number between 0 and 1. We can set F (x) = u. By definition, F (x) = k means that the probability of obtaining a draw equal to or below x is k, where k is between 0 and 1. A draw u from the standard uniform provides a number between 0 and 1. We can set F (x) = u. thus x = F -1 (u) This procedure works only for univariate distributions. This procedure works only for univariate distributions.
7
Univariate Density Example Example: Extreme value distribution Example: Extreme value distribution density function, f (x) = exp (-x) * exp(-exp(-x)) CDF, F (x) = exp(-exp(-x)) A draw from this density is obtained as x = -ln (-ln u) A draw from this density is obtained as x = -ln (-ln u) Draws from more complicated densities: Draws from more complicated densities: Accepting-Reject Method Importance Sampling Gibbs Sampling Metropolis-Hasting Algorithm
8
Accept-Reject Method More generalized way of drawing from multivariate distributions. More generalized way of drawing from multivariate distributions. Suppose we want to draw from multivariate density g (x) within the range a ≤ x ≤ b Suppose we want to draw from multivariate density g (x) within the range a ≤ x ≤ b i.e. drawing from: i.e. drawing from: f (x) = { 1/k g (x) a ≤ x ≤ b { 0otherwise where k is a normalized constant We can obtain draws from f by simply drawing from g and retaining (“accepting”) the draws that are within the relevant range and discarding (“rejecting”) the draws that are outside the range. We can obtain draws from f by simply drawing from g and retaining (“accepting”) the draws that are within the relevant range and discarding (“rejecting”) the draws that are outside the range.
9
Accept-Reject Method Advantage: It can be applied whenever it is possible to draw from the untruncated density. Advantage: It can be applied whenever it is possible to draw from the untruncated density. Disadvantage: Crude method -> problems Disadvantage: Crude method -> problems However, it is a useful “last option” However, it is a useful “last option”
10
Importance Sampling Suppose x has a density f (x) that cannot be easily drawn from by other procedures. Suppose further that there is another density g (x) that can be easily draw from. Suppose x has a density f (x) that cannot be easily drawn from by other procedures. Suppose further that there is another density g (x) that can be easily draw from. Draws from f (x) can be obtained as follows: Draws from f (x) can be obtained as follows: 1. Take a draw from g (x) and label it x 1. 2. Weight the draw by f (x 1 ) /g (x 1 ) 3. Repeat this process many times. The set of weight draws is equivalent to the set of draws from f. The set of weight draws is equivalent to the set of draws from f.
11
Gibbs Sampling For multinomial distributions, it is sometimes difficult to draw directly from the joint density and yet easy to draw from the conditional density of each element given the values of the other elements. Gibbs sampling can be used in these situations. For multinomial distributions, it is sometimes difficult to draw directly from the joint density and yet easy to draw from the conditional density of each element given the values of the other elements. Gibbs sampling can be used in these situations. Consider two random variables x 1 and x 2. Consider two random variables x 1 and x 2. The joint density is f (x 1, x 2 ), and the conditional densities are f (x 1 |x 2 ) and f (x 2 |x 1 ). The joint density is f (x 1, x 2 ), and the conditional densities are f (x 1 |x 2 ) and f (x 2 |x 1 ). Gibbs sampling proceeds by drawing iteratively from the conditional densities: drawing x 1 conditional on a value of x 2, drawing x 2 conditional on this draw of x 1, drawing a new x 1 conditional on the new value of x 2, and so on. Gibbs sampling proceeds by drawing iteratively from the conditional densities: drawing x 1 conditional on a value of x 2, drawing x 2 conditional on this draw of x 1, drawing a new x 1 conditional on the new value of x 2, and so on. This process converges to draws from the joint density. This process converges to draws from the joint density.
12
Metropolis-Hastings Algorithm 1. Start with a value of the vector x, labeled x 0 2. Choose a trial value of x 1 as x 1t = x 0 + n, where n is drawn from a distribution g (η) that has zero mean. Usually a normal distribution is specified for g (η). 3. Calculate the density at the trial value x 1t, and compare it with the density at the original value x 0, i.e. compare f (x 1t ) with f(x 0 ). If f (x 1t ) > f (x 0 ), then accept x 1t, label it x 1, and move to step 4. If f (x 1t ) ≤ f (x 0 ), then accept x 1t with probability f(x 1t )/f(x 0 ), and reject it with probability 1 - f(x 1t )/f(x 0 ). To determine whether to accept or reject x 1t in this case, draw a standard uniform μ. If μ ≤ f(x 1t )/f(x 0 ), then keep x 1t. Otherwise, reject x 1t. If x 1t is accepted, then label it x 1. If x 1t is rejected, then use x 0 as x 1.
13
Metropolis-Hastings Algorithm 4. Choose a trial value of x 2 as x 2t = x 1 + η, where η is a new draw from g (η). 5. Apply the rule in step 3 to either accept x 2t as x 2 or reject x 2t and use x 1 as x 2. 6. Continue this process for many iterations. The sequence x t becomes equivalent to draws from f (x) for sufficiently large t. General but computational intensive algorithm General but computational intensive algorithm
14
Variance Reduction The use of independent random draws in simulation is appealing because it is conceptually straightforward and the statistical properties of the resulting simulator are easy to derive. The use of independent random draws in simulation is appealing because it is conceptually straightforward and the statistical properties of the resulting simulator are easy to derive. However, there are other ways to take draws that can provide greater accuracy for a given number of draws. However, there are other ways to take draws that can provide greater accuracy for a given number of draws. In taking a sequence of draws from the density f( ), two issues are at stake: Coverage and Covariance. In taking a sequence of draws from the density f( ), two issues are at stake: Coverage and Covariance. Coverage: If our objective is to approximate over the entire domain F (x) = ∫ f (x) Coverage: If our objective is to approximate over the entire domain F (x) = ∫ f (x) A more accurate approximation would be obtained by evaluating f (x) throughout the entire domain of f better coverage A more accurate approximation would be obtained by evaluating f (x) throughout the entire domain of f better coverage
15
Variance Reduction Covariance With independent draws, the covariance over draws is zero. The variance of a simulator based on R independent draws is therefore the variance based on one draw divided by R. With independent draws, the covariance over draws is zero. The variance of a simulator based on R independent draws is therefore the variance based on one draw divided by R. If the draws are negatively correlated instead of independent, then the variance of the simulator is lower. If the draws are negatively correlated instead of independent, then the variance of the simulator is lower. The issue of Covariance is related to Coverage By inducing a negative correlation between draws, better coverage is usually assured. By inducing a negative correlation between draws, better coverage is usually assured. E.g. With R=2, if the two draws are taken independently, then both could end up being at the low side of the distribution. If negative correlation is induced, then the second draw will tend to be high if the first draw is low, which provides better coverage. E.g. With R=2, if the two draws are taken independently, then both could end up being at the low side of the distribution. If negative correlation is induced, then the second draw will tend to be high if the first draw is low, which provides better coverage.
16
Variance Reduction Techniques Antithetics Antithetics draws are obtained by creating various types of mirror images of a random draw. Antithetics draws are obtained by creating various types of mirror images of a random draw. For a symmetric density that is centered on zero, the simplest antithetic variate is created by reversing the sign of all elements of a draw. E.g. x 2k = - x 2k-1 k = 1 n/2 For a symmetric density that is centered on zero, the simplest antithetic variate is created by reversing the sign of all elements of a draw. E.g. x 2k = - x 2k-1 k = 1 n/2
17
Variance Reduction Techniques Systematic sampling Systematic sampling creates a grid of points over the support of the density and randomly shifts the entire grid. Systematic sampling creates a grid of points over the support of the density and randomly shifts the entire grid. Consider draws from a uniform distribution between 0 and 1. The unit interval is divided into four segments and draws taken in a way that assures one draw in each segment with equal distance between the draws. Take a draw from a uniform between 0 and 0.25, as x 1 ; x 2 = 0.25 + x 1 ; x3 = 0.5 + x 1 ; Consider draws from a uniform distribution between 0 and 1. The unit interval is divided into four segments and draws taken in a way that assures one draw in each segment with equal distance between the draws. Take a draw from a uniform between 0 and 0.25, as x 1 ; x 2 = 0.25 + x 1 ; x3 = 0.5 + x 1 ; x 4 = 0.75 + x 1. It implies a tradeoff between the number of random variables and the coverage It implies a tradeoff between the number of random variables and the coverage
18
Module 1: Statistical Issues in Micro simulation Paul Sousa
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.