Hi everybody,
I am trying to generate two random walks with an specific correlation,
for example, two random walks of 200 time steps with a correlation 0.7.
I built the random walks with:
x<-cumsum(rnorm(200, mean=0,sd=1))
y<-cumsum(rnorm(200, mean=0,sd=1))
but I don't know how to fix the correlation between them.
With white noise is easy to fix the correlation using the function
rmvnorm in the package mvtnorm
I surfed in the web in the searchable mail archives in the R web site
but no references appears.
If you have some advices to solve this problems I would be very thankful.
Thanks in advance.
Sergio A. Estay
*CASEB *
Departamento de Ecología
Universidad Catolica de Chile
--
“La disciplina no tiene ningún mérito en circunstancias ideales. ” – Habor
Mallow
______________________________________________
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.