1 / 14

CS 351/ IT 351 Modelling and Simulation Technologies

Random Variates Dr. Jim Holten. CS 351/ IT 351 Modelling and Simulation Technologies. Random Distributions. Basic Statistics Common Random Distributions Generating Custom Distributions Generating Random Variates (from custom distributions). Using Random Variates. x’ = x + v

greggv
Download Presentation

CS 351/ IT 351 Modelling and Simulation Technologies

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Random Variates Dr. Jim Holten CS 351/ IT 351 Modelling and SimulationTechnologies

  2. CS 351/ IT 351 Random Distributions • Basic Statistics • Common Random Distributions • Generating Custom Distributions • Generating Random Variates (from custom distributions)

  3. CS 351/ IT 351 Using Random Variates • x’ = x + v • Add random “noise” to the variable’s value • Called additive noise • Commonly used • x’’ = x* v • Multiply random “noise” times variable’s value • Called multiplicative noise • Not as common • Generating Custom Distributions • Generating Random Variates (from custom distributions)

  4. CS 351/ IT 351 Basic Statistics • min, max, count, sum (sum of squares aka sumsq can be useful too) • range = max – min • mean = Σxi / count • variance = Σ(xi– mean)2 / count • standard deviation -- σ = sqrt(variance)

  5. CS 351/ IT 351 Other Basic Statistics • mode • The center value when all samples are in order by value • kurtosis (aka skew) κ = Σ(x[i] – mean)3, i ϵ [0, n] • histogram – a bar chart of frequency of value occurrences (usually counts of values within evenly spaced intervals).

  6. CS 351/ IT 351 Histogram of a Set of Values • Find the min, max, and range of the values • Divide the range into k value intervals (i = 0, k - 1) (aka “buckets”), Ii =[vi, vi+1]. • Count the number of values in each interval hi = count for interval i vi ≤ v < vi+1→ hi = hi + 1 • Generally displayed as a bar chart. • The histogram bar chart defines a “shape” of value occurrence counts.

  7. CS 351/ IT 351 Common Random Distributions • The Probability Distribution Function (PDF) shape (aka Probability Density Function) defines a distribution which matches the shape of its histogram. • Common standard distributions: Uniform, Normal, Exponential, Poisson • It can define other distribution shapes as needed. • Integrate the PDF (from -∞ to X for each value of X) to get the Cumulative Distribution Function (CDF)

  8. CS 351/ IT 351 PDF from a Histogram • Start with the histogram. • Normalize the k counts to measured probabilities for each value interval’s counts: n = Σhj pi = hi/ n, for j ϵ [0, n-1] • This defines a probability distribution function (PDF), aka probability density function for the variable's values. • It’s shape can be compared to the common distributions for approximate matching.

  9. CS 351/ IT 351 CDF from the PDF • Create the piecewise linear PDF from the histogram counts. • Create a CDF via cj= Σpi, for all i ≤ j for each of the k bucket value intervals. • This gives a piecewise linear CDF over the range of values for the original data.

  10. CS 351/ IT 351 Random VariatesGeneration • Project (map) the random variates obtained from Uniform[0, 1.0) (the CDF vertical axis) to the original data values (the horizontal axis) via the CDF curve. • Use linear interpolation for “better” intermediate values.

  11. CS 351/ IT 351 Random Variates • Math packages include a random number generator. • It must be “seeded” once, then it will generate a different random number each time it is called. • If the same seed is used then the same sequence of “random” values will be retrieved.

  12. CS 351/ IT 351 Random Variates (via Java) • Random rand = new Random(long_seed_value) • seed the random number generator. • Do this ONCE for the entire random sequence. • value = rand.nextDouble() • retrieve one new random value • in the range [0.0, 1.0). • value = rand.nextGaussian() • retrieve one new random value • from Normal distribution, mean = 0.0, std_dev = 1.0

  13. CS 351/ IT 351 Seeding Random Variates • The same seed generates the same sequence of random variates for a given generator. • Often the current epoch time in seconds or milliseconds is used to get a “random seed” so each run uses a different sequence of random variates. • Using the seed again starts the sequence over.

  14. CS 351/ IT 351 Getting ANear Random Seed (Java) • Get the seed • import java.util.Date; • Date date = new Date(); • long ms_since_epoch = date.getTime(); • Seed the generator • Random rand = new Random(ms_since_epoch); • The actual sequence generated is now (somewhat) independent for each run because the time changes.

More Related