Presentation is loading. Please wait.

Presentation is loading. Please wait.

STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation

Similar presentations


Presentation on theme: "STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation"— Presentation transcript:

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

2 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

3 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

4 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

5 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

6 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

7 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

8 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

9 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

10 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

11 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

12 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

13 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

14 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

15 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

16 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

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

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

19 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

20 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

21 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

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

23 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

24 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

25 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

26 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

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

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

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

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

31 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

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

33 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

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

35 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.

36 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.

37 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( ,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.

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

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


Download ppt "STOCHASTIC HYDROLOGY Stochastic Simulation (I) Univariate simulation"

Similar presentations


Ads by Google