R_SimuSTAT_2 Prof. Ke-Sheng Cheng Dept. of Bioenvironmental Systems Eng. National Taiwan University
Outline – Density and CDF plots – Plot the empirical cumulative distribution function (ECDF) of a set of random numbers. – Simulation of discrete and continuous random variables – Correlation 1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 2
A random variable is associated with its probability density function (PDF) and cumulative distribution function (CDF). Each probability density function has one or more parameters which characterize the location and shape of the PDF. We can observe how changes in parameters can affect the shape of PDF and CDF by plotting the PDF and CDF of different parameter settings. Plotting of PDF and CDF can be done using the plot and lines functions in R. 1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 3
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 4
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 5
Suppose that a random variable X is defined on the sample space of a random experiment. The random experiment is conducted n times and yields a set of n random numbers, say {x 1, x 2, …, x n }. This set of random numbers is called a random sample of size n of the random variable. Although the random variable X is associated with a (theoretical) CDF, an empirical CDF (ECDF) of the random sample can be considered as a sample of the theoretical CDF and can constructed by 1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 6
– Sort the random sample {x 1, x 2, …, x n } in ascending order such that { y 1 =min(x 1, x 2, …, x n ), …, y n =max(x 1, x 2, …, x n ) } – Let – Construct the plot of y vs F n (y). The plot.ecdf function yields an ECDF plot. Alternatively, the ecdf function can also be used to establish an ECDF plot. 1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 7
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 8 plot.ecdf(x)
To be continued 1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 9
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 10
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 11
Correlation between detrended cumulative- sum series. 1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 12
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 13
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 14
1/31/2014 Laboratory for Remote Sensing Hydrology and Spatial Modeling, Dept of Bioenvironmental Systems Engineering, National Taiwan Univ. 15