Re: [R] generating lognormal variables with given correlation
This reference may be relevant for you: Connover, W.J., Iman, R.L. A distribution-free approach to inducing rank correlation among input variables. Technometric, 3, 311-334, 1982. Also, you may want to look at a more modern approach implemented in the copula package: install.packages("copula") library(help="copula") I hope this helps, Francisco, Karl Ove Hufthammer wrote: > Mollet, Fabian: > >> I would like these (lognormal distributed) parameters to be correlated, >> that is, I would like to have pairwise samples of 2 parameters with a >> given correlation coefficient. >> >> I have seen that a covariance matrix can be fixed when generating random >> variables from a multivariate normal distribution e.g. by the function >> mvrnorm. >> >> Is there a function to do the same for a multivariate lognormal >> distribution? > > I don't know about any, but you should be aware that not all values of the > correlation is possible with lognormal distributions. For example, if both > variables have a standard lognormal distribution, they can't have correlation > less than 1/e = -0.37. As the variance of the two distributions increase, the > absolute value of the maximum and minimum correlation possible decrease (to > zero). > > Using the normal product-moment correlation as a measure of dependence rarely > makes much sense unless the association between the variables is linear. > __ R-help@stat.math.ethz.ch 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.
Re: [R] generating lognormal variables with given correlation
Mollet, Fabian: > I would like these (lognormal distributed) parameters to be correlated, > that is, I would like to have pairwise samples of 2 parameters with a > given correlation coefficient. > > I have seen that a covariance matrix can be fixed when generating random > variables from a multivariate normal distribution e.g. by the function > mvrnorm. > > Is there a function to do the same for a multivariate lognormal > distribution? I don't know about any, but you should be aware that not all values of the correlation is possible with lognormal distributions. For example, if both variables have a standard lognormal distribution, they can't have correlation less than 1/e = -0.37. As the variance of the two distributions increase, the absolute value of the maximum and minimum correlation possible decrease (to zero). Using the normal product-moment correlation as a measure of dependence rarely makes much sense unless the association between the variables is linear. -- Karl Ove Hufthammer __ R-help@stat.math.ethz.ch 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.
[R] generating lognormal variables with given correlation
Dear R users I use simulated data to evaluate a model by sampling the parameters in my model from lognormal distributions. I would like these (lognormal distributed) parameters to be correlated, that is, I would like to have pairwise samples of 2 parameters with a given correlation coefficient. I have seen that a covariance matrix can be fixed when generating random variables from a multivariate normal distribution e.g. by the function mvrnorm. Is there a function to do the same for a multivariate lognormal distribution? Thank you! Fabian [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch 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.