STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation

Slides:



Advertisements
Similar presentations
Random Processes Introduction (2)
Advertisements

STATISTICS Sampling and Sampling Distributions
RSLAB-NTU Lab for Remote Sensing Hydrology and Spatial Modeling 1 An Introduction to R Pseudo Random Number Generation (PRNG) Prof. Ke-Sheng Cheng Dept.
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling STATISTICS Hypotheses Test.
STATISTICS Univariate Distributions
STATISTICS Joint and Conditional Distributions
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling STATISTICS Hypotheses Test.
R_SimuSTAT_1 Prof. Ke-Sheng Cheng Dept. of Bioenvironmental Systems Eng. National Taiwan University.
R_SimuSTAT_2 Prof. Ke-Sheng Cheng Dept. of Bioenvironmental Systems Eng. National Taiwan University.
STATISTICS Random Variables and Distribution Functions
Generating Random Numbers
CmpE 104 SOFTWARE STATISTICAL TOOLS & METHODS MEASURING & ESTIMATING SOFTWARE SIZE AND RESOURCE & SCHEDULE ESTIMATING.
 1  Outline  generation of random variates  convolution  composition  acceptance/rejection  generation of uniform(0, 1) random variates  linear.
Random number generation Algorithms and Transforms to Univariate Distributions.
Continuous Random Variables and Probability Distributions
Chapter 6 Continuous Random Variables and Probability Distributions
Evaluating Hypotheses
Generating Continuous Random Variables some. Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating.
Continuous Random Variables and Probability Distributions
Properties of Random Numbers
Lecture II-2: Probability Review
STATISTICS HYPOTHESES TEST (I) Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National Taiwan University.
Fundamental Graphics in R Prof. Ke-Sheng Cheng Dept. of Bioenvironmental Systems Eng. National Taiwan University.
 1  Outline  stages and topics in simulation  generation of random variates.
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling STATISTICS Random Variables.
Random Sampling, Point Estimation and Maximum Likelihood.
Theory of Probability Statistics for Business and Economics.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
STATISTICS INTERVAL ESTIMATION Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National Taiwan University.
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling STATISTICS Interval Estimation.
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling Introduction STATISTICS Introduction.
STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National.
ETM 607 – Random-Variate Generation
Random Variable The outcome of an experiment need not be a number, for example, the outcome when a coin is tossed can be 'heads' or 'tails'. However, we.
STATISTICS Univariate Distributions Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National Taiwan University.
Dept of Bioenvironmental Systems Engineering National Taiwan University Lab for Remote Sensing Hydrology and Spatial Modeling STATISTICS Linear Statistical.
STATISTICS Joint and Conditional Distributions Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National Taiwan University.
STOCHASTIC HYDROLOGY Stochastic Simulation of Bivariate Distributions Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National.
Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering National Taiwan University 1/45 GEOSTATISTICS INTRODUCTION.
Continuous Random Variables and Probability Distributions
Chapter 20 Statistical Considerations Lecture Slides The McGraw-Hill Companies © 2012.
STA347 - week 91 Random Vectors and Matrices A random vector is a vector whose elements are random variables. The collective behavior of a p x 1 random.
Stochastic Hydrology Random Field Simulation Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National Taiwan University.
Gil McVean, Department of Statistics Thursday February 12 th 2009 Monte Carlo simulation.
G. Cowan Lectures on Statistical Data Analysis Lecture 5 page 1 Statistical Data Analysis: Lecture 5 1Probability, Bayes’ theorem 2Random variables and.
Computer Simulation Henry C. Co Technology and Operations Management,
STATISTICS HYPOTHESES TEST (I)
STATISTICS POINT ESTIMATION
STATISTICS Joint and Conditional Distributions
STATISTICS Random Variables and Distribution Functions
STATISTICS Univariate Distributions
Stochastic Hydrology Hydrological Frequency Analysis (II) LMRD-based GOF tests Prof. Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering.
REMOTE SENSING Multispectral Image Classification
REMOTE SENSING Multispectral Image Classification
Stochastic Hydrology Random Field Simulation
STATISTICS INTERVAL ESTIMATION
Lecture 2 – Monte Carlo method in finance
Stochastic Hydrology Hydrological Frequency Analysis (I) Fundamentals of HFA Prof. Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering.
POPULATION (of “units”)
Fundamental Graphics in R
STOCHASTIC HYDROLOGY Random Processes
Statistical Methods for Data Analysis Random number generators
Stochastic Hydrology Simple scaling in temporal variation of rainfalls
Professor Ke-sheng Cheng
STATISTICS HYPOTHESES TEST (I)
STATISTICS Univariate Distributions
Generating Random Variates
Professor Ke-Sheng Cheng
Presentation transcript:

STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation Professor Ke-Sheng Cheng Department of Bioenvironmental Systems Engineering National Taiwan University

Stochastic Hydrology Hydrological processes exhibit variations in both space and time. As hydrological models are simplified versions of reality, they produce predictions or estimates of hydrological variables (e.g. runoff, hydraulic head, concentration) that are inherently erroneous. Stochastic hydrology is mainly concerned about presenting and assessing uncertainty in hydrological analysis, modeling and forecasting. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

In stochastic hydrology, the assessment of uncertainty is an integral part of hydrological analysis and modeling, being as important as the predictions themselves. Assessment of uncertainties is achieved by using “stochastic models”, which are models consisting of random components. These random components characterize the part of reality that is not explained by the deterministic components in our model. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Errors in hydrological model prediction can occur because the model concept is wrong, or due to errors in parameters, boundary and initial conditions. We may choose to ignore these errors and accept our model predictions at face value. Model uncertainty Parameter uncertainty 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

However, in operational hydrology, when actual decisions have to be made based on hydrological model predictions (sometimes involving human life such as in flood control), it is imperative that uncertainty is taken into account in the decision-making process. Government policy decision-making is a complicated process. (Holistic decision making) An inappropriate decision may result in significant losses of life or over/under-investments in public infrastructures. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

What does a prediction really represent? Example of a linear regression model 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

What does a prediction really represent? Example of a linear regression model. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Predictions of data-driven models. Predictions of deterministic models. Properties of the predictand variable Unbiased ? Confidence interval ? For parameter estimation, we are concerned about the above properties of our estimators, but why not the predictions? 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

The objectives of this course are To demonstrate the stochastic nature of many hydrological processes, To facilitate students with a stochastic perspective of hydrological modeling and forecasting, and To introduce techniques of stochastic simulation which will enable students to explore a wide range of applications. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Univariate Simulation Pseudo random number generation Probability integral transformation Acceptance/Rejection method Frequency-factor based generation Random number generation using R 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Pseudo Random Number Generator (PRNG) Computer simulation of random variables is the task of using computers to generate many random numbers that are independent and identically distributed (IID). It is also known as random number generation (RNG). In fact, these computer-generated random numbers form a deterministic sequence, and the same list of numbers will be cycled over and over again. This cycle can be made to be so long that the lack of true independence is unimportant. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Therefore, such computer codes are often termed pseudo-random number generators (PRNG). There exist mathematical transformation methods to obtain other distributions from uniform variates. For this reason, most PRNGs found in software libraries produce uniform random numbers in the unit interval (0, 1). 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Linear Congruential Generator Generation of random samples of various probability densities is based random samples of the uniform density U[0,1). Therefore, the algorithm of generating random numbers of U[0,1) is essential. This can be achieved by the Linear Congruential Generator (LCG) described below. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Let a sequence of numbers xn be defined by modulo m where a, c, and m are given positive integers. The above equation means that is divided by m and the remainder is taken as the value of . The quantity is then taken as an approximation to the value of a U[0,1) random variable. When c = 0, the algorithm is also called a pure multiplicative generator. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

A guideline for selection of a and m (c =0) is that m be chosen to be a large prime number that can be fitted to the computer word size. For a 32-bit word computer, m = and a = result in desired properties. For small computers without a random number generator, the following a, c, and m are found to be satisfactory when the LCG algorithm is used: and 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

PROBABILITY INTEGRAL TRANSFORMATION The PIT method is based on the property that a random variable X with CDF can be transformed into a random variable U with uniform distribution over the interval (0,1) by defining Conversely, if U is uniformly distributed over the interval (0,1), then has cumulative distribution function . 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

The normal distribution is one such random variable. For random variables whose cumulative distribution function cannot be expressed by a close form the probability integral transformation technique cannot be used for generating random numbers of these random variables. The normal distribution is one such random variable. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

The Acceptance/Rejection Method This method uses an auxiliary density for generation of random quantities from another distribution. This method is particularly useful for generating random numbers of random variables whose cumulative distribution functions cannot be expressed in closed form. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Suppose that we want to generate random numbers of a random variable X with density f(X). An auxiliary density g(X) which we know how to generate random samples is identified and cg(X) is everywhere no less than f(X) for some constant c, i.e., 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

cg(X) f(X) X 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Generate a random number x of density g(X), Generate a random number u from the density U[0,cg(x)), Reject x if u > f(x); otherwise, x is accepted as a random number form f(X), Repeat the above steps until the desired number of random numbers are obtained. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Frequency-factor-based generation An advantage of the method is that it does not require CDF inversion and frequency factors of five commonly used distributions involves only the standard normal and the uniform deviates. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

GENERAL EQUATION FOR HYDROLOGICAL FREQUENCY ANALYSIS A random variable X has cumulative distribution function with mean and standard deviation . The magnitude of X corresponding to return period T, denoted by , is defined as Chow (1951) proposed the following general equation for hydrologic frequency analysis: where , the frequency factor, is a function of T and is distribution-specific. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Apparently, if X is normally distributed, the frequency factor corresponds to the standard normal deviate with exceedence probability 1/T. Frequency factors of distributions commonly used in hydrologic frequency analysis have been developed (Kite, 1988). 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Generating random samples of normal distribution The Box-Muller method 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

The Central Limit Theorem 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Acceptance/Rejection Method The cumulative distribution function of the exponential density and its inverse function can be easily derived, and therefore, random samples of the exponential distribution can be generated with the probability integral transformation method. 6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

6/26/2018 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Random number generation in R R commands for stochastic simulation (for normal distribution pnorm – cumulative probability qnorm – quantile function rnorm – generating a random sample of a specific sample size dnorm – probability density function For other distributions, simply change the distribution names. For examples, (punif, qunif, runif, and dunif) for uniform distribution and (ppois, qpois, rpois, and dpois) for Poisson distribution. 6/26/2018 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.

Generating random numbers of discrete distribution using R Discrete uniform distribution R does not provide default functions for random number generation for the discrete uniform distribution. However, the following functions can be used for discrete uniform distribution between 1 and k. rdu<-function(n,k) sample(1:k,n,replace=T) # random number ddu<-function(x,k) ifelse(x>=1 & x<=k & round(x)==x,1/k,0) # density pdu<-function(x,k) ifelse(x<1,0,ifelse(x<=k,floor(x)/k,1))  # CDF qdu <- function(p, k) ifelse(p <= 0 | p > 1, return("undefined"), ceiling(p*k)) # quantile 6/26/2018 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.

Similar, yet more flexible, functions are defined as follows dunifdisc<-function(x, min=0, max=1) ifelse(x>=min & x<=max & round(x)==x, 1/(max-min+1), 0) >dunifdisc(23,21,40) >dunifdisc(c(0,1)) punifdisc<-function(q, min=0, max=1) ifelse(q<min, 0, ifelse(q>max, 1, floor(q-min+1)/(max-min+1))) >punifdisc(0.2) >punifdisc(5,2,19) qunifdisc<-function(p, min=0, max=1) floor(p*(max-min+1))+min >qunifdisc(0.2222222,2,19) >qunifdisc(0.2) runifdisc<-function(n, min=0, max=1) sample(min:max, n, replace=T) >runifdisc(30,2,19) >runifdisc(30) 6/26/2018 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.

Binomial distribution 6/26/2018 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.

Poisson distribution 6/26/2018 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ.