Generating pseudo Normal Numbers : Ziggurat, Box Muller and R default rnorm method

Size: px
Start display at page:

Download "Generating pseudo Normal Numbers : Ziggurat, Box Muller and R default rnorm method"

Transcription

1 Generating pseudo Normal Numbers : Ziggurat, Box Muller and R default rnorm method 1 Introduction Mriganka Aulia ISI There is many methods for generating pseudo Normal Random Numbers. Here we focus on only three of these methods i) Ziggurat ii) Box Muller iii) R default rorm function The main idea of Ziggurat method was developed by George Marsaglia and others in 1960s. The aim of this method is to covering the whole density by some known density and draw a random point from the second one and declare it as a random point from the first if it obeys some criteria. And in 1980s Marsaglia and Tsang have developed the ziggurat method for sampling from decreasing densities by expressing the whole density as a mixture of small rectangles and draw a random uniform point from a randomly chosen rectangle. The Box Muller method was introduced by George Edward Pelham Box and Mervin Edgar Muller in But the method was first mentioned by Paley and Wiener in Box Muller transformation can transform two independent uniform number into two independent Normal number. And R default rnorm function is solely based on approximating the Normal cdf by some polynomial. This is done by Ross Ihaka in And this is based on two papers AS 111 (C) 1977 Royal Statistical Society and AS 241 (C) 1988 Royal Statistical Society.

2 2 Developing Basic Ideas 2.1 Ziggurat Method Rejection Method : This method is depend on the basic rejection principle. Let C be the set of all under a plot of the curve y = f(x) with finite area and let Z be the set of points containing C i.e. Z C. Then the idea is to choose a random point from Z until we get one that falls in C and then return it as the required variate. Here the density of such an x is Normal and we take a Uniform density as a covering density. We draw a random number from that uniform density until we get one point that falls under the Normal curve and we return it as a Normal random number. Partitioning the Normal Curve : Now we can increase the efficiency of the rejection procedure by minimizing the area(c)/area(z). And to achieve this, instead of covering the whole Normal curve by a Uniform pdf we cover the whole pdf by various small rectangles and do the rejection procedure on the small rectangle instead of the big one. Now to make the rectangles equally probable, we make the rectangles in such way that they have equal area. For simplicity let we divide the pdf into 7 rectangles with a base partition, in total 8 partition. let x 1 be the rightmost x coordinate of the rectangles and we have the partition like x 1 > x 2 > x 3 > x 4 > x 5 > x 6 > x 7 > x 8 = 0.

3 Drawing a Random Number from the Partitions : We first select a partition randomly. Let we choose ith partition When it s not the base partition ( i > 1) Now we draw a random number u form Uniform( 0, Xi ) and check i) If u < Xi+1, then return u as a Normal number. ii) Else we draw a bivariate point form that rectangle with x coordinate as u i.e. we generate another random u 1 from Uniform( (Xi), (Xi + 1) ) where (x) is the Normal pdf and check if (u, (Xi) + u 1 ) is under the Normal curve, (Xi) + u 1 < (u), then return u as a Normal number. iii) If both the cases fail then we again choose a new partition.

4 If it is base partition, i = 1 We generate a random number u 2 from U(0, A), A be the common area of the partition. i) If u 2 < x 1 (x 1) then return some v ~ U(0, x 1 (x 1) ) ii) else generate exponential random number from the tail, let V 1 and V 2 be two random number from U(0, 1). Then Marsaglia suggests a compact algorithm: 1. Let x = ln(v 1)/x Let y = ln(v 2). 3. If 2y > x 2, return x + x Otherwise, go back to step 1.

5 2.2 Box Muller Method : Let u 1 ~ U(0,1) and u 2 ~ U(0,1), independently. Then, R 2 = - 2ln(u 1) ~ exp(mean = 2) by probability integral transformation and θ = 2πu 2 ~ U(0, 2π ), independently. So f, (r, θ) = e, r 2 > 0 and 0 < θ < 2π Let X 1 = R cos(θ) and X 2 = R sin(θ) Jacobian of this transformation is J = 2X 2X = 2 f, (x, x ) = e f (x ) = f, (x, x ) dx = f (x ) = f, (x, x ) dx =, < x < and < x < π e x 2, < x < 2 1 2π e x 2, < x < So, X 1 ~ N(0, 1) and X 2 ~ N(0, 1) independently. 2.3 R default rnorm method : The R default rnorm function depend on R default qnorm function which returns the value of a quantile for a given probability. First draw a random number u from U(0, 1) and then return x = qnorm(u), which is a required random Normal number. Now qnorm works by approximating the normal cdf by polynomial given by Algorithm AS 111 by J. D. Beasley and S. G. Springer and Algorithm AS 241 by Michael J. Wichura. Let we have 0 < p < 1 and we want the corresponding quantile.

6 0 e e We partition the (0,1) length into three parts i) When < p < Compute q = p 0.425, so q < then take r = q 2 and required quantile. ii) When e -25 < p < or < p < 1 - e -25 i.e. min(p,q) < and r1 = log(min(p, q)) 5 Then return zp = ± E(r 1 ), the sign is determined by q 0 or q < 0, E and F both F(r 1 ) are 7th degree polynomial. iii) When 0< p < e -25 or 1 - e -25 < p < 1 i.e. if r1 > 5 Then return z p = ± G(r 1 ) H(r 1 ) of degree 7., sign is + or according to q 0 or q < 0, G and H also

7 3 Implementation : a. Ziggurat Method : Setting up Necessary Things : Finding the x coordinates of the Partition points : We have to form a partition in such way that the partition exactly covers up the whole Normal cdf curve with each partition having equal area. Let x 1 be the rightmost point then common area A = area of the base partition. Then A = area of the base rectangle + area of the tail = x (x ) + ( 1 Φ(x ) ), be the Normal pdf and Φ be the Normal cdf. Now we form a rectangle on top it with base x 1 and height y 1 = and form x 2 where it cuts the Normal curve i.e. x 2 = (y ) So yi = and y = y, x i+1 = (y) until y and let t be the total number rectangles drawn upto y We have to find some x 1 such that e 0.. So area left at the top p = 0.5 t*a.

8 The below R code is giving the area left at the top for a given leftmost partition point : area <- function(r) # r <-rightmost point of the partition A <- (r*dnorm(r)) pnorm(r) # starting with common area A x <- NA x[1] <- r i <- 1 y <- dnorm(x[1]) while(y <= dnorm(0)) x[i] <- sqrt(-2 * log(sqrt(2*pi)*y)) if(x[i]!= 0) y <- dnorm(x[i]) + (A/x[i]) else y <- dnorm(0) + 1 i <- i+1 j <- i-1 p <- pnorm(x[j]) (x[j]*dnorm(x[j])) # area left at the top x[j+1] <- j x[j+2] <- A x[j+3] <- p # no of partition # common area of each partition # area actually left at the top x[j+4] <- (j * A) p # Total area where rejection can happen x[j+5] < ((x[j+4]/(j * A)) * 100) # Percentage of acceptance return(x[j+3])

9 Then, we take some sequence from 3.5 to 4.2 and plot the upper area function for each of the value of the sequence and then use which.min function to determine the value where the minimum occurred. # ploting and finding the min value of area for given a seq of partition p oint from 3.5 to 4.2 r <- seq(from = 3.5,to = 4.2,length = 1000) plot(sapply(r, area), ylab = "Left Upper Area") abline(h=0) k <-r[which.min(sapply(r, area))] k [1] area(k) [1] e-08 Then we improve the value by choosing a sequence from to # improving the min by choosing the seq in to r <- seq(from = , to = , length = 1000) k <- r[which.min(sapply(r,area))] k [1] area(k) [1] e-11 Then after doing some trial and error we find r < area(r) [1] e-14 So we find the right most point as and by choosing this value as x 1 the area left is *

10 And we got the partition by : area <- function(r) A <- (r*dnorm(r)) pnorm(r) x <- NA x[1] <- r i <- 1 y <- dnorm(x[1]) while(y <= dnorm(0)) x[i] <- sqrt(-2 * log(sqrt(2*pi)*y)) if(x[i]!= 0) y <- dnorm(x[i]) + (A/x[i]) else y <- dnorm(0) + 1 i <- i+1 j <- i-1 p <- pnorm(x[j]) (x[j]*dnorm(x[j])) x[j+1] <- j x[j+2] <- A x[j+3] <- p # no of partition # common area of each partition # area actually left at the top x[j+4] <- (j * A) p # Total area where rejection can happen x[j+5] < ((x[j+4]/(j * A)) * 100) # Percentage of acceptance return(x) l <- area( ) l[257] [1] 256 We got total 256 partition with x 1 = and

11 l[261] [1] Total acceptance probability of any number drawn from those rectangles is %. Simplifying the Algorithm : The Ziggurat Algorithm is 1. Choose a random layer 1 i Let x = U 0x i where U 0 ~ U(-1, 1). 3. If x < xi+1, return x. 4. If i = 1, generate a point from the tail using the fallback algorithm. 5. Let y = y i + U1(y i+1 y i) where y i = (x ). 6. If y < (x), return x. 7. Otherwise, choose new random numbers and go back to step 1. For i = 1, Generate u 2 = U*A, U ~ U(0, 1) and check if u 2 < x 1 (x ), then return u ~ U(- x 1 (x ), x1 (x ) ). Oherwise follow, The fallback algorithm 1. Let x = ln(u1)/x1 where U 1 ~ U(0, 1). 2. Let y = ln(u2) where U 2 ~ U (0, 1). 3. If 2y > x 2, return x + x1. 4. Otherwise, go back to step 1. Let i 1. We convert the whole x i s and y i s into another p, q and d s for the sake of runtime p[i] = x[i-1] r[i] <- x[i]/x[i-1] d[i] <- 2π * (x[i]) and i = 1 p[1] = x[1] r[1] = x[1] * (x[1]) / A d[1] = 2π (x[1]) So, the case x = U 0xi and u = A*U both can be converted into x = upi, u be any random sample from U(0, 1).

12 and x < xi+1 and u < x 1 (x ) can be converted into u < r[i] and the checking y = y i + U1(y i+1 y i) < (x) can be done by checking U1 (d[i+1] d[i]) > (e d[i] ) Function for generating the new p[i], q[i]and d[i] s : pr1 <- function(x,j) p <- NA r <- NA d <- NA p[1] <- x[1] r[1] <- x[1]*dnorm(x[1]) / x[j+2] d[1] <- sqrt(2*pi) * (dnorm(x[1])) for(i in seq(2,j)) p[i] <- x[i-1] r[i] <- x[i]/x[i-1] d[i] <- sqrt(2*pi) * (dnorm(x[i])) p[j+1] <- x[j] c <- list(p,r,d) return(c) RCPP coding for the Ziggurat function : #include <Rcpp.h> #include <math.h> using namespace Rcpp; // [[Rcpp::export]] NumericVector c_zrnorm1 (NumericVector p, NumericVector r, NumericVector d, int n) NumericVector y(n) ; int e = 0 ; while(e < n)

13 int j = 0 ; while (j < 1) int i = (int)(256 * runif(1)[0]) ; double u = (2* runif(1)[0]) - 1 ; double x = p[i] * u ; if(abs(u) < r[i]) y[e]= x ; j = j+1 ; else if(i == 0) double y1 = -log(runif(1)[0])/p[0] ; double y2 = -log(runif(1)[0]) ; while(((y2 +y2) > (y1 * y1))) y1 = -log(runif(1)[0])/p[1] ; y2 = -log(runif(1)[0]) ; if(u >= 0) y[e] = (p[1] + y1) ; else y[e] = -(p[1] + y1); j = j+1 ; else if(((d[i] - d[i-1]) * runif(1)[0]) < (exp(-pow(x,2)/2) - d[i-1])) y[e] = x ; j = j+1 ; e = e + 1 ; return(y) ;

14 Main zrnorm1 function in R : library(rcpp) sourcecpp("zrnorm1.cpp") zrnorm1 <- function(size,mean,sd) mean + (sd * c_zrnorm1(p2,r2,d2,size)) zrnorm1(10,5,3) [1]

15 b. Box Muller method : We generate two independent u 1 and u 2 from U(0, 1) distribution and form X 1 and X 2 by Box Muller transformation and return them. i) If sample size n = even = 2k then we return X 1 and X 2 k times ii) If sample size n = odd = 2k + 1 then return X 1 and X 2 k times and generate another X 1 and X 2 and return only X 1. RCPP coding of Box Muller method : #include <Rcpp.h> #include <math.h> using namespace Rcpp; // [[Rcpp::export]] NumericVector boxmuller1(int size) NumericVector x(size) ; int i = (int)(size * 0.5); NumericVector u = runif(i); NumericVector v = runif(i); int j = 0 ; while(j < i) x[j] = sqrt(-2 * log(u[j]))*cos( * v[j]); x[i+j] = sqrt(-2 * log(u[j]))*sin( * v[j]); j = j+1 ; if(size%2 == 1) x[size-1] = sqrt(-2*log(runif(1)[0]))*cos(2* * runif(1)[0]); return(x);

16 Main boxmuller1 function in R : library(rcpp) sourcecpp("boxmuller.cpp") boxmuller1 <- function(size,mean,sd) mean + (sd * c_boxmuller1(size)) boxmuller1(10,5,3) [1]

17 c. Default rnorm function : The function rnorm uses the function norm_rand which is function for generating random normal num But rnorm use Inversion method as default. C code for rnorm( 1998 Ross Ihaka) : #include "nmath.h" double rnorm(double mu, double sigma) if (ISNAN(mu)!R_FINITE(sigma) sigma < 0.) ML_ERR_return_NAN; if (sigma == 0.!R_FINITE(mu)) return mu; /* includes mu = +/- Inf with finite sigma */ else return mu + sigma * norm_rand(); INVERSON method(1998 Ross Ihaka) : This method uses the qnorm function which returns the quantiles. It first i) Generate a u 1 ~ U(0, 1) and u 2 ~ U(0, 1) independently ii) Then take p = to have a high precision and use p as probability and return the qu corresponding to p by qnorm4 function. C Code for INVERSION Method : case INVERSION: #define BIG /* 2^27 */ /* unif_rand() alone is not of high enough precision */ u1 = unif_rand(); u1 = (int)(big*u1) + unif_rand(); return qnorm5(u1/big, 0.0, 1.0, 1, 0); C code for qnorm5 function (1998 Ross Ihaka) : #include "nmath.h" #include "dpq.h" double qnorm5(double p, double mu, double sigma, int lower_tail, int log_p) double p_, q, r, val;

18 #ifdef IEEE_754 if (ISNAN(p) ISNAN(mu) ISNAN(sigma)) return p + mu + sigma; #endif R_Q_P01_boundaries(p, ML_NEGINF, ML_POSINF); if(sigma < 0) if(sigma == 0) ML_ERR_return_NAN; return mu; p_ = R_DT_qIv(p);/* real lower_tail prob. p */ q = p_ - 0.5; #ifdef DEBUG_qnorm REprintf("qnorm(p=%10.7g, m=%g, s=%g, l.t.= %d, log= %d): q = %g\n", p,mu,sigma, lower_tail, log_p, q); #endif /*-- use AS */ /* double ppnd16_(double *p, long *ifault)*/ /* ALGORITHM AS241 APPL. STATIST. (1988) VOL. 37, NO. 3 Produces the normal deviate Z corresponding to a given lower tail area of P; Z is accurate to about 1 part in 10**16. */ (original fortran code used PARAMETER(..) for the coefficients and provided hash codes for checking them...) if (fabs(q) <=.425) /* <= p <= */ r = q * q; val = q * (((((((r * ) * r ) * r ) * r ) * r ) * r ) * r ) / (((((((r * ) * r ) * r ) * r ) * r ) * r ) * r + 1.); else /* closer than from 0,1 boundary */ /* r = min(p, 1-p) < */ if (q > 0) r = R_DT_CIv(p);/* 1-p */ else r = p_;/* = R_DT_Iv(p) ^= p */ r = sqrt(- ((log_p && ((lower_tail && q <= 0) (!lower_tail && q > 0)))? p : /* else */ log(r))); /* r = sqrt(-log(r)) <==> min(p, 1-p) = exp( - r^2 ) */ #ifdef DEBUG_qnorm REprintf("\t close to 0 or 1: r = %7g\n", r); #endif if (r <= 5.) /* <==> min(p,1-p) >= exp(-25) ~= e-11 */ r += -1.6; val = (((((((r * e-4 +

19 ) * r ) * r ) * r ) * r ) * r ) * r ) / (((((((r * e e-4) * r ) * r ) * r ) * r ) * r ) * r + 1.); else /* very close to 0 or 1 */ r += -5.; val = (((((((r * e e-5) * r ) * r ) * r ) * r ) * r ) * r ) / (((((((r * e e-7)* r e-5) * r e-4) * r ) * r ) * r ) * r + 1.); if(q < 0.0) val = -val; /* return (q >= 0.)? r : -r ;*/ return mu + sigma * val;

20 4 Normality Checking : 4.1 Shapiro Wilk Test Sample size = 1000 : Ziggurat (zrnorm1 ) : length(which(replicate(1000,shapiro.test(zrnorm1(1000,0,1))$p.value) < 0.05))/ 1000 [1] Box Muller (boxmuller1) : length(which(replicate(1000,shapiro.test(boxmuller1(1000,0,1))$p.value) < 0.05))/1000 [1] Sample size = 5000 : zrnorm1 : length(which(replicate(1000,shapiro.test(zrnorm1(5000,0,1))$p.value) < 0.05))/ 1000 [1] boxmuller1 : length(which(replicate(1000,shapiro.test(boxmuller1(5000,0,1))$p.value) < 0.05))/1000 [1] So in all cases zrnorm1 and boxmuller1 both are accepted by Shapiro Wilk Test. 4.2 Kolmogorov Smirnov test for Normality : Sample size = zrnorm1 : library(nortest) length(which(replicate(1000,lillie.test(zrnorm1(10000,0,1))$p.value) < 0.05))/ 1000 [1] 0.05

21 boxmuller1 : length(which(replicate(1000,lillie.test(boxmuller1(10000,0,1))$p.value) < 0.05))/1000 [1] So both the functions are accepted by this test Sample size = zrnorm1 : length(which(replicate(1000,lillie.test(zrnorm1(50000,0,1))$p.value) < 0.05))/ 1000 [1] boxmuller1 : length(which(replicate(1000,lillie.test(boxmuller1(50000,0,1))$p.value) < 0.05))/1000 [1] So again it accepted by the test. So both functions are giving Normal Random Number. Next we test for randomness.

22 5 Test for Randomness : Wald-Wolfowitz Runs Test : 5.1 Sample Size = 5000 i. zrnorm1 : length(which(replicate(1000,runs.test(zrnorm1(5000,0,1))$p.value) < 0.05))/ 1000 [1] ii. boxmuller1 : length(which(replicate(1000,runs.test(boxmuller1(5000,0,1))$p.value) < 0.05))/ 1000 [1] Sample Size = zrnorm1 : length(which(replicate(1000,runs.test(zrnorm1(50000,0,1))$p.value) < 0.05))/ 1000 [1] boxmuller1 : length(which(replicate(1000,runs.test(boxmuller1(50000,0,1))$p.value) < 0.05))/ 1000 [1] So in all cases hypothesis is accepted that these two functions are generating random number.

23 6 Runtime Comparison : a. Number per Second : zrnorm1 : mean(replicate(10,system.time(zrnorm1(10^7,0,1))[1])) [1] (10^7) / [1] Boxmuller : mean(replicate(10,system.time(boxmuller1(10^7,0,1))[1])) [1] (10^7)/ [1] rnorm : mean(replicate(10,system.time(rnorm(10^7,0,1))[1])) [1] (10^7)/ [1] Method Random Number per second Ziggurat zrnorm1 Box Muller boxmuller1 rnorm So rnorm is faster than the other two functions.

24 a. Runtime for 10 8 sample case : i. Ziggurat : mean(replicate(5,system.time(zrnorm1(10^8,0,1))[1])) [1] ii. Box Muller : mean(replicate(5,system.time(boxmuller1(10^8,0,1))[1])) [1] iii. rnorm : mean(replicate(5,system.time(rnorm(10^8,0,1))[1])) [1] Method Runtime for 10 8 sample (in sec.) Ziggurat zrnorm1 Box Muller boxmuller1 rnorm b. Drawing a curve showing runtime for the three functions : time1 <- function(size) return(system.time(zrnorm1(size,0,1))[1]) time2 <- function(size) return(system.time(boxmuller1(size,0,1))[1]) time3 <- function(size) return(system.time(rnorm(size))[1])

25 i. Draw a curve for sample of size to by : t <- seq(10^6, 2e+07, by =10^6) plot(sapply(t,time1), type = "l", col = "blue", main = "Runtime Comaprison", xlab = "Number of samples (in 10^6)", ylab = "Runtime", asp = 1 ) lines(sapply(t,time2), type = "l", col = "red", asp = 1) lines(sapply(t,time3), type = "l", col = "green", asp = 1) abline(h = 0, col = "orange") Red : zrnorm1 Blue : boxmuller1 Green : rnorm

26 Sample of size to by : t <- seq(10^5, 10^6, by = 10^5) plot(sapply(t,time1), type = "l", col = "blue", main = "Runtime Comaprison", xlab = "Number of samples (in 10^6)", ylab = "Runtime") lines(sapply(t,time2), type = "l", col = "red") lines(sapply(t,time3), type = "l", col = "green") Red : Ziggurat Blue : Box Muller Green : rnorm

27 References 1. Rejection Samping : 2. Box Muller Transformation : 3. Ziggurat Algorithm : 4. Paper by Marsaglia and Tsang : 5. Source code for rnorm : 6. Source code for Inversion method : 7. Source code for qnorm : 8. Algorithm AS 111 by Beasley and Springer : 9. Algorithm AS 241 by Michael Wichura : Shapiro Wilk Test : Kolmogorov Smirnov Normality Test : Wald Wolfowitz runs test :

STATISTICAL LABORATORY, April 30th, 2010 BIVARIATE PROBABILITY DISTRIBUTIONS

STATISTICAL LABORATORY, April 30th, 2010 BIVARIATE PROBABILITY DISTRIBUTIONS STATISTICAL LABORATORY, April 3th, 21 BIVARIATE PROBABILITY DISTRIBUTIONS Mario Romanazzi 1 MULTINOMIAL DISTRIBUTION Ex1 Three players play 1 independent rounds of a game, and each player has probability

More information

Basic C++ through Rcpp

Basic C++ through Rcpp Basic C++ through Rcpp Advanced Statistical Programming Camp Jonathan Olmsted (Q-APS) Day 3: May 29th, 2014 PM Session ASPC Basic C++ through Rcpp Day 3 PM 1 / 30 Outline 1 Practice 2 Rcpp Sugar 3 RNG

More information

UP School of Statistics Student Council Education and Research

UP School of Statistics Student Council Education and Research w UP School of Statistics Student Council Education and Research erho.weebly.com 0 erhomyhero@gmail.com f /erhoismyhero t @erhomyhero S133_HOA_001 Statistics 133 Bayesian Statistical Inference Use of R

More information

1 Pencil and Paper stuff

1 Pencil and Paper stuff Spring 2008 - Stat C141/ Bioeng C141 - Statistics for Bioinformatics Course Website: http://www.stat.berkeley.edu/users/hhuang/141c-2008.html Section Website: http://www.stat.berkeley.edu/users/mgoldman

More information

R Primer for Introduction to Mathematical Statistics 8th Edition Joseph W. McKean

R Primer for Introduction to Mathematical Statistics 8th Edition Joseph W. McKean R Primer for Introduction to Mathematical Statistics 8th Edition Joseph W. McKean Copyright 2017 by Joseph W. McKean at Western Michigan University. All rights reserved. Reproduction or translation of

More information

Monte Carlo sampling

Monte Carlo sampling 1 y u theta 0 x 1 Monte Carlo sampling Problem 1 Suppose we want to sample uniformly at random from the triangle defined by the points (0,0), (0,1), (1,0). First Sampling Algorithm: We decide to do this

More information

R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website:

R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website: Introduction to R R R is a programming language of a higher-level Constantly increasing amount of packages (new research) Free of charge Website: http://www.r-project.org/ Code Editor: http://rstudio.org/

More information

Monte Carlo Simulations

Monte Carlo Simulations Monte Carlo Simulations Lecture 2 December 8, 2014 Outline 1 Random Number Generation 2 Uniform Random Variables 3 Normal Random Variables 4 Correlated Random Variables Random Number Generation Monte Carlo

More information

The nor1mix Package. June 12, 2007

The nor1mix Package. June 12, 2007 The nor1mix Package June 12, 2007 Title Normal (1-d) Mixture Models (S3 Classes and Methods) Version 1.0-7 Date 2007-03-15 Author Martin Mächler Maintainer Martin Maechler

More information

Lab 4: Distributions of random variables

Lab 4: Distributions of random variables Lab 4: Distributions of random variables In this lab we ll investigate the probability distribution that is most central to statistics: the normal distribution If we are confident that our data are nearly

More information

R Programming Basics - Useful Builtin Functions for Statistics

R Programming Basics - Useful Builtin Functions for Statistics R Programming Basics - Useful Builtin Functions for Statistics Vectorized Arithmetic - most arthimetic operations in R work on vectors. Here are a few commonly used summary statistics. testvect = c(1,3,5,2,9,10,7,8,6)

More information

CS 563 Advanced Topics in Computer Graphics Monte Carlo Integration: Basic Concepts. by Emmanuel Agu

CS 563 Advanced Topics in Computer Graphics Monte Carlo Integration: Basic Concepts. by Emmanuel Agu CS 563 Advanced Topics in Computer Graphics Monte Carlo Integration: Basic Concepts by Emmanuel Agu Introduction The integral equations generally don t have analytic solutions, so we must turn to numerical

More information

Data Challenge 2. 1 Introduction. Milo Page. 1.1 Model. 1.2 Results. October 26, 2016

Data Challenge 2. 1 Introduction. Milo Page. 1.1 Model. 1.2 Results. October 26, 2016 Data Challenge 2 Milo Page October 26, 2016 1 Introduction Data Challenge 2: Impute missing values from an artificially generated, spatially correlated data set. 1.1 Model Based on some exploratory plots,

More information

Tutorial 3: Probability & Distributions Johannes Karreth RPOS 517, Day 3

Tutorial 3: Probability & Distributions Johannes Karreth RPOS 517, Day 3 Tutorial 3: Probability & Distributions Johannes Karreth RPOS 517, Day 3 This tutorial shows you: how to simulate a random process how to plot the distribution of a variable how to assess the distribution

More information

In this computer exercise we will work with the analysis of variance in R. We ll take a look at the following topics:

In this computer exercise we will work with the analysis of variance in R. We ll take a look at the following topics: UPPSALA UNIVERSITY Department of Mathematics Måns Thulin, thulin@math.uu.se Analysis of regression and variance Fall 2011 COMPUTER EXERCISE 2: One-way ANOVA In this computer exercise we will work with

More information

MULTI-DIMENSIONAL MONTE CARLO INTEGRATION

MULTI-DIMENSIONAL MONTE CARLO INTEGRATION CS580: Computer Graphics KAIST School of Computing Chapter 3 MULTI-DIMENSIONAL MONTE CARLO INTEGRATION 2 1 Monte Carlo Integration This describes a simple technique for the numerical evaluation of integrals

More information

PHYSICS 115/242 Homework 2, Solutions

PHYSICS 115/242 Homework 2, Solutions PHYSICS 115/242 Homework 2, Solutions 1. Trapezium Rule I wrote a function trap to do the trapezoidal rule, and put it in a separate file, trap.c. This is as follows: /******************************************************************

More information

The diagram above shows a sketch of the curve C with parametric equations

The diagram above shows a sketch of the curve C with parametric equations 1. The diagram above shows a sketch of the curve C with parametric equations x = 5t 4, y = t(9 t ) The curve C cuts the x-axis at the points A and B. (a) Find the x-coordinate at the point A and the x-coordinate

More information

RevBayes: Introduction and Demonstration of the basic elements

RevBayes: Introduction and Demonstration of the basic elements RevBayes: Introduction and Demonstration of the basic elements S E B A S T I A N H Ö H N A, J O H N H U E L S E N B E C K A N D FREDRIK RONQUIST DEPARTMENT OF MATHEMATICS, STOCKHOLM UNIVERSITY DEPARTMENT

More information

Tying Hypothesis Tests, Power, and More Together with Functions

Tying Hypothesis Tests, Power, and More Together with Functions Tying Hypothesis Tests, Power, and More Together with Functions General Homework Notes Read the entire question. Show your answers. Don t give me the code and assume it shows the answers (e.g., plots,

More information

Drawing Piecewise Smooth Curves. Ross Ihaka

Drawing Piecewise Smooth Curves. Ross Ihaka Drawing Piecewise Smooth Curves Ross Ihaka The Big Picture Given an arbitrary function f and an interval [a,b], I want to have an automatic procedure that will draw the graph of the function over the interval.

More information

VARIANCE REDUCTION TECHNIQUES IN MONTE CARLO SIMULATIONS K. Ming Leung

VARIANCE REDUCTION TECHNIQUES IN MONTE CARLO SIMULATIONS K. Ming Leung POLYTECHNIC UNIVERSITY Department of Computer and Information Science VARIANCE REDUCTION TECHNIQUES IN MONTE CARLO SIMULATIONS K. Ming Leung Abstract: Techniques for reducing the variance in Monte Carlo

More information

Package SHELF. August 16, 2018

Package SHELF. August 16, 2018 Type Package Package SHELF August 16, 2018 Title Tools to Support the Sheffield Elicitation Framework Version 1.4.0 Date 2018-08-15 Author Jeremy Oakley Maintainer Implements various methods for eliciting

More information

Lab 5 Monte Carlo integration

Lab 5 Monte Carlo integration Lab 5 Monte Carlo integration Edvin Listo Zec 9065-976 edvinli@student.chalmers.se October 0, 014 Co-worker: Jessica Fredby Introduction In this computer assignment we will discuss a technique for solving

More information

METROPOLIS MONTE CARLO SIMULATION

METROPOLIS MONTE CARLO SIMULATION POLYTECHNIC UNIVERSITY Department of Computer and Information Science METROPOLIS MONTE CARLO SIMULATION K. Ming Leung Abstract: The Metropolis method is another method of generating random deviates that

More information

Introduction to RStudio

Introduction to RStudio First, take class through processes of: Signing in Changing password: Tools -> Shell, then use passwd command Installing packages Check that at least these are installed: MASS, ISLR, car, class, boot,

More information

What We ll Do... Random

What We ll Do... Random What We ll Do... Random- number generation Random Number Generation Generating random variates Nonstationary Poisson processes Variance reduction Sequential sampling Designing and executing simulation

More information

Package simed. November 27, 2017

Package simed. November 27, 2017 Version 1.0.3 Title Simulation Education Author Barry Lawson, Larry Leemis Package simed November 27, 2017 Maintainer Barry Lawson Imports graphics, grdevices, methods, stats, utils

More information

height VUD x = x 1 + x x N N 2 + (x 2 x) 2 + (x N x) 2. N

height VUD x = x 1 + x x N N 2 + (x 2 x) 2 + (x N x) 2. N Math 3: CSM Tutorial: Probability, Statistics, and Navels Fall 2 In this worksheet, we look at navel ratios, means, standard deviations, relative frequency density histograms, and probability density functions.

More information

Introduction to R. Biostatistics 615/815 Lecture 23

Introduction to R. Biostatistics 615/815 Lecture 23 Introduction to R Biostatistics 615/815 Lecture 23 So far We have been working with C Strongly typed language Variable and function types set explicitly Functional language Programs are a collection of

More information

The ctest Package. January 3, 2000

The ctest Package. January 3, 2000 R objects documented: The ctest Package January 3, 2000 bartlett.test....................................... 1 binom.test........................................ 2 cor.test.........................................

More information

Monte Carlo Integration and Random Numbers

Monte Carlo Integration and Random Numbers Monte Carlo Integration and Random Numbers Higher dimensional integration u Simpson rule with M evaluations in u one dimension the error is order M -4! u d dimensions the error is order M -4/d u In general

More information

Lecture 7: Monte Carlo Rendering. MC Advantages

Lecture 7: Monte Carlo Rendering. MC Advantages Lecture 7: Monte Carlo Rendering CS 6620, Spring 2009 Kavita Bala Computer Science Cornell University MC Advantages Convergence rate of O( ) Simple Sampling Point evaluation Can use black boxes General

More information

6-1 THE STANDARD NORMAL DISTRIBUTION

6-1 THE STANDARD NORMAL DISTRIBUTION 6-1 THE STANDARD NORMAL DISTRIBUTION The major focus of this chapter is the concept of a normal probability distribution, but we begin with a uniform distribution so that we can see the following two very

More information

Probability Models.S4 Simulating Random Variables

Probability Models.S4 Simulating Random Variables Operations Research Models and Methods Paul A. Jensen and Jonathan F. Bard Probability Models.S4 Simulating Random Variables In the fashion of the last several sections, we will often create probability

More information

Figure 1 Jackson Pollock painting titled "Reflections of the Big Dipper" (left) and "Number 18" (right).

Figure 1 Jackson Pollock painting titled Reflections of the Big Dipper (left) and Number 18 (right). EE 356 Notes on Pollock Paint Figures 1 shows two typical Jackson Pollock paintings. Notice that they consists of paint splatters, loops that resemble a portion of an ellipse, and occasionally a figure

More information

Projective Integration Methods for Distributions. Λ C. W. Gear y November 26, 2001 Abstract Projective methods were introduced in an earlier paper. In this paper we consider their application to the output

More information

THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533. Time: 50 minutes 40 Marks FRST Marks FRST 533 (extra questions)

THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533. Time: 50 minutes 40 Marks FRST Marks FRST 533 (extra questions) THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533 MIDTERM EXAMINATION: October 14, 2005 Instructor: Val LeMay Time: 50 minutes 40 Marks FRST 430 50 Marks FRST 533 (extra questions) This examination

More information

The nor1mix Package. August 3, 2006

The nor1mix Package. August 3, 2006 The nor1mix Package August 3, 2006 Title Normal (1-d) Mixture Models (S3 Classes and Methods) Version 1.0-6 Date 2006-08-02 Author: Martin Mächler Maintainer Martin Maechler

More information

Modules and Clients 1 / 21

Modules and Clients 1 / 21 Modules and Clients 1 / 21 Outline 1 Using Functions in Other Programs 2 Modular Programming Abstractions 3 Random Numbers 4 List Processing 5 Standard Statistics 2 / 21 Using Functions in Other Programs

More information

Nonparametric Regression and Cross-Validation Yen-Chi Chen 5/27/2017

Nonparametric Regression and Cross-Validation Yen-Chi Chen 5/27/2017 Nonparametric Regression and Cross-Validation Yen-Chi Chen 5/27/2017 Nonparametric Regression In the regression analysis, we often observe a data consists of a response variable Y and a covariate (this

More information

Shrinkage of logarithmic fold changes

Shrinkage of logarithmic fold changes Shrinkage of logarithmic fold changes Michael Love August 9, 2014 1 Comparing the posterior distribution for two genes First, we run a DE analysis on the Bottomly et al. dataset, once with shrunken LFCs

More information

Exercises Lecture III: Random numbers with non uniform distributions; simulations of simple random processes

Exercises Lecture III: Random numbers with non uniform distributions; simulations of simple random processes Exercises Lecture III: Random numbers with non uniform distributions; simulations of simple random processes 1. Random numbers with non uniform distributions: Inverse Transformation Method (a) With the

More information

SUPPLEMENTARY FILE S1: 3D AIRWAY TUBE RECONSTRUCTION AND CELL-BASED MECHANICAL MODEL. RELATED TO FIGURE 1, FIGURE 7, AND STAR METHODS.

SUPPLEMENTARY FILE S1: 3D AIRWAY TUBE RECONSTRUCTION AND CELL-BASED MECHANICAL MODEL. RELATED TO FIGURE 1, FIGURE 7, AND STAR METHODS. SUPPLEMENTARY FILE S1: 3D AIRWAY TUBE RECONSTRUCTION AND CELL-BASED MECHANICAL MODEL. RELATED TO FIGURE 1, FIGURE 7, AND STAR METHODS. 1. 3D AIRWAY TUBE RECONSTRUCTION. RELATED TO FIGURE 1 AND STAR METHODS

More information

The Bolstad Package. July 9, 2007

The Bolstad Package. July 9, 2007 The Bolstad Package July 9, 2007 Version 0.2-12 Date 2007-09-07 Title Bolstad functions Author James Curran Maintainer James M. Curran A set of

More information

A Quick Introduction to R

A Quick Introduction to R Math 4501 Fall 2012 A Quick Introduction to R The point of these few pages is to give you a quick introduction to the possible uses of the free software R in statistical analysis. I will only expect you

More information

Chapter 5: Joint Probability Distributions and Random

Chapter 5: Joint Probability Distributions and Random Chapter 5: Joint Probability Distributions and Random Samples Curtis Miller 2018-06-13 Introduction We may naturally inquire about collections of random variables that are related to each other in some

More information

Double Integration: Non-Rectangular Domains

Double Integration: Non-Rectangular Domains Double Integration: Non-Rectangular Domains Thomas Banchoff and Associates June 18, 2003 1 Introduction In calculus of one variable, all domains are intervals which are subsets of the line. In calculus

More information

Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert

Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert Stats with R and RStudio Practical: basic stats for peak calling Jacques van Helden, Hugo varet and Julie Aubert 2017-01-08 Contents Introduction 2 Peak-calling: question...........................................

More information

Sampling from distributions

Sampling from distributions Sampling from distributions December 17, 2015 1 Sampling from distributions Now that we are able to sample equally distributed (pseudo-)random numbers in the interval [1, 0), we are now able to sample

More information

Page 129 Exercise 5: Suppose that the joint p.d.f. of two random variables X and Y is as follows: { c(x. 0 otherwise. ( 1 = c. = c

Page 129 Exercise 5: Suppose that the joint p.d.f. of two random variables X and Y is as follows: { c(x. 0 otherwise. ( 1 = c. = c Stat Solutions for Homework Set Page 9 Exercise : Suppose that the joint p.d.f. of two random variables X and Y is as follows: { cx fx, y + y for y x, < x < otherwise. Determine a the value of the constant

More information

Speeding up R code using Rcpp and foreach packages.

Speeding up R code using Rcpp and foreach packages. Speeding up R code using Rcpp and foreach packages. Pedro Albuquerque Universidade de Brasília February, 8th 2017 Speeding up R code using Rcpp and foreach packages. 1 1 Speeding up R. 2 foreach package.

More information

Lecture Slides. Elementary Statistics Twelfth Edition. by Mario F. Triola. and the Triola Statistics Series. Section 2.1- #

Lecture Slides. Elementary Statistics Twelfth Edition. by Mario F. Triola. and the Triola Statistics Series. Section 2.1- # Lecture Slides Elementary Statistics Twelfth Edition and the Triola Statistics Series by Mario F. Triola Chapter 2 Summarizing and Graphing Data 2-1 Review and Preview 2-2 Frequency Distributions 2-3 Histograms

More information

Stochastic Models. Introduction to R. Walt Pohl. February 28, Department of Business Administration

Stochastic Models. Introduction to R. Walt Pohl. February 28, Department of Business Administration Stochastic Models Introduction to R Walt Pohl Universität Zürich Department of Business Administration February 28, 2013 What is R? R is a freely-available general-purpose statistical package, developed

More information

Biostatistics 615/815 Lecture 19: Multidimensional Optimizations

Biostatistics 615/815 Lecture 19: Multidimensional Optimizations Biostatistics 615/815 Lecture 19: Multidimensional Optimizations Hyun Min Kang March 29th, 2011 Hyun Min Kang Biostatistics 615/815 - Lecture 19 March 29th, 2011 1 / 43 Annoucements Homework Homework #5

More information

Use of Extreme Value Statistics in Modeling Biometric Systems

Use of Extreme Value Statistics in Modeling Biometric Systems Use of Extreme Value Statistics in Modeling Biometric Systems Similarity Scores Two types of matching: Genuine sample Imposter sample Matching scores Enrolled sample 0.95 0.32 Probability Density Decision

More information

Defining Functions 1 / 21

Defining Functions 1 / 21 Defining Functions 1 / 21 Outline 1 Using and Defining Functions 2 Implementing Mathematical Functions 3 Using Functions to Organize Code 4 Passing Arguments and Returning Values 5 Filter, Lambda, Map,

More information

Week 7: The normal distribution and sample means

Week 7: The normal distribution and sample means Week 7: The normal distribution and sample means Goals Visualize properties of the normal distribution. Learning the Tools Understand the Central Limit Theorem. Calculate sampling properties of sample

More information

Quality control of array genotyping data with argyle Andrew P Morgan

Quality control of array genotyping data with argyle Andrew P Morgan Quality control of array genotyping data with argyle Andrew P Morgan 2015-10-08 Introduction Proper quality control of array genotypes is an important prerequisite to further analysis. Genotype quality

More information

Testing Random- Number Generators

Testing Random- Number Generators Testing Random- Number Generators Raj Jain Washington University Saint Louis, MO 63131 Jain@cse.wustl.edu These slides are available on-line at: http://www.cse.wustl.edu/~jain/cse574-06/ 27-1 Overview

More information

Risk Management Using R, SoSe 2013

Risk Management Using R, SoSe 2013 1. Problem (vectors and factors) a) Create a vector containing the numbers 1 to 10. In this vector, replace all numbers greater than 4 with 5. b) Create a sequence of length 5 starting at 0 with an increment

More information

How Random is Random?

How Random is Random? "!$#%!&(' )*!$#+, -/.(#2 cd4me 3%46587:9=?46@A;CBEDGF 7H;>I846=?7H;>JLKM7ONQPRKSJL4T@8KM4SUV7O@8W X 46@A;u+4mg^hb@8ub;>ji;>jk;t"q(cufwvaxay6vaz

More information

Stat 528 (Autumn 2008) Density Curves and the Normal Distribution. Measures of center and spread. Features of the normal distribution

Stat 528 (Autumn 2008) Density Curves and the Normal Distribution. Measures of center and spread. Features of the normal distribution Stat 528 (Autumn 2008) Density Curves and the Normal Distribution Reading: Section 1.3 Density curves An example: GRE scores Measures of center and spread The normal distribution Features of the normal

More information

Computational statistics Jamie Griffin. Semester B 2018 Lecture 1

Computational statistics Jamie Griffin. Semester B 2018 Lecture 1 Computational statistics Jamie Griffin Semester B 2018 Lecture 1 Course overview This course is not: Statistical computing Programming This course is: Computational statistics Statistical methods that

More information

Calculus III. Math 233 Spring In-term exam April 11th. Suggested solutions

Calculus III. Math 233 Spring In-term exam April 11th. Suggested solutions Calculus III Math Spring 7 In-term exam April th. Suggested solutions This exam contains sixteen problems numbered through 6. Problems 5 are multiple choice problems, which each count 5% of your total

More information

Machine Learning for Signal Processing Clustering. Bhiksha Raj Class Oct 2016

Machine Learning for Signal Processing Clustering. Bhiksha Raj Class Oct 2016 Machine Learning for Signal Processing Clustering Bhiksha Raj Class 11. 13 Oct 2016 1 Statistical Modelling and Latent Structure Much of statistical modelling attempts to identify latent structure in the

More information

Package extremevalues

Package extremevalues Package extremevalues January 20, 2016 Detect outliers in one-dimensional data. Version 2.3.2 Date 2016-01-05 Title Univariate Outlier Detection Author Mark van der Loo Maintainer

More information

Tricks and Traps for Young Players

Tricks and Traps for Young Players Tricks and Traps for Young Players Ray D Brownrigg Statistical Computing Manager School of Mathematics, Statistics and Computer Science Victoria University of Wellington Wellington, New Zealand ray@mcs.vuw.ac.nz

More information

Outline. 1 Using Functions in Other Programs. 2 Modular Programming Abstractions. 3 Random Numbers. 4 List Processing. 5 Standard Statistics 1 / 21

Outline. 1 Using Functions in Other Programs. 2 Modular Programming Abstractions. 3 Random Numbers. 4 List Processing. 5 Standard Statistics 1 / 21 Outline 1 Using Functions in Other Programs Modules and Clients 2 Modular Programming Abstractions 3 Random Numbers 4 5 Standard Statistics 1 / 21 2 / 21 Using Functions in Other Programs Modular Programming

More information

CHAPTER 2: Describing Location in a Distribution

CHAPTER 2: Describing Location in a Distribution CHAPTER 2: Describing Location in a Distribution 2.1 Goals: 1. Compute and use z-scores given the mean and sd 2. Compute and use the p th percentile of an observation 3. Intro to density curves 4. More

More information

Chapter 6 Normal Probability Distributions

Chapter 6 Normal Probability Distributions Chapter 6 Normal Probability Distributions 6-1 Review and Preview 6-2 The Standard Normal Distribution 6-3 Applications of Normal Distributions 6-4 Sampling Distributions and Estimators 6-5 The Central

More information

Optimization Methods III. The MCMC. Exercises.

Optimization Methods III. The MCMC. Exercises. Aula 8. Optimization Methods III. Exercises. 0 Optimization Methods III. The MCMC. Exercises. Anatoli Iambartsev IME-USP Aula 8. Optimization Methods III. Exercises. 1 [RC] A generic Markov chain Monte

More information

BSM510 Numerical Analysis

BSM510 Numerical Analysis BSM510 Numerical Analysis Introduction and Matlab Fundamentals Manar Mohaisen Department of EEC Engineering Lecture Content Introduction to MATLAB 2 Introduction to MATLAB MATLAB 3 Scalars >> x = 5; x

More information

A Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn

A Handbook of Statistical Analyses Using R. Brian S. Everitt and Torsten Hothorn A Handbook of Statistical Analyses Using R Brian S. Everitt and Torsten Hothorn CHAPTER 7 Density Estimation: Erupting Geysers and Star Clusters 7.1 Introduction 7.2 Density Estimation The three kernel

More information

CDA6530: Performance Models of Computers and Networks. Chapter 8: Statistical Simulation --- Discrete-Time Simulation

CDA6530: Performance Models of Computers and Networks. Chapter 8: Statistical Simulation --- Discrete-Time Simulation CDA6530: Performance Models of Computers and Networks Chapter 8: Statistical Simulation --- Discrete-Time Simulation Simulation Studies Models with analytical formulas Calculate the numerical solutions

More information

LAB #2: SAMPLING, SAMPLING DISTRIBUTIONS, AND THE CLT

LAB #2: SAMPLING, SAMPLING DISTRIBUTIONS, AND THE CLT NAVAL POSTGRADUATE SCHOOL LAB #2: SAMPLING, SAMPLING DISTRIBUTIONS, AND THE CLT Statistics (OA3102) Lab #2: Sampling, Sampling Distributions, and the Central Limit Theorem Goal: Use R to demonstrate sampling

More information

Multivariate Capability Analysis

Multivariate Capability Analysis Multivariate Capability Analysis Summary... 1 Data Input... 3 Analysis Summary... 4 Capability Plot... 5 Capability Indices... 6 Capability Ellipse... 7 Correlation Matrix... 8 Tests for Normality... 8

More information

Learner Expectations UNIT 1: GRAPICAL AND NUMERIC REPRESENTATIONS OF DATA. Sept. Fathom Lab: Distributions and Best Methods of Display

Learner Expectations UNIT 1: GRAPICAL AND NUMERIC REPRESENTATIONS OF DATA. Sept. Fathom Lab: Distributions and Best Methods of Display CURRICULUM MAP TEMPLATE Priority Standards = Approximately 70% Supporting Standards = Approximately 20% Additional Standards = Approximately 10% HONORS PROBABILITY AND STATISTICS Essential Questions &

More information

Math 2374 Spring 2007 Midterm 3 Solutions - Page 1 of 6 April 25, 2007

Math 2374 Spring 2007 Midterm 3 Solutions - Page 1 of 6 April 25, 2007 Math 374 Spring 7 Midterm 3 Solutions - Page of 6 April 5, 7. (3 points) Consider the surface parametrized by (x, y, z) Φ(x, y) (x, y,4 (x +y )) between the planes z and z 3. (i) (5 points) Set up the

More information

Statistical Research Consultants Bangladesh (SRCBD) Testing for Normality using SPSS

Statistical Research Consultants Bangladesh (SRCBD)   Testing for Normality using SPSS Testing for Normality using SPSS An assessment of the normality of data is a prerequisite for many statistical tests because normal data is an underlying assumption in parametric testing. There are two

More information

= f (a, b) + (hf x + kf y ) (a,b) +

= f (a, b) + (hf x + kf y ) (a,b) + Chapter 14 Multiple Integrals 1 Double Integrals, Iterated Integrals, Cross-sections 2 Double Integrals over more general regions, Definition, Evaluation of Double Integrals, Properties of Double Integrals

More information

Package smovie. April 21, 2018

Package smovie. April 21, 2018 Type Package Package smovie April 21, 2018 Title Some Movies to Illustrate Concepts in Statistics Version 1.0.1 Date 2018-04-21 Description Provides movies to help students to understand statistical concepts.

More information

Smooth rounded corner. Smooth rounded corner. Smooth rounded corner

Smooth rounded corner. Smooth rounded corner. Smooth rounded corner 3.2 Graphs of Higher Degree Polynomial Functions Definition of a Polynomial Function Let n be a nonnegative integer and let a n, a n-1,,a 2, a 1, a 0, be real numbers with a n 0. The function defined by

More information

Parallel Execution with OpenMP

Parallel Execution with OpenMP Parallel Execution with OpenMP Advanced Statistical Programming Camp Jonathan Olmsted (Q-APS) Day 4: May 30th, 2014 PM Session ASPC Parallel Execution with OpenMP Day 4 AM 1 / 28 Outline 1 OpenMP 2 Use

More information

Biostatistics 615/815 Lecture 16: Importance sampling Single dimensional optimization

Biostatistics 615/815 Lecture 16: Importance sampling Single dimensional optimization Biostatistics 615/815 Lecture 16: Single dimensional optimization Hyun Min Kang November 1st, 2012 Hyun Min Kang Biostatistics 615/815 - Lecture 16 November 1st, 2012 1 / 59 The crude Monte-Carlo Methods

More information

Random Numbers and Monte Carlo Methods

Random Numbers and Monte Carlo Methods Random Numbers and Monte Carlo Methods Methods which make use of random numbers are often called Monte Carlo Methods after the Monte Carlo Casino in Monaco which has long been famous for games of chance.

More information

Section 4.3. Graphing Exponential Functions

Section 4.3. Graphing Exponential Functions Graphing Exponential Functions Graphing Exponential Functions with b > 1 Graph f x = ( ) 2 x Graphing Exponential Functions by hand. List input output pairs (see table) Input increases by 1 and output

More information

Section Parametrized Surfaces and Surface Integrals. (I) Parametrizing Surfaces (II) Surface Area (III) Scalar Surface Integrals

Section Parametrized Surfaces and Surface Integrals. (I) Parametrizing Surfaces (II) Surface Area (III) Scalar Surface Integrals Section 16.4 Parametrized Surfaces and Surface Integrals (I) Parametrizing Surfaces (II) Surface Area (III) Scalar Surface Integrals MATH 127 (Section 16.4) Parametrized Surfaces and Surface Integrals

More information

10.1 Curves Defined by Parametric Equations

10.1 Curves Defined by Parametric Equations 10.1 Curves Defined by Parametric Equations Ex: Consider the unit circle from Trigonometry. What is the equation of that circle? There are 2 ways to describe it: x 2 + y 2 = 1 and x = cos θ y = sin θ When

More information

Combinatorial Methods in Density Estimation

Combinatorial Methods in Density Estimation Luc Devroye Gabor Lugosi Combinatorial Methods in Density Estimation Springer Contents Preface vii 1. Introduction 1 a 1.1. References 3 2. Concentration Inequalities 4 2.1. Hoeffding's Inequality 4 2.2.

More information

HomeWork 4 Hints {Your Name} deadline

HomeWork 4 Hints {Your Name} deadline HomeWork 4 Hints {Your Name} deadline - 01.06.2015 Contents Power law. Descriptive network analysis 1 Problem 1.................................................. 1 Problem 2..................................................

More information

MATH 104 Sample problems for first exam - Fall MATH 104 First Midterm Exam - Fall (d) 256 3

MATH 104 Sample problems for first exam - Fall MATH 104 First Midterm Exam - Fall (d) 256 3 MATH 14 Sample problems for first exam - Fall 1 MATH 14 First Midterm Exam - Fall 1. Find the area between the graphs of y = 9 x and y = x + 1. (a) 4 (b) (c) (d) 5 (e) 4 (f) 81. A solid has as its base

More information

Math 14 Lecture Notes Ch. 6.1

Math 14 Lecture Notes Ch. 6.1 6.1 Normal Distribution What is normal? a 10-year old boy that is 4' tall? 5' tall? 6' tall? a 25-year old woman with a shoe size of 5? 7? 9? an adult alligator that weighs 200 pounds? 500 pounds? 800

More information

19 Random Number Distributions

19 Random Number Distributions Chapter 9: Random Number Distributions 87 9 Random Number Distributions This chapter describes functions for generating random variates and computing their probability distributions. Samples from the distributions

More information

Lecture 8: Jointly distributed random variables

Lecture 8: Jointly distributed random variables Lecture : Jointly distributed random variables Random Vectors and Joint Probability Distributions Definition: Random Vector. An n-dimensional random vector, denoted as Z = (Z, Z,, Z n ), is a function

More information

STAT 725 Notes Monte Carlo Integration

STAT 725 Notes Monte Carlo Integration STAT 725 Notes Monte Carlo Integration Two major classes of numerical problems arise in statistical inference: optimization and integration. We have already spent some time discussing different optimization

More information

Missing Data Analysis for the Employee Dataset

Missing Data Analysis for the Employee Dataset Missing Data Analysis for the Employee Dataset 67% of the observations have missing values! Modeling Setup Random Variables: Y i =(Y i1,...,y ip ) 0 =(Y i,obs, Y i,miss ) 0 R i =(R i1,...,r ip ) 0 ( 1

More information

Package esabcv. May 29, 2015

Package esabcv. May 29, 2015 Package esabcv May 29, 2015 Title Estimate Number of Latent Factors and Factor Matrix for Factor Analysis Version 1.2.1 These functions estimate the latent factors of a given matrix, no matter it is highdimensional

More information

CS CS 5623 Simulation Techniques

CS CS 5623 Simulation Techniques CS 4633 - CS 5623 Simulation Techniques How to model data using matlab Instructor Dr. Turgay Korkmaz This tutorial along with matlab s statistical toolbox manual will be useful for HW 5. Data collection

More information

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018

Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Getting started with simulating data in R: some helpful functions and how to use them Ariel Muldoon August 28, 2018 Contents Overview 2 Generating random numbers 2 rnorm() to generate random numbers from

More information