View Full Version : Transformations

jamesmartinn

07-12-2010, 12:01 AM

Hi!

Suppose X ~ U(0,1). If we let Y = -ln (x) and then find the density of Y, we get the exponential distribution (with rate parameter = 1).

Okay,

I'm running into problems translating it into english.

If X is an RV on (0,1), and we pick some subset, say (0.25, 0.75) and take the -ln and of those values and plot them, I should have something resembling an exponential curve? Is there an exercise that I can do in R that might make this more apparent?

Any elaboration on this would be extremely helpful! Your insights are appreciated.

You can show that the truncated uniform is also uniformly distributed.

i.e. The uniform random variable truncated on the interval (0.25, 0.75)

X \sim Uniform(0.25, 0.75)

\Rightarrow f_X(x) = 2, x \in (0.25, 0.75)

Now we have Y = -\ln X \Rightarrow X = e^{-Y}

\Rightarrow f_Y(y) = f_X(e^{-y})\left|\frac {dx} {dy} \right|

= 2e^{-y}, y \in (-\ln 0.75, -\ln 0.25)

So it resemble another truncated exponential curve.

vinux

07-12-2010, 10:49 AM

See the R code below:

x=runif(10000)

y=(x<.75) & (x>.25)

par(mfrow=c(2, 1))

breaks <- pretty(range(x), 20)

hist(x[y==1], breaks=breaks,col='red', main="Hist of truncated Unif(RED)")

hist(x[y==0], breaks=breaks, add=TRUE, col='green')

lbreaks <- -1* log(breaks+.00001)

hist(-1*log(x[y==1]), breaks=lbreaks, col='red', main="Hist of truncated Exponential(RED)")

hist(-1*log(x[y==0]), breaks=lbreaks, add=TRUE, col='green')

*Note: I am not a good R programmer. Ecologist or Tart can help you for efficient way to write the above code

jamesmartinn

07-12-2010, 03:12 PM

Oh, fantastic. Thank you both!

I was also wondering if you knew of a source (book, course website, etc) that had something like an introduction / elementary probability with the use of a computer package for demonstration/simulation purposes.

I'm trying to fill in a lot of the gaps in my background before I start my masters this Sept.

Thanks again guys, you rock!

Cheers

I have used the book of Paolella "Intermediate Probability: A Computational Approach". It has Matlab & R code. Unfortunatelly, the price is high (~$160), but otherwise recommended... ;(

http://www.amazon.com/Intermediate-Probability-Computational-Marc-Paolella/dp/0470026375

The book:

Places great emphasis on the numeric computation of convolutions of random variables, via numeric integration, inversion theorems, fast Fourier transforms, saddlepoint approximations, and simulation.

Provides introductory material to required mathematical topics such as complex numbers, Laplace and Fourier transforms, matrix algebra, confluent hypergeometric functions, digamma functions, and Bessel functions.

Presents full derivation and numerous computational methods of the stable Paretian and the singly and doubly non-central distributions.

A whole chapter is dedicated to mean-variance mixtures, NIG, GIG, generalized hyperbolic and numerous related distributions.

A whole chapter is dedicated to nesting, generalizing, and asymmetric extensions of popular distributions, as have become popular in empirical finance and other applications.

Provides all essential programming code in Matlab and R.

Visit : Site (http://www.statsravingmad.com/)|Stats Blog (http://www.statsravingmad.com/blog)|Personal mini-site (http://parzakonis.info/)

Contact : Contact (http://www.statsravingmad.com/contact/)

Powered by vBulletin™ Version 4.1.3 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.