Show Menu
Cheatography

OMSA Midterm Exam 2 Cheat Sheet (DRAFT) by

Test fdfdfdf dfdfffd

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Given CDF with two cases, generate X

Arena Templates

Arena Variables and Function

DISC(0.3, 1, 0.8, 2, 1.0, 3)
DISC generates random discrete values based on cumulative probab­ili­ties; pair each probab­ility with its corres­ponding value.
TNOW
Current simulated time
NR(Res)
Res Servers currently in service
NQ(Queue)
Number of customers in Queue
Mod.Nu­mberOut
Customers who have left the mode

Arena Set Types

Resource, Counter, entity type, entity picture

Arena Key Modules

Assign
Give new value to an attribute
Decide
Route customers probab­ili­sti­cally or condit­onally
Separate / Clone
Split one customer into two or more clones
Route
Move entities station to station (advanced transfer)
Enter / Leave
Usually paired together for station management
Seize - Delay - Release
equals single Process module
Queue block
Cannot connect with a process module

Example of finding X for Pois

Universal truths

−ln(U)
∼Expon­ent­ial(1)
 
lnu

messy cdf

See F(X)
Replace with Unifor­m(0,1)
Multiply by 3
U(0,3)
Subtract 1
U(−1,2)
Mean
(-1+2)/2 = 1/2
What is the mean of the random variable 3F(X)−1?

Inverse Transf­orm­ation

Given U, find Z
invNorm(U, 0, 1)
Given Z, find U
normCd­f(-­9999, Z, 0, 1)
Expone­nti­al(λ)
X = -ln(1-U)/λ
Unifor­m(a,b)
X = a + (b-a)·U
Weibul­l(a,b)
X = a * (-ln(U))1/b
Triangular
If U<0.5: √(2U); If U≥0.5: 2-√(2(­1-U))
Bernou­lli(p)
If U < 1-p → 0; Else → 1
Poisson(λ)
Build CDF, match U
Discrete Unif(1,n)
[n·U]
Erlang­(k,λ)
-(1/λ)­ln(∏Ui)
Geometric
ln(1-U­)/l­n(1-p)
For discrete: Find smallest x where F(x) ≥ U
For contin­uous: Use inverse CDF formulas
Box-Muller generates TWO Normal­(0,1) values from TWO Unifor­m(0,1) values

XOR

XOR
is only true if different
 

Expected Value, Variance, ...

Discrete E[X]
SUM[x * f(x)]
Continous E[X]
SUM[x * f(x) dx]
Variance of X
E[X2] - (E[X])2
Standard Deviation of X
SQRT[V­ar(X)]

Expected Value Joint pdf

Joint p.d.f.: f(x,y) = 2xy²; Domain: 0 < x < 1, 0 < y < 1
Find: E[2X-1]
E[2X - 1] = ∫₀¹ ∫₀¹ (2x - 1) · 2xy² dy dx

Random Number Generators

Bad generators
Midsquare number generator, Random number tables, von Neumann's mid-square method, Fibonacci generator, Additive congru­ential generator, RANDU
Good generators
Linear Congru­ential Generators (modern cycle length > 2191; Mersenne Twister (219937)
Randu
65539Xi mod(231)
Desert island
16807Xi mod(231-1) mod(21­474­83647)
Desert island technique
Z = [SUM(U­i)-n/2] / [SQRT(n * 1/12]

Inverse Transform Method Key Problems

If X ~ Normal­(0,1), what’s the distri­bution of Φ(X)?
Unif(0,1)
If U∼Unif­orm­(0,1) and Φ(x) is the CDF of the standard normal, what is the distri­bution of 2Φ −1 (U)+3?
Φ−1(U) turns a Unifor­m(0,1) into a Normal­(0,1). Multiply by 2 → scales the standard deviation by 2 = Normal­(0,4). Add 3 → shifts the mean to 3. = Normal­(3,4)
-3ℓn(U²V²) where U, V ~ i.i.d. Unif(0,1)
= -6ℓn(U) - 6ℓn(V) ~ Exp(1/6) + Exp(1/6) ~ Erlang­₂(1/6)

Joint Probab­ility Mass Function

E[XY]
Summe von x * y * f(xy)

Joint p.m.f.

Are indepe­ndent if
X and Y are indepe­ndent if and only if pX,Y​(x,y) = pX​(x) ⋅ pY​(y)
For example
P(X=1, Y=0) = P(Y=0) * P(X=1)
E[XY]
Example: (1)(0)­(0.2) + (1)(1)­(0.0.0) + ...
Cov(X,Y)
E[XY] - E[Y]E[X]
Variance X + Y
Var(X) + Var(Y) + 2Cov(X,Y)
Variance X - Y
Var(X) + Var(Y) - 2Cov(X,Y)
Theorem
Cov(X,Y) = 0 if X, Y indepe­dent. Converse not true.
Correl­ation
p = Cov(X,Y) / SQRT(V­ar(X) * Var(Y))

pdf, cdf

pdf -> cdf
integrate with x, 0 as limit
cdf F-1(U)
solve(­F(x)=U, x)
 

Complete Distri­bution Reference Table

Box Muller Method

Z1
√(-2·l­n(U₁)) · cos(2π·U₂)
Z2
√(-2·l­n(U₁)) · sin(2π·U₂)
Z1/Z2
cot(2π·U₂) ~Cauchy
Z2/Z1
tan(2π·U₂) ~Cauchy
Radian­-Modus einsch­alten!

Chi-Square Distri­bution

If Z₁, Z₂, Z₃ are i.i.d. Nor(0,1), find c such that P(Z₁² + Z₂² + Z₃² < c) = 0.99

Calcul­ator: chiSqI­nv(­0.99, 3) → 11.34

X₁, X₂, X₃, X₄ are i.i.d. Nor(0,1). Find Pr(X₁ + X₂ - X₃ - X₄ > 10)

Calculator normCd­f(1­0,u­nen­dli­ch,­0,n/2)

Find distri­bution of U1 and U2

Find distri­bution of -4(U₁ + U₂) - 2
U₁ + U₂ ~ Tria(0, 1, 2)
Apply the transf­orm­ation -4(U₁ + U₂) = 4(Tria(0, 1, 2) )
The minimum becomes: -4(2) = -8; The mode becomes: -4(1) = -4; The maximum becomes: -4(0) = 0
4·Tria(0, 1, 2) = Tria(-8, -4, 0)
Subtract 2
Tria(-10, -6, -2)

Accept­anc­e-R­eje­ction

Goal
Generate random samples from a hard-t­o-s­ample distri­bution (f(x)).
Idea
Sample from an easier distri­bution (h(x)), then accept or reject each sample based on how well it fits f(x).
Example
If a random variable X has the beta distri­bution, then its p.d.f. is of the form f(x) = Γ(α+β) Γ(α)Γ(β) xα−1(1­−x)β−1, 0 <x<1, for parameters α and β >0, and where Γ(·) is the gamma function. How might you generate such a random variate? Pick the best answer.

Goodness of fit

Find critical value
Inverse X2; Area = 1-alpha; df = n-1; invx2(­0.9,3)
 
If critical value is bigger than accept H0

Hypothesis Testing Errors

Type I Error (False positive)
α = P(Reject H₀ | H₀ is true) , Fire alarm when no fire
Type II Error (False negative)
β = P(Fail to reject H₀ | H₀ is false); No fire alarm when there IS a fire