{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

531f10RVG

# 531f10RVG - STAT 531 Random Variable Generation HM Kim...

This preview shows pages 1–7. Sign up to view the full content.

STAT 531: Random Variable Generation HM Kim Department of Mathematics and Statistics University of Calgary Fall 2010 1/27

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Standard Distributions with R Core Name distribution core parameter default values Beta beta shape1, shape2 Binomial binom size, prob Cauchy cauchy location, scale 0, 1 Chi-square chisq df Exponential exp 1/mean 1 F f df1, df2 Gamma gamma shape, 1/scale NA, 1 Geometric geom prob Hypergeormetric hyper m, n, k Log-normal lnorm mean, sd 0, 1 Logistic logis location, scale 0, 1 Normal norm mean, sd 0, 1 Poisson pois lambda Student t df Uniform unif min, max 0, 1 Weibull weibull shape Fall 2010 2/27
Transformation Methods , The Inverse Transform : Transform any random variable into a uniform random variable, vice versa. If X has density f and cumulative density function (cdf) F , then we have the relation F ( x ) = Z x - f ( t ) dt and if we set U = F ( X ), then U is a random variable distributed from a uniform (0,1). The inverse probability transformation is just the inverse of this: if U unif (0 , 1), X = F - 1 X ( U ) X has cumulative distribution function F X . Fall 2010 3/27

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
, Example : If X Exp (1), then F ( x ) = 1 - e - x . Solving for x in u = 1 - e - x gives x = - log(1 - u ). Therefore, if U unif (0 , 1), then X = - log( U ) Exp (1) In R , > Nsim <- 10^4 > U <- runif (Nsim) > X <- - log(U) > Y <- rexp(Nsim) > par(mfrow=c(1,2)) > hist(X, freq=F, main= "Exp from Uniform") > hist(Y, freq=F, main= "Exp from R") Fall 2010 4/27
Fall 2010 5/27

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
, Transformation : If X Exp (1), then Y = 2 v j =1 X j χ 2 2 v Generate χ 2 6 ( v = 3) random variable. > Nsim <- 3*10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 27

531f10RVG - STAT 531 Random Variable Generation HM Kim...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online