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

Slides:



Advertisements
Similar presentations
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.
Advertisements

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
R_SimuSTAT_2 Prof. Ke-Sheng Cheng Dept. of Bioenvironmental Systems Eng. National Taiwan University.
STATISTICS Random Variables and Distribution Functions
Generating Random Numbers
Hydrologic Statistics
 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.
Random-Variate Generation. Need for Random-Variates We, usually, model uncertainty and unpredictability with statistical distributions Thereby, in order.
Evaluating Hypotheses
Generating Continuous Random Variables some. Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating.
Random Number Generation
3-1 Introduction Experiment Random Random experiment.
Continuous Random Variables and Probability Distributions
Lehrstuhl für Informatik 2 Gabriella Kókai: Maschine Learning 1 Evaluating Hypotheses.
Properties of Random Numbers
Lecture II-2: Probability Review
Flood Frequency Analysis
Elec471 Embedded Computer Systems Chapter 4, Probability and Statistics By Prof. Tim Johnson, PE Wentworth Institute of Technology Boston, MA Theory and.
Random Number Generation Pseudo-random number Generating Discrete R.V. Generating Continuous R.V.
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.
Lecture 12 Statistical Inference (Estimation) Point and Interval estimation By Aziza Munir.
Theory of Probability Statistics for Business and Economics.
Statistical Decision Making. Almost all problems in statistics can be formulated as a problem of making a decision. That is given some data observed from.
Chapter 7 Random-Number Generation
CS433: Modeling and Simulation Dr. Anis Koubâa Al-Imam Mohammad bin Saud University 15 October 2010 Lecture 05: Statistical Analysis Tools.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
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.
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.
Sampling and estimation Petter Mostad
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.
Statistics Sampling Distributions and Point Estimation of Parameters Contents, figures, and exercises come from the textbook: Applied Statistics and Probability.
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.
Statistical Decision Making. Almost all problems in statistics can be formulated as a problem of making a decision. That is given some data observed from.
Generating Random Variates
STATISTICS HYPOTHESES TEST (I)
STATISTICS POINT ESTIMATION
STATISTICS Joint and Conditional Distributions
STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation
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
Stochastic Hydrology Random Field Simulation
Hydrologic Statistics
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.
Fundamental Graphics in R
STOCHASTIC HYDROLOGY Random Processes
Professor Ke-sheng Cheng
STATISTICS HYPOTHESES TEST (I)
STATISTICS Univariate Distributions
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 with the assessment of uncertainty in hydrological analysis, modeling and forecasting. 11/13/2015 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU 2

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. 11/13/2015 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU 3

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. 11/13/2015 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU 4 Model uncertainty Parameter uncertainty

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. Unintended consequences of government policy 11/13/2015 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU 5

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

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

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

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. 11/13/2015 Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU 9

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

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. 11/13/ 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). 11/13/ 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. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Let a sequence of numbers x n 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. 11/13/ 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 11/13/ 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. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

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. 11/13/ 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. 11/13/ 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., 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

cg(X) f(X)f(X) X 11/13/ 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. 11/13/ 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 the five commonly used distributions involves only the standard normal and the uniform deviates. 11/13/ 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. 11/13/ 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). 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

TEST AND VALIDATION In order to demonstrate the applicability of the FQFT approach, random numbers of normal, log-normal, extreme value type I (EV1), Pearson type III (PT3) and Log- Pearson type III (LPT3) distributions were generated and tested. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

For each type of distribution N random samples, each of size n, were generated and used in subsequent analysis. In this study the sample size n was set to vary from 50 to 500 at increment of 50 and number of random samples N was set to 1,000 and 10, /13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Three means were adopted to test the validity of the generated random numbers: – Graphical comparison of CDF and empirical CDF (ECDF) derived from generated data, – Properties of estimated parameters, and – Type-I-error of goodness-of-fit (GOF) test. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Graphical comparison of CDF and ECDF Figure 2 graphically illustrates the closeness of CDF and ECDF with regard to sample size of 50 and 500. Each ECDF in Figure 2 is based on one single random sample of size 50 or 500 and it may change when another random sample is used. It can be seen that even at sample size of 50 the ECDF is fairly close to CDF of the designated distribution. At sample size of 500, all ECDFs become almost indistinguishable from their corresponding CDFs. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Properties of parameter estimators From each of the N generated random samples, distribution parameters including mean, standard deviation and coefficient of skewness can be estimated. Furthermore, from a total of N random samples, the sample mean and standard deviation of the above estimated parameters were calculated, with respect to sample size n ranging from 50 to /13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Uncertainty in estimation of mean reduces as sample size increases. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Uncertainty in estimation of standard deviation reduces as sample size n increases. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Uncertainty in estimation of skewness coefficient reduces as sample size n increases. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

With 1,000 and 10,000 random samples (N=1000 or 10,000), sample means (the center line) of the estimated parameters (including mean, standard deviation and coefficient of skewness) are very close to the theoretical values designated for random number generation. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

It is also seen clearly that standard deviations of all parameter estimators decrease with increase of the sample size n, indicating the unbiasedness of the estimator and reduction of uncertainty in parameter estimation. Such characteristics of parameter estimators suggest the generated random samples are indeed from the desired distributions. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

Type-I-Error of goodness-of-fit test Each random sample of size n is generated from a theoretical distribution with designated parameters and GOF test can be applied to test whether the random sample is drawn from the theoretical distribution. The widely applied Chi-square GOF test is adopted in this study. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

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

The Central Limit Theorem 11/13/ 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. 11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering, NTU

11/13/ 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. 11/13/ 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 =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 1, return("undefined"), ceiling(p*k)) # quantile 11/13/2015 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 59

– Similar, yet more flexible, functions are defined as follows dunifdisc =min & x<=max & round(x)==x, 1/(max-min+1), 0) >dunifdisc(23,21,40) >dunifdisc(c(0,1)) punifdisc 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( ,2,19) >qunifdisc(0.2) runifdisc<-function(n, min=0, max=1) sample(min:max, n, replace=T) >runifdisc(30,2,19) >runifdisc(30) 11/13/2015 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 60

Binomial distribution 11/13/2015 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 61

Poisson distribution 11/13/2015 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 62