On Mon, May 14, 2012 at 11:15:18PM -0700, davewiz wrote: > Hello, I'm a new user to R and need some help coding a mathmatically simple > aggregation of normal distributions. I have three normal distributions: > A ~ N(8.51, 4.24^2) > B ~ N(7.57, 3.62^2) > C ~ N(10.84, 6.59^2) > with correlation coefficients of: > rho(AB) = 0.710 > rho(AC) = 0.263 > rho(BC) = 0.503 > and I want to simulate Z = A + B + C, showing the results on a plot and > fitting a distribution to the simulated data.
Hi. First, derive the covariance matrix for the joint distribution. Then, use the formulas from section Affine transformation of http://en.wikipedia.org/wiki/Multivariate_normal to derive the mean and variance of the variable A + B + C. Taking a sum of coordinates is an affine transformation represented by the matrix with one row of all ones, i.e. B = (1, 1, 1) For generating Z, use the function rnorm(), for computing the sample mean and sample estimate of the standard deviation, use functions mean() and sd(). Hope this helps. Petr Savicky. ______________________________________________ R-help@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.