[R] Help plotting a histogram of X~Exp(1)

David Winsemius dwinsemius at comcast.net
Sun Mar 22 14:09:52 CET 2009


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.

-- 
David Winsemius
On Mar 22, 2009, at 7:19 AM, BowlesMcCann wrote:

>
> 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.
> -- 
> View this message in context: http://www.nabble.com/Help-plotting-a-histogram-of-X%7EExp%281%29-tp22645091p22645091.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list