Skip to content

Help plotting a histogram of X~Exp(1)

3 messages · BowlesMcCann, David Winsemius

#
I want to plot a histogram of X~Exp(1) where X is the sum of Y + Z. To do
this, should I simulate values of Y and Z using Y<-runif(100) and
Z<-runif(100)? And where do I go from there?

Many thanks.
#
If you run this you get sensible output, but whether it meets you  
needs depends on what you meant by Exp(1):

 > Y <- rnorm(100)
 > Z <- rnorm(100)
 > X <- exp(Y+Z)
 > hist(X)

If you are looking for methods to handle random variables in R, you  
may want to look at the series of packages all beginning with "distr":
    distr, distrDoc, distrEx, distrMod, distrSim, distrTeach, distrTEst.
#
Thank you very much!
 
:)
David Winsemius wrote:
:clap::clap::clap: