Stochastic Simulation APPM 7400

Stochastic Simulation APPM 7400

Stochastic Simulation APPM 7400 Lesson 1: Random Number Generators August 27, 2018 Lesson 1: Random Number Generators Stochastic Simulation August27,2018 1/29 Random Numbers What is a random number? Lesson 1: Random Number Generators Stochastic Simulation August27,2018 2/29 Random Numbers What is a random number? “You mean like... 5?” Lesson 1: Random Number Generators Stochastic Simulation August27,2018 2/29 Random Numbers What is a random number? “You mean like... 5?” Formal definition from probability: A random number is a number uniformly distributed between 0 and 1. Lesson 1: Random Number Generators Stochastic Simulation August27,2018 2/29 Random Numbers What is a random number? “You mean like... 5?” Formal definition from probability: A random number is a number uniformly distributed between 0 and 1. (It is a realization of a uniform(0,1) random variable.) Lesson 1: Random Number Generators Stochastic Simulation August27,2018 2/29 Random Numbers Here are some realizations: 0.8763857 0.2607807 0.7060687 0.0826960 Density 0.7569021 . 0 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Here are some realizations: 0.8763857 0.2607807 0.7060687 0.0826960 Density 0.7569021 . 0 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Here are some realizations: 0.8763857 0.2607807 0.7060687 0.0826960 Density 0.7569021 . 0 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Here are some realizations: 0.8763857 0.2607807 0.7060687 0.0826960 Density 0.7569021 . 0 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Here are some realizations: 0.8763857 An 0.2607807 artifact 0.7060687 of bin width. 0.0826960 Density 0.7569021 . 0 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Here are some realizations: 0.8763857 0.2607807 0.7060687 0.0826960 Density 0.7569021 . 0 2 4 6 8 10 0.0 0.2 0.4 0.6 0.8 1.0 (100,000 values) sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Here are some realizations: 0.8763857 0.2607807 0.7060687 0.0826960 Density 0.7569021 . 0.0 0.2 0.4 0.6 0.8 1.0 (100,000 values) 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 3/29 Random Numbers Rough “reverse” confidence bounds: Let p be the probability the uniforms we are simulating are between 0 and 0.1. Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 4/29 Random Numbers Rough “reverse” confidence bounds: Let p be the probability the uniforms we are simulating are between 0 and 0.1. We know that p = 0.1. Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 4/29 Random Numbers Rough “reverse” confidence bounds: Let p be the probability the uniforms we are simulating are between 0 and 0.1. We know that p = 0.1. A rough 95% confidence interval for p based on the normal Density approximation to the binomial (= CLT!) is pˆ(1 − pˆ) 0.0 0.2 0.4 0.6 0.8 1.0 pˆ ± 2 0.0 0.2 0.4 0.6 0.8 1.0 r n sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 4/29 Random Numbers Rough “reverse” confidence bounds: This comes from the fact that pˆ − p approx ∼ N(0, 1) p(1−p) q n Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 5/29 Random Numbers Rough “reverse” confidence bounds: This comes from the fact that pˆ − p approx ∼ N(0, 1) p(1−p) q n So pˆ − p Density P −2 < < 2 ≈ 0.95 p(1−p) q n 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 5/29 Random Numbers Rough “reverse” confidence bounds: This comes from the fact that pˆ − p approx ∼ N(0, 1) p(1−p) q n So pˆ − p Density P −2 < < 2 ≈ 0.95 p(1−p) q n Usually, we solve for p in the 0.0 0.2 0.4 0.6 0.8 1.0 middle– sometimes after making 0.0 0.2 0.4 0.6 0.8 1.0 the (lazy!) substitution ofp ˆ for sample each p under the square root. Lesson 1: Random Number Generators Stochastic Simulation August27,2018 5/29 Random Numbers Rough “reverse” confidence bounds: Now we are solving forp ˆ in the middle. (No lazy substitutions needed.) Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 6/29 Random Numbers Rough “reverse” confidence bounds: Now we are solving forp ˆ in the middle. (No lazy substitutions needed.) − − P p−2 p(1 p) <pˆ<p+2 p(1 p) < ≈0.95 q n q n Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 6/29 Random Numbers Rough “reverse” confidence bounds: Now we are solving forp ˆ in the middle. (No lazy substitutions needed.) − − P p−2 p(1 p) <pˆ<p+2 p(1 p) < ≈0.95 q n q n With p = 0.1 and n = 100, 000, Density this means thatp ˆ should (roughly and 95% of the time) be in (0.09810263, 0.10189740). 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 6/29 Random Numbers Rough “reverse” confidence bounds: Now we are solving forp ˆ in the middle. (No lazy substitutions needed.) − − P p−2 p(1 p) <pˆ<p+2 p(1 p) < ≈0.95 q n q n With p = 0.1 and n = 100, 000, Density this means thatp ˆ should (roughly and 95% of the time) be in (0.09810263, 0.10189740). Or that the height of the 0.0 0.2 0.4 0.6 0.8 1.0 rectangle should be in 0.0 0.2 0.4 0.6 0.8 1.0 sample (0.9810263, 1.018974) Lesson 1: Random Number Generators Stochastic Simulation August27,2018 6/29 Random Numbers Rough “reverse” confidence bounds: Same numbers work for all bins since each one is trying Now we are solving forp ˆ in the to capture p = 0.1. middle. (No lazy substitutions needed.) − − P p−2 p(1 p) <pˆ<p+2 p(1 p) < ≈0.95 q n q n With p = 0.1 and n = 100, 000, this means thatp ˆ should Density (roughly and 95% of the time) be in (0.09810263, 0.10189740). Or that the height of the rectangle should be in 0.0 0.2 0.4 0.6 0.8 1.0 (0.9810263, 1.018974) 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 6/29 Random Numbers Rough “reverse” confidence bounds: Same numbers work for all bins since each one is trying to capture p = 0.1. based on CLT approximation and didn’t make any effort to use Density simultaneous confidence intervals– the heights of the bars are dependent on each other 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 7/29 Random Numbers Rough “reverse” confidence bounds: Note that even if everything were perfect, each bar is supposed to fall within (0.9810263, 1.018974) for only 95% of samples. Density 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 sample Lesson 1: Random Number Generators Stochastic Simulation August27,2018 8/29 Random Numbers Rough “reverse” confidence bounds: Note that even if everything were perfect, each bar is supposed to fall within (0.9810263, 1.018974) for only 95% of samples. Even if the first bar (for example) falls within those Density bounds 95% of the time (repeated samples/histograms), be wary of “systematic” behavior.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    70 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us