Random variables 1. Note  there is no chapter in the textbook that corresponds to this topic 2.

Slides:



Advertisements
Similar presentations
The Random Class.
Advertisements

1 Chapter Eight Designing Libraries. 2 Programming Complexity As long as we continue to solve problems of ever-increasing sophistication, the process.
Chapter 13 – Boot Strap Method. Boot Strapping It is a computer simulation to generate random numbers from a sample. In Excel, it can simulate 5000 different.
Sampling: Final and Initial Sample Size Determination
Monte Carlo Simulation of the Craps Dice Game Sencer Koç.
Mathematics in Today's World

Copyright © Cengage Learning. All rights reserved. 8.6 Probability.
PROBABILITY  A fair six-sided die is rolled. What is the probability that the result is even?
1 Probably About Probability p
Biostatistics Unit 4 - Probability.
Random Number Generators. Why do we need random variables? random components in simulation → need for a method which generates numbers that are random.
Probability and Probability Distributions
1 Random numbers Random  completely unpredictable. No way to determine in advance what value will be chosen from a set of equally probable elements. Impossible.
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Random numbers in Python Nobody knows what’s next...
Bell Work: Factor x – 6x – Answer: (x – 8)(x + 2)
Chapter 9 Introducing Probability - A bridge from Descriptive Statistics to Inferential Statistics.
Section 5.1 What is Probability? 5.1 / 1. Probability Probability is a numerical measurement of likelihood of an event. The probability of any event is.
1 9/8/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
Chapter 1 Probability and Distributions Math 6203 Fall 2009 Instructor: Ayona Chatterjee.
1 9/23/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
1 Theoretical Physics Experimental Physics Equipment, Observation Gambling: Cards, Dice Fast PCs Random- number generators Monte- Carlo methods Experimental.
Chapter 14 Monte Carlo Simulation Introduction Find several parameters Parameter follow the specific probability distribution Generate parameter.
Sullivan – Fundamentals of Statistics – 2 nd Edition – Chapter 11 Section 1 – Slide 1 of 34 Chapter 11 Section 1 Random Variables.
Chapter 12 – Probability and Statistics 12.7 – The Normal Distribution.
Quality Improvement PowerPoint presentation to accompany Besterfield, Quality Improvement, 9e PowerPoint presentation to accompany Besterfield, Quality.
© 2008 McGraw-Hill Higher Education The Statistical Imagination Chapter 6. Probability Theory and the Normal Probability Distribution.
Chapter 5.1 Probability Distributions.  A variable is defined as a characteristic or attribute that can assume different values.  Recall that a variable.
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
CIS 2033 based on Dekking et al. A Modern Introduction to Probability and Statistics Michael Baron. Probability and Statistics for Computer Scientists,
Worked examples and exercises are in the text STROUD PROGRAMME 28 PROBABILITY.
Introduction to Behavioral Statistics Probability, The Binomial Distribution and the Normal Curve.
1.3 Simulations and Experimental Probability (Textbook Section 4.1)
Chapter 12 – Probability and Statistics 12.4 – Multiplying Probabilities.
Lecture PowerPoint Slides Basic Practice of Statistics 7 th Edition.
Copyright © Cengage Learning. All rights reserved. 8.6 Probability.
MATH 2400 Ch. 10 Notes. So…the Normal Distribution. Know the 68%, 95%, 99.7% rule Calculate a z-score Be able to calculate Probabilities of… X < a(X is.
Simulation is the process of studying the behavior of a real system by using a model that replicates the system under different scenarios. A simulation.
Simulating Probabilistic Behaviour
Essential Statistics Chapter 91 Introducing Probability.
The Wonderful World… of Probability. When do we use Probability?
Discrete Distributions. Random Variable - A numerical variable whose value depends on the outcome of a chance experiment.
WOULD YOU PLAY THIS GAME? Roll a dice, and win $1000 dollars if you roll a 6.
Computer simulation Sep. 9, QUIZ 2 Determine whether the following experiments have discrete or continuous out comes A fair die is tossed and the.
Random numbers in C++ Nobody knows what’s next....
CHAPTER 5 Simulation Modeling. Introduction In many situations a modeler is unable to construct an analytic (symbolic) model adequately explaining the.
Probability Theory Modelling random phenomena. Permutations the number of ways that you can order n objects is: n! = n(n-1)(n-2)(n-3)…(3)(2)(1) Definition:
Introduction to Probability – Experimental Probability.
CSci 162 Lecture 7 Martin van Bommel. Random Numbers Until now, all programs have behaved deterministically - completely predictable and repeatable based.
Probability Distributions and Expected Value
Computer Science I: Understand how to evaluate expressions with DIV and MOD Random Numbers Reading random code Writing random code Odds/evens/…
Chapter 8: Probability: The Mathematics of Chance Probability Models and Rules 1 Probability Theory  The mathematical description of randomness.  Companies.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
Module 9.4 Random Numbers from Various Distributions -MC requires the use of unbiased random numbers.
Intro CS – Probability and Random Numbers Lesson Plan 6a.
Introduction to programming in java Lecture 16 Random.
Monte Carlo Methods Some example applications in C++
Random Numbers Until now, all programs have behaved deterministically - completely predictable and repeatable based on input values Some applications.
The Random Class and its Methods
Random numbers What does it mean for a number to be random?
CPSC 531: System Modeling and Simulation
Chapter 16.
Suppose you roll two dice, and let X be sum of the dice. Then X is
Lecture 2 – Monte Carlo method in finance
Review
Dry run Fix Random Numbers
Probability.
Discrete Distributions
Presentation transcript:

Random variables 1

Note  there is no chapter in the textbook that corresponds to this topic 2

Computing random numbers  the ability to quickly generate random numbers has many very useful applications  Monte Carlo methods  Monte Carlo simulations  statistical sampling  cryptography  games of chance  there are two broad classes of methods for generating random numbers on a computer  hardware random number generator  pseudo random number generator 3

Hardware random number generators  often called true random number generators  generate random numbers by measuring some sort of physical process that is statistically random  thermal noise is probably the most common source in commodity hardware  called true random number generators because the stream of random numbers is more or less impossible to predict or reproduce 4

Pseudo random numbers  often called deterministic random number generators  a computer algorithm that generates a sequence of numbers that is approximately random  the period of the sequence is very long  numbers are uniformly distributed  difficult to predict the next number in the sequence  called deterministic because if you know the seed value used to initialize the generator then you can reproduce the sequence of random numbers  this is useful for double checking your results 5

Uniformly distributed random numbers  in a discrete uniform distribution all numbers in the set of values occur with equal probability, e.g.,  fair coin: heads, tails  fair die: 1, 2, 3, 4, 5, 6  fairly shuffled deck of playing cards 6

MATLAB Uniform RNGs  MATLAB provides three uniform RNG functions  rand  floating-point random numbers strictly between 0 and 1  randi  integer random numbers from 1 to some user-specified value  randperm  random permutation of the integers from 1 to some user- specified value  try the functions to see what they do  draw a histogram for rand and randi 7

Simulating two dice function [total, v1, v2] = roll( ) %ROLL Rolls two six-sided dice % [TOTAL, V1, V2] = ROLL() simulates the rolling of two six-sided % dice. The sum of the two dice are returned in TOTAL, the value % of the first die is returned in V1, and the value of second % die is returned in V2. v1 = randi(6, [1 1]); v2 = randi(6, [1 1]); total = v1 + v2; end 8

Simulating two dice  what is the most likely total value?  roll the dice many times and draw a histogram of the result  what are the odds of rolling a total of 2? 3? 4? …  roll the dice many times and count the number of 2s, 3s, 4s, … 9

2D random walk  a 2D random walk is similar to a 1D random walk except it occurs in 2D  the walk begins at a point (usually the origin)  each step of the walk is randomly one step:  left,  right,  up, or  down 10

11 function [p, seq] = walk2(n) %WALK2 2d random walk % [P, SEQ] = WALK2(N) performs an N-step 2D random walk starting from % the origin. The final position of the walk is returned in P. % The sequence of positions along the walk are returned in SEQ. seq = zeros(2, n); for idx = 2:n direction = randi(4, [1 1]); if direction == 1 seq(:, idx) = seq(:, idx - 1) + [0; 1]; % up elseif direction == 2 seq(:, idx) = seq(:, idx - 1) + [0; -1]; % down elseif direction == 3 seq(:, idx) = seq(:, idx - 1) + [-1; 0]; % left else seq(:, idx) = seq(:, idx - 1) + [1; 0]; % right end p = seq(:, end); end

2D random walk  what is the most likely final position of the random walker?  run the random walk many times and histogram the results P = zeros(2, ); for idx = 1:10000 I = 100*(idx - 1) + 1; [p, P(:, I:(I+99))] = walk2(100); end hist3(P', {-20:20, -20:20}) 12

Additive Gaussian noise model  the most common simple noise model is the additive Gaussian noise model  measured value = true value + gaussian noise  the Gaussian distribution is another name for the normal distribution (bell curve)  if we want to simulate performing a measurement with additive Guassian noise then we need a way to draw a random number from a normal distribution 13

MATLAB normally distributed random numbers  MATLAB provides one RNG for one-dimensional normally distributed values  randn  floating-point random numbers drawn from the standard normal distribution (mean = 0, standard deviation = 1 )  if you want a standard deviation of s then multiply the result by s  try the function to see what it does  draw a histogram 14