TexPoint fonts used in EMF.

Slides:



Advertisements
Similar presentations
Engineering Statistics ECIV 2305 Chapter 2 Random Variables.
Advertisements

CDA6530: Performance Models of Computers and Networks Chapter 5: Generating Random Number and Random Variables TexPoint fonts used in EMF. Read the TexPoint.
Continuous Random Variable (1). Discrete Random Variables Probability Mass Function (PMF)
Probability Densities
Review.
G. Cowan Lectures on Statistical Data Analysis Lecture 2 page 1 Statistical Data Analysis: Lecture 2 1Probability, Bayes’ theorem 2Random variables and.
Today Today: Chapter 5 Reading: –Chapter 5 (not 5.12) –Suggested problems: 5.1, 5.2, 5.3, 5.15, 5.25, 5.33, 5.38, 5.47, 5.53, 5.62.
Simulating Normal Random Variables Simulation can provide a great deal of information about the behavior of a random variable.
LECTURE UNIT 4.3 Normal Random Variables and Normal Probability Distributions.
Probability Distributions 2014/04/07 Maiko Narahara
CDA6530: Performance Models of Computers and Networks Examples of Stochastic Process, Markov Chain, M/M/* Queue TexPoint fonts used in EMF. Read the TexPoint.
CDA6530: Performance Models of Computers and Networks Chapter 2: Review of Practical Random Variables TexPoint fonts used in EMF. Read the TexPoint manual.
K. Shum Lecture 16 Description of random variables: pdf, cdf. Expectation. Variance.
Probability & Statistics I IE 254 Summer 1999 Chapter 4  Continuous Random Variables  What is the difference between a discrete & a continuous R.V.?
CDA6530: Performance Models of Computers and Networks Chapter 8: Discrete Event Simulation Example --- Three callers problem in homwork 2 TexPoint fonts.
One Random Variable Random Process.
CDA6530: Performance Models of Computers and Networks Chapter 7: Basic Queuing Networks TexPoint fonts used in EMF. Read the TexPoint manual before you.
PATTERN RECOGNITION LAB 3 TA : Nouf Al-Harbi::
 Random variables can be classified as either discrete or continuous.  Example: ◦ Discrete: mostly counts ◦ Continuous: time, distance, etc.
CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation --- Discrete-Time Simulation TexPoint fonts used in EMF. Read the.
§ 5.3 Normal Distributions: Finding Values. Probability and Normal Distributions If a random variable, x, is normally distributed, you can find the probability.
CDA6530: Performance Models of Computers and Networks Mid-Term Review TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Discrete Random Variables. Introduction In previous lectures we established a foundation of the probability theory; we applied the probability theory.
Chapter 5 CONTINUOUS RANDOM VARIABLES
Chapter 4 Continuous Random Variables and Probability Distributions
Continuous Random Variable (1) Section Continuous Random Variable What is the probability that X is equal to x?
STA347 - week 91 Random Vectors and Matrices A random vector is a vector whose elements are random variables. The collective behavior of a p x 1 random.
ELEC 303, Koushanfar, Fall’09 ELEC 303 – Random Signals Lecture 9 – Continuous Random Variables: Joint PDFs, Conditioning, Continuous Bayes Farinaz Koushanfar.
Cell#1 Program Instructions. Don’t run. Used to load a Statistical Package Cell #3 Defines standard normal pdf and cdf functions Ignore spelling warning.
ELEC 303, Koushanfar, Fall’09 ELEC 303 – Random Signals Lecture 8 – Continuous Random Variables: PDF and CDFs Farinaz Koushanfar ECE Dept., Rice University.
Unit 4 Review. Starter Write the characteristics of the binomial setting. What is the difference between the binomial setting and the geometric setting?
PATTERN RECOGNITION LAB 2 TA : Nouf Al-Harbi::
Random Variables By: 1.
CDA6530: Performance Models of Computers and Networks Mid-Term Review TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Random number generation
Random Variable 2013.
Chapter 4 Continuous Random Variables and Probability Distributions
ECE 313 Probability with Engineering Applications Lecture 7
Chapter 4 Continuous Random Variables and Probability Distributions
Ch4.2 Cumulative Distribution Functions
Cumulative distribution functions and expected values
Intro to Sampling Methods
ETM 607 – Spreadsheet Simulations
Chapter 4 Continuous Random Variables and Probability Distributions
3.1 Expectation Expectation Example
CDA6530: Performance Models of Computers and Networks Project 3 Q&A
TexPoint fonts used in EMF.
TexPoint fonts used in EMF.
TexPoint fonts used in EMF.
x1 p(x1) x2 p(x2) x3 p(x3) POPULATION x p(x) ⋮ Total 1 “Density”
Advanced Artificial Intelligence
TexPoint fonts used in EMF.
TexPoint fonts used in EMF.
ASV Chapters 1 - Sample Spaces and Probabilities
POPULATION (of “units”)
EMIS 7300 SYSTEMS ANALYSIS METHODS FALL 2005
Normal Probability Distributions
Statistics Lecture 12.
CDA6530: Performance Models of Computers and Networks Project 3 Q&A
Cumulative Distribution Function
TexPoint fonts used in EMF.
Chapter 7 The Normal Distribution and Its Applications
Further Topics on Random Variables: Derived Distributions
Further Topics on Random Variables: Derived Distributions
Introduction to Probability: Solutions for Quizzes 4 and 5
TexPoint fonts used in EMF.
Further Topics on Random Variables: Derived Distributions
Generating Random Variates
Continuous Random Variables: Basics
Presentation transcript:

TexPoint fonts used in EMF. CDA6530: Performance Models of Computers and Networks Using Simulation for Statistical Analysis and Verification ---- supplement to Random Variable Generation Lecture TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAA

Objective We have learned how to generate random variables in simulation, but How can we use them? What is the purpose for such simulation?

Example: Generate discrete R.V. A loaded dice, r.v. X: number shown up P(X=1) = 0.05, P(X=2)= 0.1, P(X=3) =0.15, P(X=4) = 0.18, P(X=5) = 0.22, P(X=6) = 0.3 Q1: Simulate to generate 100 samples Code in Matlab

Draw CDF (cumulative distr. function) Remember F(x) = P(X· x) For our question, r.v. X has 6 different sample values, thus we could derive from simulation: F(1), F(2), F(3), F(4), F(5), F(6) F(6) = 1, so we need to derive the other five F(x) = m/n where n: # of sample values we generate m: # of sample r.v. values · x

The CDF curve for our example in one simulation run (compared with analytical results)

Draw PMF (Probability Mass Function) Pmf: P(X=1) = 0.05, P(X=2)= 0.1, P(X=3) =0.15, P(X=4) = 0.18, P(X=5) = 0.22, P(X=6) = 0.3 PMF(x) = m/n n: # of sample values we generate m: # of sample r.v. values = x

Matlab Code % lecture 15, statics-matlab.ppt , Page 3 % generate discrete r.v. sampleN = 1000; P = [0.05 0.1 0.15 0.18 0.22 0.3]; Xvalue = [1 2 3 4 5 6]; n =length(P); SumP = zeros(n, 1); for i=1:n, SumP(i) = sum(P(1:i)); end U = rand(sampleN,1); Sample = zeros(sampleN,1); for i=1:sampleN, for j=1:n, if U(i)< SumP(j), Sample(i) = Xvalue(j); break; % draw CDF, Page 5 F = zeros(n,1); for i = 1:n, for j=1:sampleN, if Sample(j)<= Xvalue(i), F(i) = F(i) + 1; F = F./sampleN; plot(F, '-ob'); xlabel('Random Variable X'); ylabel('Cumulative distr. function (CDF)'); hold on; plot(SumP, '--^r'); legend('Simulation', 'Analytical'); title('CDF'); % draw pmf, Page 6 PMF = zeros(n,1); for i=1:n, for j=1:sampleN, if Sample(j) == Xvalue(i), PMF(i)= PMF(i)+1; end PMF = PMF./sampleN; figure; plot(PMF, '-ob'); plot(P, '--^r'); title('Probability Mass Function');

Continuous R.V. Use inverse transform method: One value of U  one r.v. sample Normal distr. use the polar method to generate How to draw CDF? Problem: r.v. x could be any value Solve: determine xi points to draw with fixed interval (i=1,2,…) F(xi) = P(X· xi) = m/n n: # of samples generated m: # of sample values · xi

Continuous R.V. How to draw pdf (probability density function)? In Matlab, use histc() and bar() N = histc(Y, Edge) for vector Y, counts the number of values in Y that fall between the elements in the Edge vector (which must contain monotonically non-decreasing values). N is a length(Edge) vector containing these counts. Use bar(Edge,N, ‘histc’) to plot the curve The curve plot will have the same curve pattern as f(x), but not the same Y-axis values

Pdf example of continuous R.V. % exponential distribution pdf lambda = 2; sampleN = 1000; Sample = zeros(1, sampleN); U = rand(1, sampleN); for i=1:sampleN, Sample(i) = -log(1-U(i))/lambda; end Edge = 0:0.1:5; N = histc(Sample, Edge); bar(Edge, N, 'histc');

Analytical Results Use the formula of the distribution to directly calculate F(x_i) How to calculate integration in Matlab? Use function quad() Q = quad(@myfun,0,2); %where myfun.m is the M-file function: function y = myfun(x) y = 1./(x.^3-2*x-5);

Markov Chain Simulation Discrete-time Markov Chain Simulate N steps For each step, use random number U to determine which state to jump to Similar to discrete r.v. generation ¼(i) = mi/N N: # of simulated steps mi: number of steps when the system stays in state i.

Discrete-time Markov Chain Example 1 Markov on-off model (or 0-1 model) Q: the steady-state prob.?

Matlab Code alpha= 0.6; beta = 0.9; Pi_theory = [beta/(alpha+beta) alpha/(alpha+beta)]; sampleN= 100; stateNum = 2; % 2 states U = rand(sampleN,1); init_state = randi(2); %either 1 or 2 State=zeros(stateNum, 1); State(init_state) = 1; % count the initial state currentState = init_state; for i=1:sampleN, if currentState ==1, if U(i) > alpha, nextState = 1; else nextState = 2; end else % currentState = 2 if U(i) > beta, State(nextState) =State(nextState)+1; % count the current % state currentState = nextState; end Pi_simulation = State./sampleN; figure; plot(Pi_theory, 'r-^'); hold on; plot(Pi_simulation, 'k:o'); legend('theory', 'simulation');

Markov Chain Simulation Continuous-time Markov Chain Method #1: Determine how long current state lasts Generate exponential distr. r.v. X for the staying time Determine which state the system jumps to Similar to discrete-time Markov Chain jump simulation Method #2: Determine the jumping out time for each jump out link (everyone is expo. Distr.) The staying time is the shortest jumping out time The outgoing state corresponds to this shortest jumping out time Method #2 is more intuitive reasonable

¼(i) =  tk(i) /T T: overall simulated time tk(i): the time when the system is in state i for the k-th time