Some R packages that might be handy
For the Weibull distribution you can sample from this directly using
rweibull, and for the log-normal you can use
rlnorm. (In R-studio you can just search for these in the help-tab).
If you want some arbitrary distribution
One way of generating from an arbitrary distribution without rejection is the inverse transformation method. All you need to be able to do this is have access to the inverse cumulative distribution function. If you don't happen to have this function but do have access to the cumulative distribution function then you can approximate the inverse using the
inverse function (from the "GoFKernel" package). If you don't have access to that but only have the probability density function you can approximate the cumulative distribution function (this can be done using your favourite integration package).
If you want a vector of random variables with a given correlation structure
If you want to jointly sample several random variables which are identically distributed with a certain correlation matrix between them, then for certain distributions you can achieve this by a matrix multiplication, as described in a previous answer of mine to Quasi Random Monte Carlo in m.v. portfolio optimization.
If your distribution doesn't come from such a convenient distribution, which in general you shouldn't expect it to, then how to jointly sample from this is a separate question in its own right. Much of this is answered by studying "copulas" (cf. Using Uniform Distribution to Generate Correlated Random Samples in R
), and in R an example of this can be found in fCopulae (cf.
rellipticalCopula).Some resources include (copied from an answer to a related question)
- R. B. Nelsen, An Introduction to Copulas, Second Edition, Springer Verlag, 2006.
- D.D. Mari and S. Kotz, Correlation and Dependence, Imperial College Pres, 2004.
- H. Joe, Multivariate Models and Dependence Concepts, Chapman and Hall, 1997.
I don't think you want either the Weibull or log-normal for modelling your returns
"Based on historical asset prices, the asset returns (bonds) appear to be more similar to a lognormal or weibull distribution."
I am not sure how the returns can be modelled by these, as these are strictly positive, and have an immediate skew, whereas returns are in reality often not so readily skewed, but just typically have fatter tails, and are often negative. Perhaps a $t$-distribution might better suit your needs.