Skip to content
Prev 307680 / 398503 Next

Help on probability distribution question

On 11-Oct-2012 17:22:44 Andras Farkas wrote:
If I understand your question correctly, if Y is the variable being
simulated then you know the mean (M, say) and the variance (V, say)
of log(Y). So you can simulate X from a normal distribution with
mean M and variance V = S^2 (S = SD of X), and then Y = exp(X):

  Y <- exp(rnorm(n,M,S))

where n is the number of sampled values you want.

When Y is multivariate, with M the vector of means and V the
covariance matrix of log(Y), then use a similar approach with
the function mvrnorm() from the MASS package:

  library(MASS)
  Y <- mvrnorm(n,M,V)

Does this help?
Ted.

-------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
Date: 11-Oct-2012  Time: 18:51:47
This message was sent by XFMail