F19: Introduction to Monte Carlo simulations. Ebrahim Shayesteh

Similar documents
SIMULATION OF ELECTRICITY MARKETS

ELEMENTS OF MONTE CARLO SIMULATION

Brooks, Introductory Econometrics for Finance, 3rd Edition

Fast Convergence of Regress-later Series Estimators

2.1 Mathematical Basis: Risk-Neutral Pricing

UQ, STAT2201, 2017, Lectures 3 and 4 Unit 3 Probability Distributions.

UPDATED IAA EDUCATION SYLLABUS

Chapter 5 Univariate time-series analysis. () Chapter 5 Univariate time-series analysis 1 / 29

Monte Carlo and Empirical Methods for Stochastic Inference (MASM11/FMS091)

System planning, EG2050 Probabilistic production cost simulation of electricity markets L12. Calculation of system index - Basic idea.

SECOND EDITION. MARY R. HARDY University of Waterloo, Ontario. HOWARD R. WATERS Heriot-Watt University, Edinburgh

CPSC 540: Machine Learning

Monte Carlo Simulations in the Teaching Process

Using Monte Carlo Integration and Control Variates to Estimate π

-divergences and Monte Carlo methods

Strategies for Improving the Efficiency of Monte-Carlo Methods

ROM SIMULATION Exact Moment Simulation using Random Orthogonal Matrices

Practical example of an Economic Scenario Generator

Chapter 2 Uncertainty Analysis and Sampling Techniques

Martingale Pricing Theory in Discrete-Time and Discrete-Space Models

Importance Sampling for Fair Policy Selection

4 Reinforcement Learning Basic Algorithms

Monte Carlo Methods for Uncertainty Quantification

Math 416/516: Stochastic Simulation

Optimal Search for Parameters in Monte Carlo Simulation for Derivative Pricing

Sampling and sampling distribution

Monte Carlo and Empirical Methods for Stochastic Inference (MASM11/FMSN50)

Monte Carlo Methods in Financial Engineering

CPSC 540: Machine Learning

PROBABILITY. Wiley. With Applications and R ROBERT P. DOBROW. Department of Mathematics. Carleton College Northfield, MN

Premia 14 HESTON MODEL CALIBRATION USING VARIANCE SWAPS PRICES

Market Risk: FROM VALUE AT RISK TO STRESS TESTING. Agenda. Agenda (Cont.) Traditional Measures of Market Risk

درس هفتم یادگیري ماشین. (Machine Learning) دانشگاه فردوسی مشهد دانشکده مهندسی رضا منصفی

Presented at the 2012 SCEA/ISPA Joint Annual Conference and Training Workshop -

Chapter 7: Point Estimation and Sampling Distributions

I. Time Series and Stochastic Processes

INSTITUTE AND FACULTY OF ACTUARIES. Curriculum 2019 SPECIMEN SOLUTIONS

Chapter 5. Continuous Random Variables and Probability Distributions. 5.1 Continuous Random Variables

FREDRIK BAJERS VEJ 7 G 9220 AALBORG ØST Tlf.: URL: Fax: Monte Carlo methods

IEOR E4703: Monte-Carlo Simulation

Monte Carlo Methods in Option Pricing. UiO-STK4510 Autumn 2015

Calculating VaR. There are several approaches for calculating the Value at Risk figure. The most popular are the

3. Monte Carlo Simulation

Measuring and managing market risk June 2003

Domokos Vermes. Min Zhao

Monte Carlo Introduction

An Experimental Study of the Behaviour of the Proxel-Based Simulation Algorithm

Math Computational Finance Double barrier option pricing using Quasi Monte Carlo and Brownian Bridge methods

Economics 2010c: Lecture 4 Precautionary Savings and Liquidity Constraints

2 Control variates. λe λti λe e λt i where R(t) = t Y 1 Y N(t) is the time from the last event to t. L t = e λr(t) e e λt(t) Exercises

STATS 200: Introduction to Statistical Inference. Lecture 4: Asymptotics and simulation

Publication date: 12-Nov-2001 Reprinted from RatingsDirect

History of Monte Carlo Method

STOCHASTIC COST ESTIMATION AND RISK ANALYSIS IN MANAGING SOFTWARE PROJECTS

1. For a special whole life insurance on (x), payable at the moment of death:

Math Computational Finance Option pricing using Brownian bridge and Stratified samlping

Version A. Problem 1. Let X be the continuous random variable defined by the following pdf: 1 x/2 when 0 x 2, f(x) = 0 otherwise.

Importance Sampling for Option Pricing. Steven R. Dunbar. Put Options. Monte Carlo Method. Importance. Sampling. Examples.

Monte Carlo Methods for Uncertainty Quantification

Assembly systems with non-exponential machines: Throughput and bottlenecks

DRAFT. 1 exercise in state (S, t), π(s, t) = 0 do not exercise in state (S, t) Review of the Risk Neutral Stock Dynamics

Random Variables Handout. Xavier Vilà

Market risk measurement in practice

MONTE CARLO EXTENSIONS

Financial Risk Modeling on Low-power Accelerators: Experimental Performance Evaluation of TK1 with FPGA

STOCHASTIC COST ESTIMATION AND RISK ANALYSIS IN MANAGING SOFTWARE PROJECTS

"Vibrato" Monte Carlo evaluation of Greeks

Fast Computation of the Economic Capital, the Value at Risk and the Greeks of a Loan Portfolio in the Gaussian Factor Model

A new approach for scenario generation in risk management

EFFICIENT MONTE CARLO ALGORITHM FOR PRICING BARRIER OPTIONS

Financial Engineering. Craig Pirrong Spring, 2006

[D7] PROBABILITY DISTRIBUTION OF OUTSTANDING LIABILITY FROM INDIVIDUAL PAYMENTS DATA Contributed by T S Wright

Contents Critique 26. portfolio optimization 32

RISK MITIGATION IN FAST TRACKING PROJECTS

IEOR E4703: Monte-Carlo Simulation

Equity correlations implied by index options: estimation and model uncertainty analysis

ROM Simulation with Exact Means, Covariances, and Multivariate Skewness

Value at Risk Ch.12. PAK Study Manual

Investigations on Factors Influencing the Operational Benefit of Stochastic Optimization in Generation and Trading Planning

Monte Carlo Methods in Finance

Using Monte Carlo Analysis in Ecological Risk Assessments

Hand and Spreadsheet Simulations

Mobility for the Future:

B. Maddah INDE 504 Discrete-Event Simulation. Output Analysis (3)

Institute of Actuaries of India Subject CT6 Statistical Methods

Computer Exercise 2 Simulation

Overview. Transformation method Rejection method. Monte Carlo vs ordinary methods. 1 Random numbers. 2 Monte Carlo integration.

A Stochastic Reserving Today (Beyond Bootstrap)

Pricing & Risk Management of Synthetic CDOs

Cost Risk and Uncertainty Analysis

Lecture outline. Monte Carlo Methods for Uncertainty Quantification. Importance Sampling. Importance Sampling

GMM for Discrete Choice Models: A Capital Accumulation Application

THE DISTRIBUTION OF LOAN PORTFOLIO VALUE * Oldrich Alfons Vasicek

Monte Carlo Methods in Structuring and Derivatives Pricing

IEOR E4602: Quantitative Risk Management

Pricing Dynamic Guaranteed Funds Under a Double Exponential. Jump Diffusion Process. Chuang-Chang Chang, Ya-Hui Lien and Min-Hung Tsay

Computational Finance Improving Monte Carlo

Modelling component reliability using warranty data

"Pricing Exotic Options using Strong Convergence Properties

Implementing Models in Quantitative Finance: Methods and Cases

Transcription:

F19: Introduction to Monte Carlo simulations Ebrahim Shayesteh

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 2

Repetition: fault models Note: "Non-repairable systems A summary of functions to describe the stochastic variable T (when a failure occurs): Cumulative distribution function: survivor function: Probability density function: Failure rate: F R f z t P T t t P T t 1 F t ( t) F t R t t f t F t R t 1 F t 3

Repetition: repairable systems Repairable systems: alternating renewal process X(t) 1 0 t T 1 D 1 T 2 D 2 T 3 D 3 T 4 Mean Time To Failure (MTTF) Mean Down Time (MDT) Mean Time To Repair (MTTR), sometimes, but not always the same as MDT Mean Time Between Failure (MTBF = MTTF + MDT) 4

Repetition: repairable systems The availability for a unit is defined as the probability that the unit is operational at a given time t 1 Note: if the unit cannot be repaired A(t)=R(t) if the unit can be repaired, the availability will depend both on the lifetime distribution and the repair time. 5

Repetition: repairable systems The share of when the unit has been working thus becomes: n T n i 1 T i i 1 i 1 i n D i n 1 Ti n i 1 n 1 1 Ti n n i 1 i 1 n D i It results when in: A av ET ED ET MTTF MTTF MDT 6

Repetition: repairable systems The failure frequency (referred to as either ω or f) during the total time interval i is provided by: f 1 MTTF MDT Note the difference between failure rate (λ = 1/MTTF) and failure frequency (f =1/MTBF). For short down time compared to the operation time (i.e. MDT << MTTF), this difference is negligible: λ f. o This assumption is often applicable and used within reliability analyses of power distribution! 7

System of components A technical system can be described as consisting of a number of functional blocks that are interconnected to perform a number of required functions where components are modeled as blocks. There are two fundamental system categories: 1. Serial systems (often in power distribution contexts referred to as radial system/lines/feeders) 2. Parallel systems Often, a system can be seen as a composition of several subsystems of these two fundamental types 8

Methods: approximate equations Approximate equations for a serial system (MDT << MTTF is assumed): Failure rate, Unit, e.g: [failures/year]: Unavailability, Unit, e.g: [hours/year]: Average repair time, Unit, e.g: [hours]: U s s r s n i 1 n i 1 U s s i r i i 9

Methods: approximate equations Approximate equations for a parallel system (MDT << MTTF is assumed): Failure rate, Unit, e.g: [failures/year]: Unavailability, Unit, e.g: [hours/year]: Average repair time, Unit, e.g: [hours]: 1 2( r1 r2 ) p 1 2( r1 r 1 1r1 2r2 r1 r2 r p r1 r2 U r r p p p 1 2 1r2 2 ) 10

System indices Additional reliability measures - System indices Previously calculated measures for system reliability λ s,u s and r s specifies expected values, or mean, of a probability distribution. These measures however not describe the impact of a fault which can mean significant differences for different load points: For example a load point with one customer and a load of load 10 kw and another with 100 customers and load of 500 MW. In order to take into account more aspects, system indices are calculated. 11

System indices Customer-oriented reliability indices System average interruption frequency index SAIFI [failures/year, customer] λ Customer average interruption frequency index CAIFI [Failure/year, customer] λ λ i is the failure rate of load point i (LP i ) and N i is equal to number of customers in LP i 12

System indices Customer-oriented reliability indices System average interruption duration index SAIDI [hours/year, customer]: Customer average interruption duration index CAIDI [hours/failure]: λ U i is the outage time of load point i (LP i ) and N i is equal to number of customers in Lp i 13

System indices Average service availability index (ASAI) [probability between 0 and 1] or [%]: 8760 8760 where 8760 is number of hours/year Also Average service unavailability index (ASUI) are used: ASUI = 1-ASAI 14

System indices Energy-oriented reliability indices Energy not supplied index (ENS) [kwh/year] Average energy not supplied index (AENS) [kwh/year, customer] U i is the outage time of load point i (LP i ), N i is equal to number of customers in Lp i and L a(i) is average average load of Lp i : 15

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 16

Monte Carlo methods: background A class of methods used to solve mathematical problems by studying random samples. It is, in another word, an experimental approach to solve a problem. Theoretical basis of Monte Carlo is the Law of Large Numbers: The average of several independent stochastic variables with the same expected value m is close to m, when the number of stochastic variables is large enough. The result is that: 17

Monte Carlo methods: background The second most important (i.e., useful) theoretical result for Monte Carlo is the Central Limit Theorem. CLT: The sum of a sufficiently large number of independent identically distributed random variables becomes normally distributed as N increases. This is useful for us because we can draw useful conclusions from the results from a large number of samples (e.g., 68.7% within one standard deviation, etc.). 18

Monte Carlo methods: simulation The word simulation in Monte Carlo Simulation is derived from Latin simulare, which means to make like. Thus, a simulation is an attempt to imitate natural or technical systems. Different simulation methods: Physical simulation: Study a copy of the original system which is usually smaller and less expensive than the real system. Computer simulation: Study a mathematical model of the original system. Interactive simulation: Study a system (either physical or a computer simulation) and its human operators. 19

Monte Carlo methods: simulation Y g(y) X Inputs: The inputs are random variables with known probability distributions. For convenience, we collect all input variables in a vector, Y. 20

Monte Carlo methods: simulation Y g(y) X Model: The model is represented by the mathematical function, g(y). The random behavior of the system is captured by the inputs, i.e., the model is deterministic! Hence, if x1 = g(y1), x2 = g(y2) and y1 = y2 then x1 = x2. 21

Monte Carlo methods: simulation Y g(y) X Outputs: The outputs are random variables with unknown probability distributions. For convenience, we collect all output variables in a vector, X. The objective of the simulation is to study the probability distribution of X!. 22

Monte Carlo methods: simulation example Y g(y) X Inputs: The status of all primary lines, all lateral lines, and the amount of power consumption and number of customers at each load points. Model: The structure of the distribution system given the above inputs. Outputs: The reliability measures, e.g., the value of system indices. 23

Monte Carlo methods: motivation Assume that we want to calculate the expectation value, E[X], of the system X = g(y). According to the definition of expectation value we get the following expression: What reasons are there to solve this problem using Monte Carlo methods rather than analytical methods? 24

Monte Carlo methods: motivation Complexity: The model g(y) may not be an explicit function. Example: The outputs, x, are given by the solution to an optimization problem, where the inputs y appear as parameters, i.e., Problem size: The model may have too many inputs or outputs. Example: 10 inputs integrate over 10 dimensions! 25

Monte Carlo methods: motivation Analytic model or simulation method? The analytic models are usually valid under certain restrictive assumptions such as independence of the inputs, limited status number, etc. MC method can be used for large problems with multiple status. Physical visibility of a complex system is higher in the simulation method. The analytical methods are more accurate than simulations as long as no simplifying assumption is considered. Otherwise, it cannot be compared. In the case of future development in the system, simulation methods are more appropriate since future developments may be more tractable. For small systems, the analytic methods are faster while enough random scenarios need to be simulated in MC method which takes longer time. 26

Monte Carlo methods: motivation Analytic model or simulation method? Advantages of each method: Analitical Exact results if there are limited assumptions The outputs are fast once the model is obtained Computer is not necessarily needed Monte-Carlo The analyses are very flexible The model extention is easy It can easily be understood 27

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 28

Example 1: Buffon s needle The position of the needle can be described using two parameters: a = least distance from the needle center to one of the parallel lines (0 a d/2). ϑ = least angle between the needle direction and the parallel lines (0 ϑ π/2). The needle will cross a line if its projection on a line perpendicular to the parallel lines is larger than the distance to the closest line, i.e. if: Pi and Buffon's Matches - Numberphile.mp4 (from YouTube) 29

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 30

Simple Sampling: introduction Y g(y) X Simple sampling means that completely random observations (samples) of a random variable, X, are collected. A sufficient number of samples will provide an estimate of E[X] according to the law of large numbers: Simple sampling can also be used to estimate other statistical properties (for example variance or probability distribution) of X: Exercise: Show that 31

Simple Sampling: computer simulation Y g(y) X In the computer simulation problem, we generate samples by randomizing the input values, yi, and calculate the outcome xi = g(yi). Then, the expected value and variance of all samples are calculated. 32

Simple Sampling: random numbers Y g(y) X How do we generate the inputs Y to a computer simulation? A pseudo-random number generator provides U(0, 1)- distributed random numbers. Y generally has some other distribution. There are several methods to transform U(0, 1)- distributed random numbers to an arbitrary distribution. One example method is to use the inverse transform method. 33

Simple Sampling: random numbers Y g(y) X Inverse transform method: Theorem: If a random variable U is U(0, 1)-distributed then has the distribution function. 34

Simple Sampling: random numbers Inverse transform method example: A pseudo-random number generator providing U(0, 1)-distributed random numbers has generated the value U = 0.40. a) Transform U to a result of throwing a fair six-sided dice. b) Transform U to a result from a U(10, 20)-distribution. 35

Simple Sampling: random numbers Inverse transform method example: A pseudo-random number generator providing U(0, 1)-distributed random numbers has generated the value U = 0.40. a) Transform U to a result of throwing a fair six-sided dice. Answer: 36

Simple Sampling: random numbers Inverse transform method example: A pseudo-random number generator providing U(0, 1)-distributed random numbers has generated the value U = 0.40. b) Transform U to a result from a U(10, 20)-distribution. Answer: The inverse distribution function is given by 37

Simple Sampling: computer simulation Y g(y) X Therefore, the computer simulation problem can be updated as follows: 38

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 39

Example 2: Travel time from A to B Questions: a) Estimate the expected travel time from A to B! b) Estimate Var[X] assuming that 1000 scenarios of the system in example 6 have been generated, and the following results are obtained: 40

Example 2: Travel time from A to B Questions: a) Estimate the expected travel time from A to B! Answer: 41

Example 2: Travel time from A to B Questions: a) Estimate Var[X] assuming that 1000 scenarios of the system in example 6 have been generated, and the following results are obtained: Answer: 42

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 43

Accuracy: Variance reduction techniques A Monte Carlo simulation does not converge towards the true expectation value in the same sense as the geometric series is converging to 1. As we collect more samples, the probability of getting an inaccurate estimate is decreasing, but there is no guarantee that we get a better estimate if we generate another sample. It is more or less inevitable that the result of a Monte Carlo simulation is inaccurate the question is how inaccurate it is! 44

Accuracy: Variance reduction techniques Remember that MX is a random variable and E[MX] = E[X]. Hence, Var[MX] is an indicator of the accuracy of the simulation method. 45

Accuracy: Variance reduction techniques Theorem: In simple sampling, the variance of the estimated expectation value is: For infinite populations we get: 46

Accuracy: Variance reduction techniques We have in many cases some knowledge about the system to be simulated. This knowledge can be used to improve the accuracy of the simulation. Methods based on some knowledge of the system are called variance reduction techniques, since improving the accuracy is equivalent to reducing Var[MX]. 47

Accuracy: Variance reduction techniques Some examples of such techniques are as follows: Complementary random numbers Dagger Sampling Control Variates Correlated Sampling Importance Sampling Strata Sampling 48

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 49

VRT 1: Complementary random numbers All observations in simple sampling are independent of each other. Sometimes it is possible to increase the probability of a good selection of samples if the samples are not independent. 50

VRT 1: Complementary random numbers Consider two estimates MX1 and MX2 of the same expectation value μx, i.e., Study the mean of these estimates, i.e., Expectation value: i.e., the combined estimate MX is also an estimate of μx. 51

VRT 1: Complementary random numbers Variance: If MX1 and MX2 both are independent estimates obtained with simple sampling and the number of samples is the same in both simulations, then we get Var[MX1] = Var[MX2] and Cov[MX1, MX2] = 0. Hence, 52

VRT 1: Complementary random numbers Variance: The variance obtained is equivalent to one run of simple sampling using 2n samples; according to theorem mentioned, we should get half the variance when the number of samples is doubled. However, if the MX1 and MX2 are not independent but negatively correlated then the covariance term will make Var[MX] smaller than the corresponding variance for simple sampling using the same number of samples. 53

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 54

Example 3: DC OPF problem Question: How many random number do we need? Answer: 11 random numbers (3+4+4=11) 55

Example 3: DC OPF problem Answer: Question: Which technique is the best? 56

Introduction and repetition Agenda Monte Carlo methods: Background, Introduction, Motivation Example 1: Buffon s needle Simple Sampling Example 2: Travel time from A to B Accuracy: Variance reduction techniques VRT 1: Complementary random numbers Example 3: DC OPF problem 57

Agenda Thank you! 58