Generating Random Numbers
|
|
- Osborne Baldwin
- 5 years ago
- Views:
Transcription
1 Generating Random Numbers Seungchul Baek Department of Mathematics and Statistics, UMBC STAT 633: Statistical Computing 1 / 67
2 Introduction Simulation is a very powerful tool for statisticians. It allows us to investigate the performance of statistical methods before delving deep into difficult theoretical work. At a more practical level, integrals themselves are important for statisticians: - p-values are nothing but integrals; - Bayesians need to evaluate integrals to produce posterior probabilities, point estimates, and model selection criteria. Therefore, there is a need to understand simulation techniques and how they can be used for integral approximations. 2 / 67
3 Built-in functions in R R has many built-in random number generators. For each distribution, R has the pdf/pmf, quantile function, cdf, and an independent random number generator. distribution generator parameters binomial rbinom size, prob geometric rgeom prob negative binomial rnbinom size, prob Poisson rpois lambda uniform runif min, max normal rnorm mean, sd gamma rgamma shape, rate, scale χ 2 rchisq df exponential rexp rate F rf df1, df2 t rt df beta rbeta shape1, shape2 3 / 67
4 Uniform random variable Generating uniform random numbers is the main block for all that follows. In R, we use the generator, runif(n,min=0,max=1). The random numbers generated are said to be pseudo random they satisfy certain statistical tests we would expect independent uniforms to pass. In other words, runif() provides a deterministic sequence based on a random starting point. set.seed() controls a starting point. If it is not specified, R sets the seed by the current system time. 4 / 67
5 R does produce uniform random numbers? In order to make sure R produces uniform random numbers, we take a look at a histogram and scatter plot for (X i, X i+1 ). n < x <- runif(n) x1 <- x[-n] x2 <- x[-1] par(mfrow=c(1,2)) hist(x) plot(x1,x2) 5 / 67
6 R does produce uniform random numbers? How does it look like? 6 / 67
7 Random numbers for an f (x) We would like to generate random numbers from the pdf How should we do? f (x) = 3x 2, 0 < x < 1. 7 / 67
8 The inverse transform Theorem: Probability Integral Transformation Let X have continuous cdf F X (x) and define the random variable U as U = F X (X ). Then U U(0, 1). Proof. 8 / 67
9 The inverse transform Algorithm: 1. Derive the inverse function F 1 X (u). 2. Generate a random u from U(0, 1), then calculate x = F 1 X (u). This algorithm is straightforward to apply if F 1 compute. X is easy to Example 1. The pdf f (x) = 3x 2. 0 < x < 1. We let U be F X (X ). F X (x) = F 1 X (u) = 9 / 67
10 Random numbers for an f (x) We compare the empirical distribution and theoretical distribution in Example 1. n < u <- runif(n) x <- u^(1/3) hist(x, freq = FALSE) x <- seq(0,1,0.01) lines(x, 3*x^2, col="red") 10 / 67
11 Random numbers for an f (x) 11 / 67
12 Example: Exponential distribution If a random variable has a exponential distribution X Expon(λ), it has the pdf, f (x) = λe λx, x > 0. We want to generate random numbers from this distribution. Solution: 12 / 67
13 Example: Exponential distribution w/ λ = 1 n < u <- runif(n) x <- -log(u) y <- rexp(n) par(mfrow=c(1,2)) hist(x,freq=false,main="inverse transform",breaks=100) z <- seq(0,10,0.01) lines(z, exp(-z), col="red") hist(y,freq=false,main="in-built function",breaks=100) lines(z, exp(-z), col="red") 13 / 67
14 Example: Exponential distribution w/ λ = 1 14 / 67
15 Example: Cauchy distribution The standard Cauchy distribution has pdf and cdf f (x) = 1 π(1 + x 2 ), F (x) = This distribution has shape similar to normal, but tails are much heavier Cauchy has no finite moments. But its cdf can be inverted: F 1 (u) = To generate X from standard Cauchy... Non-standard Cauchy (location µ and scale σ): Use rt(n,df=1) in R. 15 / 67
16 Practice: Pareto distribution The Pareto(η, θ) distribution has the cdf, ( η ) θ F (x) = 1, x η > 0, θ > 0, x where η is the scale parameter and θ is the shape parameter. To generate 1000 random numbers from Pareto(2, 3), use the inverse transform method. Graph the density histogram of the sample and superimpose the density Pareto(2, 3). The pdf of Pareto(η, θ) is f (x) = θηθ, x η. x θ+1 16 / 67
17 Example: Discrete uniform distribution Suppose we want X to be sampled uniformly from 1,..., N. Here is an example where the cdf is neither continuous nor strictly increasing. The idea is as follows: 1. Divide up the interval [0, 1] into N equal subintervals; i.e., [0, 1/N), [1/N, 2/N),..., [(N 1)/N, 1]. 2. Sample U U(0, 1). 3. If i/n < U (i + 1)/N, then X = i + 1. More simply, set X = NU + 1. This is equivalent to sample(n, size=1) in R. 17 / 67
18 The inverse transform: Discrete case For a discrete random variable, the cdf F X (x) is discontinuous at countable distinct values. Algorithm: 1. Generate a random u from U(0, 1). 2. Take x i, where F X (x i 1 ) < u F X (x i ) and x i supp(x ). Step 2 may be hard for some distributions. 18 / 67
19 Example: Bernoulli distribution Let s consider a random variable from Bernoulli trial with the probability of success p. We know that F X (0) = 1 p and F X (1) = 1, and then we generate random numbers 1. Generate a random number from U(0, 1). 2. Take 1 if 1 p < u 1, otherwise take 0. Example 3. X Bernoulli(0.2). > n < > p <- 0.2 > u <- runif(n) > x <- as.integer(u>1-p) # if u>1-p is true, it returns 1. 0, o. > mean(x) [1] > var(x) [1] / 67
20 Example: Geometric distribution Suppose X has a geometric distribution X Geom(p). The pmf is f (x) = (1 p) x p, x = 0, 1, 2,.... In order to generate random numbers, we follow 1. Derive the cdf F X (x) =, where q = 1 p. 2. Generate a random number u from U(0, 1). 3. Solve F X (x i 1 ) < u F X (x i ) < u The last inequality simplifies to x < log(1 u)/logq x + 1. The solution is x + 1 = log(1 u)/logq, where x is the ceiling function. 20 / 67
21 Example: Geometric distribution X Geom(0.4), then we generate 1000 random numbers. > n < > p <- 0.4 > u <- runif(n) > x <- ceiling(log(u)/log(1-p))-1 # U and 1-U have same distribu > mean(x) [1] > var(x) [1] / 67
22 Example: Binomial distribution We want to generate random numbers from B(10, 0.25). F X (0) = 0.056, F X (1) = 0.244, F X (10) = 1, which can be calculated in R using pbinom(0:10,10,0.25). Generate random number from U(0, 1), and take x i, where F X (x i 1 ) < u F X (x i ).. 22 / 67
23 Example: Poisson distribution We want to generate random numbers from Poisson(λ = 50). Note that there is no explicit formula for x such that F X (x 1) < u F X (x). We expect that most of observations should be in λ ± 3 λ, which is (28.7, 71.2) for λ = 50. Note that P(X > 71) = and P(X < 28) = , which may be ignorable. For any generated random number u, we should test at least a certain amount. In this example, P(X 80) = , hence we test 80 times! Is it efficient? A way to handle this is to ignore what is outside of a highly likely interval. 23 / 67
24 Example: Poisson distribution Let s remove the outside of λ ± 3 λ. n < lam <- 50 dist <- 3*sqrt(lam) # adjustable trun <- round(seq(lam-dist,lam+dist,1)) cdfp <- ppois(trun,lam) pois.rand <- NULL for ( i in 1:n){ u <- runif(1) pois.rand[i] <- trun[1] + sum(cdfp<u) } > mean(pois.rand) [1] > var(pois.rand) [1] / 67
25 Practice: Revisit Binomial Example We want to generate random numbers from B(10, 0.25). F X (0) = 0.056, F X (1) = 0.244, F X (10) = 1, which can be calculated in R using pbinom(0:10,10,0.25). Generate random number from U(0, 1), and take x i, where F X (x i 1 ) < u F X (x i ). Write an R code to implement it. Generate 1000 random numbers and find the mean and variance.. 25 / 67
26 Transformation methods Many types of transformation methods are available. Z N(0, 1), then Y = X 2 χ 2 1. U χ 2 m and V χ 2 n are independent, F = (U/m)/(V /n) F m,n. U Gamma(r, β) and V Gamma(s, β) are independent, Y = U/(U + V ) Beta(r, s). U U(0, 1) and V U(0, 1) are independent, Z 1 = 2logU cos(2πv ), Z 2 = 2logV sin(2πu) are independent standard normal random variables. This is called the Box-Muller algorithm. 26 / 67
27 Example: Beta distribution We want to generate 1000 random numbers from Beta(2, 2). The Beta(2, 2) density is f (x) = 6x(1 x), where x (0, 1). 1. Generate a random number u from Gamma(2, 1). 2. Generate a random number v from Gamma(2, 1). 3. Take x = u/(u + v) * The shape parameter β can be any number, only if it is same for U and V and β > / 67
28 Example: Beta distribution #ex. Beta distribution n < a <- 2 b <- 2 u <- rgamma(n,a,1) v <- rgamma(n,b,1) x <- u/(u+v) par(mfrow=c(1,2)) hist(x,breaks=25,prob=t) y <- seq(0,1,0.01) lines(y,6*y*(1-y),col= red ) # QQ plot - to compare sample data to theoretical values quan <- qbeta(y,2,2) qqplot(quan,x) abline(0,1,col="red") 28 / 67
29 Example: Beta distribution 29 / 67
30 Example: χ 2 distribution The χ 2 random variable X (with n degrees of freedom) is defined as follows: Z 1,..., Z n N (0, 1), which are iid. Take X = Z Z 2 n. Therefore, to sample X χ 2 n take the sum of squares of n independent standard normal random variables. Independent normals can be sampled using Box-Muller. 30 / 67
31 Example: t distribution A t random variable X (with ν degrees of freedom) is defined as the ratio of a standard normal and the square root of an independent (normalized) χ 2 random variable. More formally, let Z N (0, 1) and Y χ 2 (ν), then X = Z Y /ν is a t ν random variable. In R, use rt(n,df=nu). 31 / 67
32 Fundamental theorem of simulation If f is the density of interest, on an arbitrary space, we can write f (x) = f (x) 0 Hence, f appears as the marginal density of the joint distribution, (X, U) Unif {(x, u) : 0 < u < f (x)}. du. Theorem: Fundamental Theorem of Simulation Simulating X f (x) is equivalent to simulating (X, U) Unif {(x, u) : 0 < u < f (x)}. proof. 32 / 67
33 Example Suppose that b a f (x)dx = 1, and that f is bounded by m. We can simulate (Y, U) U(0, m) by simulating Y U(a, b) and U Y = y U(0, m), and take the pair only if the further constraint 0 < u < f (y) is satisfied. This leads to the correct distribution of the accepted value of Y, because / 67
34 Example: Beta distribution Simulate from a Beta(2.7, 6.3) distribution. Start with uniforms in a box but keep only those that satisfy the constraint. Simulated 2000 uniforms, kept only 744 betas. 34 / 67
35 Accept-Reject method For many distributions, the inverse transformation method fails to generate the required random variables. Accept-Reject method requires us to know the functional form of the density f of interest (target density) up to multiplicative constant. We use a simpler density g (candidate or instrumental density). We impose constraints on g 1. f and g have compatible supports. 2. There is a constant M s.t. f (x)/g(x) M for all x. Algorithm: 1. Generate Y g, U U(0, 1). 2. Accept X = Y if U f (Y ) Mg(Y ). Otherwise, return to Step / 67
36 Accept-Reject method We now show that the cdf of the accepted random variable is the cdf of X. Proof. P(Y x U f (Y )/{Mg(Y )}) =... = P(X x). 36 / 67
37 Accept-Reject method Let s think more about this method. P(accept Y ) =? What is the total probability of acceptance for any iteration? What distribution does the number of iterations until acceptance follow? We expect that on average each sample value requires iterations. 37 / 67
38 Example: Accept-Reject method We want to generate 1000 random numbers from Beta(2, 2). The Beta(2, 2) density is f (x) = 6x(1 x), where x (0, 1). Take g(y) from U(0, 1). Is it okay? Find M s.t. f (y)/g(y) M. Take x = y if f (y) Mg(y) > u. How many iterations do we need for generating 1000 random numbers? 38 / 67
39 Example: Accept-Reject method #ex. AR n < k <- 0 # accepted i <- 0 # iterations x <- NULL while(k<n){ u <- runif(1) i <- i+1 y <- runif(1) if (6*y*(1-y)/1.5 > u){ k <- k+1 x[k] <- y } } > i [1] 1512 How about setting M = 6? Is it also okay? 39 / 67
40 Properties of Accept-Reject method The bound f Mg need NOT be tight. M should be as small as possible because the probability of acceptance is 1/M. The algorithm does not depend on the normalizing constant. The criticism of the Accept-Reject algorithm:. Importance sampling method can avoid this problem. 40 / 67
41 Adaptive Rejection Sampling (ARS) on the board. 41 / 67
42 Multivariate normal distribution A p-dimensional random vector x has a multivariate normal distribution N (µ, Σ) if x has the density f (x) = 1 (2π) p/2 Σ 1/2 exp{ 0.5(x µ)t Σ 1 (x Σ)}, where Σ is a p p positive definite matrix with entries σ ij = cov(x i, X j ). We generate multivariate normal random vectors 1. Generate standard normal random vector Z N (0, I p ). 2. Transform Z in order to obtain a desired random vector. 42 / 67
43 Multivariate normal distribution Suppose X N (µ, Σ) and Z N (0, I p ), then for any conformable constant matrix A and constant vector b, Y = AX + b N (Aµ + b, AΣA T ), Y = AZ + b N (b, AA T ). Using this property, if Σ is factorized into AA T, we can set Y = AZ + µ, then Y = AZ + µ N (, ). Can we decompose Σ into AA T? 43 / 67
44 Spectral decomposition A p p symmetric matrix Σ is decomposed as Σ = CΛC T, where Λ is the diagonal matrix with the eigenvalues of Σ along the diagonal and C is the matrix whose columns are the eigenvectors of Σ. As C is an orthogonal matrix, C T C = CC T = I p and C 1 = C T. In addition, when Σ is positive definite, we produce the square root matrix as Σ 1/2 = CΛ 1/2 C T, where Σ = Σ 1/2 Σ 1/2. Hence we can set A = Σ 1/2, so it results in AA T = Σ. 44 / 67
45 Example: Multivariate normal We want to generate 1000 random vectors from N (µ, Σ) µ = (1, 2) T, ( ) Σ = The eigen function in R returns eigenvalues and eigenvectors. 45 / 67
46 Example: Multivariate normal mu <- c(1,2) Sig <- matrix(c(1,0.8,0.8,1),2,2) mvn.spec <- function(n,mu,sig){ ei <- eigen(sig) Lam <- diag(ei$values) ei.mat <- ei$vectors A <- ei.mat %*% sqrt(lam) %*% t(ei.mat) x <- matrix(0,n,length(mu)) for (i in 1:n){ x[i,] <- A %*% rnorm(length(mu)) + mu } return(x) } x <- mvn.spec(1000,mu,sig) Run plot(x[,1],x[,2]);colmeans(x);cov(x). Does this sample seem multivariate normal random vectors? 46 / 67
47 Can we avoid using for loop in previous Example? We generated n random vectors by calculating x 1 = Az 1 + µ,..., x n = Az n + µ. In a compact way, it can be represented as z T 1 A µ 1... µ p z T 2 X n p = A µ 1... µ p z T n A µ 1... µ p n p = ZA + Jµ T, where Z = (z 1,..., z n ) T and J = (1,..., 1) T. n p 47 / 67
48 Example: Multivariate normal, alternative mu <- c(1,2) Sig <- matrix(c(1,0.8,0.8,1),2,2) mvn.spec2 <- function(n,mu,sig){ ei <- eigen(sig) Lam <- diag(ei$values) ei.mat <- ei$vectors A <- ei.mat %*% sqrt(lam) %*% t(ei.mat) x <- matrix(0,n,length(mu)) Z <- matrix(rnorm(n*length(mu)),n,length(mu)) x <- Z %*% A + rep(1,n)%*%t(mu) return(x) } y <- mvn.spec2(1000,mu,sig) 48 / 67
49 Cholesky factorization A real symmetric positive definite matrix Σ can be factorized as Σ = Q T Q, where Q is an upper triangular matrix. In R, chol function returns an upper triangular matrix Q such that Q T Q = Σ. We will generate 1000 random vectors using Cholesky decomposition. 49 / 67
50 Example: Multivariate normal mu <- c(1,2) Sig <- matrix(c(1,0.8,0.8,1),2,2) mvn.chol <- function(n,mu,sig){ Q <- chol(sig) x <- matrix(0,n,length(mu)) for (i in 1:n){ x[i,] <- t(q) %*% rnorm(length(mu)) + mu # Q must be transpo } return(x) } z <- mvn.chol(1000,mu,sig) colmeans(z) cov(z) 50 / 67
51 Singular Value Decomposition (SVD) Let A be an n p matrix of rank k. The singular value decomposition of a matrix A can be expressed as A = UDV T, where U is n k, D is k k, and V is p k. The diagonal elements of the nonsingular diagonal matrix D = diag(λ 1,..., λ k ) are the positive square roots of λ 2 1,..., λ2 k, which are the nonzero eigenvalues of A T A or of AA T. The values λ 1,..., λ k are called the singular values of A. The k columns of U are the normalized eigenvectors of AA T corresponding to the eigenvalues λ 2 1,..., λ2 k. The k columns of V are the normalized eigenvectors of A T A corresponding to the eigenvalues λ 2 1,..., λ2 k. UT U = V T V = I. 51 / 67
52 Singular Value Decomposition (SVD) As Σ is a symmetric positive definite matrix, the svd provides U = V = C such that Σ = CΛC T. We obtain square root matrix Σ 1/2 = UD 1/2 V T. Hence, svd is same as the spectral decomposition. Which one is better? Why? In R, svd function do the singular value decomposition. 52 / 67
53 Example: Multivariate normal mu <- c(1,2) Sig <- matrix(c(1,0.8,0.8,1),2,2) mvn.svd <- function(n,mu,sig){ s <- svd(sig) A <- s$u %*% diag(sqrt(s$d)) %*% t(s$v) x <- matrix(0,n,length(mu)) for (i in 1:n){ x[i,] <- A %*% rnorm(length(mu)) + mu } return(x) } w <- mvn.svd(1000,mu,sig) colmeans(w) cov(w) 53 / 67
54 Comparisons library(mvtnorm) n <- 100; p <- 50; iter <- 1000; mu <- rep(0,p); set.seed(10) system.time(for (i in 1:iter){ mvn.spec(n,mu,cov(matrix(rnorm(n*p),n,p)))})[3] set.seed(10) system.time(for (i in 1:iter){ mvn.chol(n,mu,cov(matrix(rnorm(n*p),n,p)))})[3] set.seed(10) system.time(for (i in 1:iter){ mvn.svd(n,mu,cov(matrix(rnorm(n*p),n,p)))})[3] set.seed(10) system.time(for (i in 1:iter){ rmvnorm(n,mu,cov(matrix(rnorm(n*p),n,p)))})[3] set.seed(10) system.time(for (i in 1:iter){ mvn.spec2(n,mu,cov(matrix(rnorm(n*p),n,p)))})[3] 54 / 67
55 Comparisons We compare methods generating multivariate normal vectors including built-in function in R, rmvnorm in mvtnorm package. method elapsed time Spectral d Cholesky d Singular value d built-in function Spectral d. (no loop) / 67
56 Finite mixture Given a finite set of probability density functions f 1 (x),..., f n (x) and weights w 1,..., w n such that w i 0 and i w i = 1, the mixture distribution can be represented by f (x) = n w i f i (x). i=1 It can be extended to n = for a countable infinite set. 56 / 67
57 Example: Finite mixture Suppose X 1 N (0, 1) and X 2 N (3, 1) are independent. Let s think of the following two problems: 1. We define Y = X 1 + X 2, and want to generate random numbers from the distribution of Y. 2. We define a 50% mixture, f (x) = 0.5f X1 (x) + 0.5f X2 (x). These distributions are same? How do we generate random numbers from 1 and 2? 57 / 67
58 Example: Finite mixture 1. We define Y = X 1 + X 2, and want to generate random numbers from the distribution of Y. In fact, Y has a distribution of. There are two ways to generate random numbers: 1.1 Generate Y. 1.2 Generate x 1. and x 2., then take y =.. 2. We define a 50% mixture, f (x) = 0.5f X1 (x) + 0.5f X2 (x). Generate U U(0, 1). If, take x N (0, 1). Otherwise, take x N (3, 1). 58 / 67
59 Example: Finite mixture n < x1 <- rnorm(n, 0, 1) x2 <- rnorm(n, 3, 1) y <- x1 + x2 #the convolution u <- runif(n) k <- as.integer(u > 0.5) x <- k*x1+(1-k)*x2 par(mfrow=c(1,2)) hist(y,freq=f,breaks=100) hist(x,freq=f,breaks=100) mean(y) var(y) > mean(y) [1] > var(y) [1] / 67
60 Example: Finite mixture 60 / 67
61 Example: Mixture of several distributions We define the mixture as f (x) = 5 w j f j (x), j=1 where X j Gamma(α = 2, β j = j) are independent and w j = j/15. To generate random number from this mixture, 1. Generate an integer from j {1,..., 5}, where P(j) = w j, j = 1,..., 5. (In R, we use sample function.) 2. Generate a random number from the corresponding Gamma(α, β j ). 61 / 67
62 Example: Mixture of several distributions # code 1 pt <- proc.time() n < j <- sample(1:5,size=n,replace=true,prob=(1:5)/15) x <- NULL for (i in 1:n){ x[i] <- rgamma(1,shape=2,scale=j[i]) } proc.time()-pt # code 2, A vectorized approach pt <- proc.time() n < j <- sample(1:5,size=n,replace=true,prob=(1:5)/15) y <- rgamma(n,shape=2,scale=j) proc.time()-pt 62 / 67
63 Practice: Mixture of several distributions This is also the mixture of five gamma distributions, i.e., f (x) = 5 w j f j (x), j=1 where X j Gamma(α = j + 1, β j ) are independent and β j = (1, 1.6, 2.2, 2.7, 3), w j = (0.1, 0.3, 0.4, 0.1, 0.1). Generate random numbers and provide sample mean and sample variance. 63 / 67
64 Continuous mixture In case that the set of component distributions is uncountable, the construction of such distributions has a similarity to that of mixture distributions, replacing the finite summations with integrals. Consider a probability density function f (x; a) for a random variable X, parameterized by a. That is, for each value of a in some set A, f (x; a) is a probability density function with respect to X. Given a probability density function w, the function f (x) = w(a)f (x; a)da, A is a probability density function for X, and A w(a)da = / 67
65 Poisson-Gamma mixture If X NB(r, p), then X has the mixture representation where β = (1 p)/p. X Y = y Poisson(y), Y Gamma(r, β), FYI... noting that E(X ) = E{(E(X Y )}, we have E(X ) = E{(E(X Y )} = E(Y ) = rβ = r 1 p p. 65 / 67
66 Example: Poisson-Gamma mixture Suppose X NB(7, 0.4). We generate random numbers from X and compare the results with those generated by Poisson-Gamma mixture. n < r <- 7 p <- 0.4 y <- rgamma(n,r,scale=(1-p)/p) x <- rpois(n,y) hist(x,prob=true,breaks=50) lines(1:50,dnbinom(1:50,r,p),lwd=2,col="red") > mean(x) [1] > var(x) [1] / 67
Stat 451 Lecture Notes Simulating Random Variables
Stat 451 Lecture Notes 05 12 Simulating Random Variables Ryan Martin UIC www.math.uic.edu/~rgmartin 1 Based on Chapter 6 in Givens & Hoeting, Chapter 22 in Lange, and Chapter 2 in Robert & Casella 2 Updated:
More informationChapter 3: Methods for Generating Random Variables
Chapter 3: Methods for Generating Random Variables Lecturer: Zhao Jianhua Department of Statistics Yunnan University of Finance and Economics Outline 3.1 Introduction Random Generators of Common Probability
More informationSimulating Random Variables
Simulating Random Variables Timothy Hanson Department of Statistics, University of South Carolina Stat 740: Statistical Computing 1 / 23 R has many built-in random number generators... Beta, gamma (also
More informationLecture 2: Repetition of probability theory and statistics
Algorithms for Uncertainty Quantification SS8, IN2345 Tobias Neckel Scientific Computing in Computer Science TUM Lecture 2: Repetition of probability theory and statistics Concept of Building Block: Prerequisites:
More informationProbability and Distributions
Probability and Distributions What is a statistical model? A statistical model is a set of assumptions by which the hypothetical population distribution of data is inferred. It is typically postulated
More informationTransformations of Standard Uniform Distributions
Transformations of Standard Uniform Distributions We have seen that the R function runif uses a random number generator to simulate a sample from the standard uniform distribution UNIF(0, 1). All of our
More informationMultivariate Distributions
IEOR E4602: Quantitative Risk Management Spring 2016 c 2016 by Martin Haugh Multivariate Distributions We will study multivariate distributions in these notes, focusing 1 in particular on multivariate
More informationRandom Variables and Their Distributions
Chapter 3 Random Variables and Their Distributions A random variable (r.v.) is a function that assigns one and only one numerical value to each simple event in an experiment. We will denote r.vs by capital
More informationStatistics for scientists and engineers
Statistics for scientists and engineers February 0, 006 Contents Introduction. Motivation - why study statistics?................................... Examples..................................................3
More information01 Probability Theory and Statistics Review
NAVARCH/EECS 568, ROB 530 - Winter 2018 01 Probability Theory and Statistics Review Maani Ghaffari January 08, 2018 Last Time: Bayes Filters Given: Stream of observations z 1:t and action data u 1:t Sensor/measurement
More information3. Probability and Statistics
FE661 - Statistical Methods for Financial Engineering 3. Probability and Statistics Jitkomut Songsiri definitions, probability measures conditional expectations correlation and covariance some important
More informationDistributions of Functions of Random Variables. 5.1 Functions of One Random Variable
Distributions of Functions of Random Variables 5.1 Functions of One Random Variable 5.2 Transformations of Two Random Variables 5.3 Several Random Variables 5.4 The Moment-Generating Function Technique
More informationt x 1 e t dt, and simplify the answer when possible (for example, when r is a positive even number). In particular, confirm that EX 4 = 3.
Mathematical Statistics: Homewor problems General guideline. While woring outside the classroom, use any help you want, including people, computer algebra systems, Internet, and solution manuals, but mae
More information[POLS 8500] Review of Linear Algebra, Probability and Information Theory
[POLS 8500] Review of Linear Algebra, Probability and Information Theory Professor Jason Anastasopoulos ljanastas@uga.edu January 12, 2017 For today... Basic linear algebra. Basic probability. Programming
More information2 Functions of random variables
2 Functions of random variables A basic statistical model for sample data is a collection of random variables X 1,..., X n. The data are summarised in terms of certain sample statistics, calculated as
More informationChapter 5. Chapter 5 sections
1 / 43 sections Discrete univariate distributions: 5.2 Bernoulli and Binomial distributions Just skim 5.3 Hypergeometric distributions 5.4 Poisson distributions Just skim 5.5 Negative Binomial distributions
More informationRandom Vectors and Multivariate Normal Distributions
Chapter 3 Random Vectors and Multivariate Normal Distributions 3.1 Random vectors Definition 3.1.1. Random vector. Random vectors are vectors of random 75 variables. For instance, X = X 1 X 2., where each
More informationIE 581 Introduction to Stochastic Simulation
1. List criteria for choosing the majorizing density r (x) when creating an acceptance/rejection random-variate generator for a specified density function f (x). 2. Suppose the rate function of a nonhomogeneous
More informationBIOS 2083 Linear Models Abdus S. Wahed. Chapter 2 84
Chapter 2 84 Chapter 3 Random Vectors and Multivariate Normal Distributions 3.1 Random vectors Definition 3.1.1. Random vector. Random vectors are vectors of random variables. For instance, X = X 1 X 2.
More information1 Review of Probability and Distributions
Random variables. A numerically valued function X of an outcome ω from a sample space Ω X : Ω R : ω X(ω) is called a random variable (r.v.), and usually determined by an experiment. We conventionally denote
More information2 Random Variable Generation
2 Random Variable Generation Most Monte Carlo computations require, as a starting point, a sequence of i.i.d. random variables with given marginal distribution. We describe here some of the basic methods
More informationGeneration from simple discrete distributions
S-38.3148 Simulation of data networks / Generation of random variables 1(18) Generation from simple discrete distributions Note! This is just a more clear and readable version of the same slide that was
More informationStat 5101 Notes: Brand Name Distributions
Stat 5101 Notes: Brand Name Distributions Charles J. Geyer September 5, 2012 Contents 1 Discrete Uniform Distribution 2 2 General Discrete Uniform Distribution 2 3 Uniform Distribution 3 4 General Uniform
More informationChapter 6 Expectation and Conditional Expectation. Lectures Definition 6.1. Two random variables defined on a probability space are said to be
Chapter 6 Expectation and Conditional Expectation Lectures 24-30 In this chapter, we introduce expected value or the mean of a random variable. First we define expectation for discrete random variables
More information3 Continuous Random Variables
Jinguo Lian Math437 Notes January 15, 016 3 Continuous Random Variables Remember that discrete random variables can take only a countable number of possible values. On the other hand, a continuous random
More information5. Random Vectors. probabilities. characteristic function. cross correlation, cross covariance. Gaussian random vectors. functions of random vectors
EE401 (Semester 1) 5. Random Vectors Jitkomut Songsiri probabilities characteristic function cross correlation, cross covariance Gaussian random vectors functions of random vectors 5-1 Random vectors we
More informationPart IA Probability. Definitions. Based on lectures by R. Weber Notes taken by Dexter Chua. Lent 2015
Part IA Probability Definitions Based on lectures by R. Weber Notes taken by Dexter Chua Lent 2015 These notes are not endorsed by the lecturers, and I have modified them (often significantly) after lectures.
More informationCh3. Generating Random Variates with Non-Uniform Distributions
ST4231, Semester I, 2003-2004 Ch3. Generating Random Variates with Non-Uniform Distributions This chapter mainly focuses on methods for generating non-uniform random numbers based on the built-in standard
More informationSampling Distributions
Sampling Distributions In statistics, a random sample is a collection of independent and identically distributed (iid) random variables, and a sampling distribution is the distribution of a function of
More informationMA/ST 810 Mathematical-Statistical Modeling and Analysis of Complex Systems
MA/ST 810 Mathematical-Statistical Modeling and Analysis of Complex Systems Review of Basic Probability The fundamentals, random variables, probability distributions Probability mass/density functions
More informationFundamentals. CS 281A: Statistical Learning Theory. Yangqing Jia. August, Based on tutorial slides by Lester Mackey and Ariel Kleiner
Fundamentals CS 281A: Statistical Learning Theory Yangqing Jia Based on tutorial slides by Lester Mackey and Ariel Kleiner August, 2011 Outline 1 Probability 2 Statistics 3 Linear Algebra 4 Optimization
More informationProbability Distributions Columns (a) through (d)
Discrete Probability Distributions Columns (a) through (d) Probability Mass Distribution Description Notes Notation or Density Function --------------------(PMF or PDF)-------------------- (a) (b) (c)
More informationSTAT Chapter 5 Continuous Distributions
STAT 270 - Chapter 5 Continuous Distributions June 27, 2012 Shirin Golchi () STAT270 June 27, 2012 1 / 59 Continuous rv s Definition: X is a continuous rv if it takes values in an interval, i.e., range
More informationAlgorithms for Uncertainty Quantification
Algorithms for Uncertainty Quantification Tobias Neckel, Ionuț-Gabriel Farcaș Lehrstuhl Informatik V Summer Semester 2017 Lecture 2: Repetition of probability theory and statistics Example: coin flip Example
More information1.1 Review of Probability Theory
1.1 Review of Probability Theory Angela Peace Biomathemtics II MATH 5355 Spring 2017 Lecture notes follow: Allen, Linda JS. An introduction to stochastic processes with applications to biology. CRC Press,
More informationMAS223 Statistical Inference and Modelling Exercises
MAS223 Statistical Inference and Modelling Exercises The exercises are grouped into sections, corresponding to chapters of the lecture notes Within each section exercises are divided into warm-up questions,
More informationContinuous Random Variables. and Probability Distributions. Continuous Random Variables and Probability Distributions ( ) ( ) Chapter 4 4.
UCLA STAT 11 A Applied Probability & Statistics for Engineers Instructor: Ivo Dinov, Asst. Prof. In Statistics and Neurology Teaching Assistant: Christopher Barr University of California, Los Angeles,
More informationReview. DS GA 1002 Statistical and Mathematical Models. Carlos Fernandez-Granda
Review DS GA 1002 Statistical and Mathematical Models http://www.cims.nyu.edu/~cfgranda/pages/dsga1002_fall16 Carlos Fernandez-Granda Probability and statistics Probability: Framework for dealing with
More informationPart IB Statistics. Theorems with proof. Based on lectures by D. Spiegelhalter Notes taken by Dexter Chua. Lent 2015
Part IB Statistics Theorems with proof Based on lectures by D. Spiegelhalter Notes taken by Dexter Chua Lent 2015 These notes are not endorsed by the lecturers, and I have modified them (often significantly)
More informationMultivariate Distributions
Copyright Cosma Rohilla Shalizi; do not distribute without permission updates at http://www.stat.cmu.edu/~cshalizi/adafaepov/ Appendix E Multivariate Distributions E.1 Review of Definitions Let s review
More informationSTAT2201. Analysis of Engineering & Scientific Data. Unit 3
STAT2201 Analysis of Engineering & Scientific Data Unit 3 Slava Vaisman The University of Queensland School of Mathematics and Physics What we learned in Unit 2 (1) We defined a sample space of a random
More informationProbability Theory and Statistics. Peter Jochumzen
Probability Theory and Statistics Peter Jochumzen April 18, 2016 Contents 1 Probability Theory And Statistics 3 1.1 Experiment, Outcome and Event................................ 3 1.2 Probability............................................
More informationChapter 5 continued. Chapter 5 sections
Chapter 5 sections Discrete univariate distributions: 5.2 Bernoulli and Binomial distributions Just skim 5.3 Hypergeometric distributions 5.4 Poisson distributions Just skim 5.5 Negative Binomial distributions
More informationPCMI Introduction to Random Matrix Theory Handout # REVIEW OF PROBABILITY THEORY. Chapter 1 - Events and Their Probabilities
PCMI 207 - Introduction to Random Matrix Theory Handout #2 06.27.207 REVIEW OF PROBABILITY THEORY Chapter - Events and Their Probabilities.. Events as Sets Definition (σ-field). A collection F of subsets
More informationLinear algebra for computational statistics
University of Seoul May 3, 2018 Vector and Matrix Notation Denote 2-dimensional data array (n p matrix) by X. Denote the element in the ith row and the jth column of X by x ij or (X) ij. Denote by X j
More informationGeneral Principles in Random Variates Generation
General Principles in Random Variates Generation E. Moulines and G. Fort Telecom ParisTech June 2015 Bibliography : Luc Devroye, Non-Uniform Random Variate Generator, Springer-Verlag (1986) available on
More informationLecture 1: August 28
36-705: Intermediate Statistics Fall 2017 Lecturer: Siva Balakrishnan Lecture 1: August 28 Our broad goal for the first few lectures is to try to understand the behaviour of sums of independent random
More informationSTAT 3610: Review of Probability Distributions
STAT 3610: Review of Probability Distributions Mark Carpenter Professor of Statistics Department of Mathematics and Statistics August 25, 2015 Support of a Random Variable Definition The support of a random
More informationBrief Review of Probability
Maura Department of Economics and Finance Università Tor Vergata Outline 1 Distribution Functions Quantiles and Modes of a Distribution 2 Example 3 Example 4 Distributions Outline Distribution Functions
More informationA Few Special Distributions and Their Properties
A Few Special Distributions and Their Properties Econ 690 Purdue University Justin L. Tobias (Purdue) Distributional Catalog 1 / 20 Special Distributions and Their Associated Properties 1 Uniform Distribution
More informationGenerating pseudo- random numbers
Generating pseudo- random numbers What are pseudo-random numbers? Numbers exhibiting statistical randomness while being generated by a deterministic process. Easier to generate than true random numbers?
More informationReview (Probability & Linear Algebra)
Review (Probability & Linear Algebra) CE-725 : Statistical Pattern Recognition Sharif University of Technology Spring 2013 M. Soleymani Outline Axioms of probability theory Conditional probability, Joint
More informationS6880 #7. Generate Non-uniform Random Number #1
S6880 #7 Generate Non-uniform Random Number #1 Outline 1 Inversion Method Inversion Method Examples Application to Discrete Distributions Using Inversion Method 2 Composition Method Composition Method
More informationChapter 2. Discrete Distributions
Chapter. Discrete Distributions Objectives ˆ Basic Concepts & Epectations ˆ Binomial, Poisson, Geometric, Negative Binomial, and Hypergeometric Distributions ˆ Introduction to the Maimum Likelihood Estimation
More informationSection 8.1. Vector Notation
Section 8.1 Vector Notation Definition 8.1 Random Vector A random vector is a column vector X = [ X 1 ]. X n Each Xi is a random variable. Definition 8.2 Vector Sample Value A sample value of a random
More informationContinuous Random Variables. and Probability Distributions. Continuous Random Variables and Probability Distributions ( ) ( )
UCLA STAT 35 Applied Computational and Interactive Probability Instructor: Ivo Dinov, Asst. Prof. In Statistics and Neurology Teaching Assistant: Chris Barr Continuous Random Variables and Probability
More informationSTAT:5100 (22S:193) Statistical Inference I
STAT:5100 (22S:193) Statistical Inference I Week 10 Luke Tierney University of Iowa Fall 2015 Luke Tierney (U Iowa) STAT:5100 (22S:193) Statistical Inference I Fall 2015 1 Monday, October 26, 2015 Recap
More informationPerhaps the simplest way of modeling two (discrete) random variables is by means of a joint PMF, defined as follows.
Chapter 5 Two Random Variables In a practical engineering problem, there is almost always causal relationship between different events. Some relationships are determined by physical laws, e.g., voltage
More informationx. Figure 1: Examples of univariate Gaussian pdfs N (x; µ, σ 2 ).
.8.6 µ =, σ = 1 µ = 1, σ = 1 / µ =, σ =.. 3 1 1 3 x Figure 1: Examples of univariate Gaussian pdfs N (x; µ, σ ). The Gaussian distribution Probably the most-important distribution in all of statistics
More informationWe introduce methods that are useful in:
Instructor: Shengyu Zhang Content Derived Distributions Covariance and Correlation Conditional Expectation and Variance Revisited Transforms Sum of a Random Number of Independent Random Variables more
More informationMath Stochastic Processes & Simulation. Davar Khoshnevisan University of Utah
Math 5040 1 Stochastic Processes & Simulation Davar Khoshnevisan University of Utah Module 1 Generation of Discrete Random Variables Just about every programming language and environment has a randomnumber
More informationChapter 4. Multivariate Distributions. Obviously, the marginal distributions may be obtained easily from the joint distribution:
4.1 Bivariate Distributions. Chapter 4. Multivariate Distributions For a pair r.v.s (X,Y ), the Joint CDF is defined as F X,Y (x, y ) = P (X x,y y ). Obviously, the marginal distributions may be obtained
More informationContinuous random variables
Continuous random variables Continuous r.v. s take an uncountably infinite number of possible values. Examples: Heights of people Weights of apples Diameters of bolts Life lengths of light-bulbs We cannot
More informationStat 5101 Notes: Brand Name Distributions
Stat 5101 Notes: Brand Name Distributions Charles J. Geyer February 14, 2003 1 Discrete Uniform Distribution DiscreteUniform(n). Discrete. Rationale Equally likely outcomes. The interval 1, 2,..., n of
More informationProbability Theory. Patrick Lam
Probability Theory Patrick Lam Outline Probability Random Variables Simulation Important Distributions Discrete Distributions Continuous Distributions Most Basic Definition of Probability: number of successes
More information18.440: Lecture 28 Lectures Review
18.440: Lecture 28 Lectures 18-27 Review Scott Sheffield MIT Outline Outline It s the coins, stupid Much of what we have done in this course can be motivated by the i.i.d. sequence X i where each X i is
More informationNonlife Actuarial Models. Chapter 14 Basic Monte Carlo Methods
Nonlife Actuarial Models Chapter 14 Basic Monte Carlo Methods Learning Objectives 1. Generation of uniform random numbers, mixed congruential method 2. Low discrepancy sequence 3. Inversion transformation
More information1 Probability Distributions
1 Probability Distributions A probability distribution describes how the values of a random variable are distributed. For example, the collection of all possible outcomes of a sequence of coin tossing
More information5 Introduction to the Theory of Order Statistics and Rank Statistics
5 Introduction to the Theory of Order Statistics and Rank Statistics This section will contain a summary of important definitions and theorems that will be useful for understanding the theory of order
More informationGenerating Random Variates 2 (Chapter 8, Law)
B. Maddah ENMG 6 Simulation /5/08 Generating Random Variates (Chapter 8, Law) Generating random variates from U(a, b) Recall that a random X which is uniformly distributed on interval [a, b], X ~ U(a,
More information2. Variance and Covariance: We will now derive some classic properties of variance and covariance. Assume real-valued random variables X and Y.
CS450 Final Review Problems Fall 08 Solutions or worked answers provided Problems -6 are based on the midterm review Identical problems are marked recap] Please consult previous recitations and textbook
More information5.1 Consistency of least squares estimates. We begin with a few consistency results that stand on their own and do not depend on normality.
88 Chapter 5 Distribution Theory In this chapter, we summarize the distributions related to the normal distribution that occur in linear models. Before turning to this general problem that assumes normal
More informationMoment Generating Function. STAT/MTHE 353: 5 Moment Generating Functions and Multivariate Normal Distribution
Moment Generating Function STAT/MTHE 353: 5 Moment Generating Functions and Multivariate Normal Distribution T. Linder Queen s University Winter 07 Definition Let X (X,...,X n ) T be a random vector and
More informationAdvanced topics from statistics
Advanced topics from statistics Anders Ringgaard Kristensen Advanced Herd Management Slide 1 Outline Covariance and correlation Random vectors and multivariate distributions The multinomial distribution
More information1 Introduction. P (n = 1 red ball drawn) =
Introduction Exercises and outline solutions. Y has a pack of 4 cards (Ace and Queen of clubs, Ace and Queen of Hearts) from which he deals a random of selection 2 to player X. What is the probability
More informationLecture 11. Probability Theory: an Overveiw
Math 408 - Mathematical Statistics Lecture 11. Probability Theory: an Overveiw February 11, 2013 Konstantin Zuev (USC) Math 408, Lecture 11 February 11, 2013 1 / 24 The starting point in developing the
More informationThings to remember when learning probability distributions:
SPECIAL DISTRIBUTIONS Some distributions are special because they are useful They include: Poisson, exponential, Normal (Gaussian), Gamma, geometric, negative binomial, Binomial and hypergeometric distributions
More informationChapter 4 Multiple Random Variables
Review for the previous lecture Theorems and Examples: How to obtain the pmf (pdf) of U = g ( X Y 1 ) and V = g ( X Y) Chapter 4 Multiple Random Variables Chapter 43 Bivariate Transformations Continuous
More information2. Matrix Algebra and Random Vectors
2. Matrix Algebra and Random Vectors 2.1 Introduction Multivariate data can be conveniently display as array of numbers. In general, a rectangular array of numbers with, for instance, n rows and p columns
More informationSampling Distributions
In statistics, a random sample is a collection of independent and identically distributed (iid) random variables, and a sampling distribution is the distribution of a function of random sample. For example,
More informationSTAT 675 Statistical Computing
STAT 675 Statistical Computing Solutions to Homework Exercises Chapter 3 Note that some outputs may differ, depending on machine settings, generating seeds, random variate generation, etc. 3.1. Sample
More informationContents 1. Contents
Contents 1 Contents 6 Distributions of Functions of Random Variables 2 6.1 Transformation of Discrete r.v.s............. 3 6.2 Method of Distribution Functions............. 6 6.3 Method of Transformations................
More informationSlides 5: Random Number Extensions
Slides 5: Random Number Extensions We previously considered a few examples of simulating real processes. In order to mimic real randomness of events such as arrival times we considered the use of random
More informationStatistical Computing Session 4: Random Simulation
Statistical Computing Session 4: Random Simulation Paul Eilers & Dimitris Rizopoulos Department of Biostatistics, Erasmus University Medical Center p.eilers@erasmusmc.nl Masters Track Statistical Sciences,
More informationChapter 3. Chapter 3 sections
sections 3.1 Random Variables and Discrete Distributions 3.2 Continuous Distributions 3.4 Bivariate Distributions 3.5 Marginal Distributions 3.6 Conditional Distributions 3.7 Multivariate Distributions
More informationThis exam is closed book and closed notes. (You will have access to a copy of the Table of Common Distributions given in the back of the text.
TEST #3 STA 5326 December 4, 214 Name: Please read the following directions. DO NOT TURN THE PAGE UNTIL INSTRUCTED TO DO SO Directions This exam is closed book and closed notes. (You will have access to
More informationThis does not cover everything on the final. Look at the posted practice problems for other topics.
Class 7: Review Problems for Final Exam 8.5 Spring 7 This does not cover everything on the final. Look at the posted practice problems for other topics. To save time in class: set up, but do not carry
More information1 Appendix A: Matrix Algebra
Appendix A: Matrix Algebra. Definitions Matrix A =[ ]=[A] Symmetric matrix: = for all and Diagonal matrix: 6=0if = but =0if 6= Scalar matrix: the diagonal matrix of = Identity matrix: the scalar matrix
More informationTwo hours. Statistical Tables to be provided THE UNIVERSITY OF MANCHESTER. 14 January :45 11:45
Two hours Statistical Tables to be provided THE UNIVERSITY OF MANCHESTER PROBABILITY 2 14 January 2015 09:45 11:45 Answer ALL four questions in Section A (40 marks in total) and TWO of the THREE questions
More informationGOV 2001/ 1002/ E-2001 Section 3 Theories of Inference
GOV 2001/ 1002/ E-2001 Section 3 Theories of Inference Solé Prillaman Harvard University February 11, 2015 1 / 48 LOGISTICS Reading Assignment- Unifying Political Methodology chs 2 and 4. Problem Set 3-
More informationStat 5101 Lecture Notes
Stat 5101 Lecture Notes Charles J. Geyer Copyright 1998, 1999, 2000, 2001 by Charles J. Geyer May 7, 2001 ii Stat 5101 (Geyer) Course Notes Contents 1 Random Variables and Change of Variables 1 1.1 Random
More informationRandom variables. DS GA 1002 Probability and Statistics for Data Science.
Random variables DS GA 1002 Probability and Statistics for Data Science http://www.cims.nyu.edu/~cfgranda/pages/dsga1002_fall17 Carlos Fernandez-Granda Motivation Random variables model numerical quantities
More information1 Probability theory. 2 Random variables and probability theory.
Probability theory Here we summarize some of the probability theory we need. If this is totally unfamiliar to you, you should look at one of the sources given in the readings. In essence, for the major
More informationECE 302 Division 2 Exam 2 Solutions, 11/4/2009.
NAME: ECE 32 Division 2 Exam 2 Solutions, /4/29. You will be required to show your student ID during the exam. This is a closed-book exam. A formula sheet is provided. No calculators are allowed. Total
More informationDefinition: A random variable X is a real valued function that maps a sample space S into the space of real numbers R. X : S R
Random Variables Definition: A random variable X is a real valued function that maps a sample space S into the space of real numbers R. X : S R As such, a random variable summarizes the outcome of an experiment
More informationSTAT 4385 Topic 01: Introduction & Review
STAT 4385 Topic 01: Introduction & Review Xiaogang Su, Ph.D. Department of Mathematical Science University of Texas at El Paso xsu@utep.edu Spring, 2016 Outline Welcome What is Regression Analysis? Basics
More informationUQ, Semester 1, 2017, Companion to STAT2201/CIVL2530 Exam Formulae and Tables
UQ, Semester 1, 2017, Companion to STAT2201/CIVL2530 Exam Formulae and Tables To be provided to students with STAT2201 or CIVIL-2530 (Probability and Statistics) Exam Main exam date: Tuesday, 20 June 1
More informationReview (probability, linear algebra) CE-717 : Machine Learning Sharif University of Technology
Review (probability, linear algebra) CE-717 : Machine Learning Sharif University of Technology M. Soleymani Fall 2012 Some slides have been adopted from Prof. H.R. Rabiee s and also Prof. R. Gutierrez-Osuna
More informationBayesian Statistics Part III: Building Bayes Theorem Part IV: Prior Specification
Bayesian Statistics Part III: Building Bayes Theorem Part IV: Prior Specification Michael Anderson, PhD Hélène Carabin, DVM, PhD Department of Biostatistics and Epidemiology The University of Oklahoma
More informationChapter 2 Continuous Distributions
Chapter Continuous Distributions Continuous random variables For a continuous random variable X the probability distribution is described by the probability density function f(x), which has the following
More information