[R] n Realizations of a Stochastic Process assigned to dynamically generated variable names?

From: Vishal Belsare <shoot.spam_at_gmail.com>
Date: Mon, 26 May 2008 00:32:57 +0530

I am interested in creating multiple (say 1000) time series, from a given stochastic process, of length 250. I want to refer to each realization with its own variable name, of the format say, tsn, where n is the n'th simulation. i.e. ts1, ts2, ts3, ts4, .... , ts1000

The way I am thinking of doing this is placing the following code within another loop, and the 'tsn' assignment should happen as ts1 and so on, the n being taken from the iteration of the outer loop. However, crucially, I don't know how/whether I can create variable names dynamically and assign values to them.


tsn <- (10);

for (i in 1:250) {

  tsn <- c(tsn, tsn[i] + rnorm(1, mean=0.01, sd=0.025))


plot.ts(tsn, lwd=2, col="maroon");


Thanks in anticipation.

Best Regards

Vishal Belsare

R-help_at_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. Received on Sun 25 May 2008 - 19:06:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 26 May 2008 - 18:30:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive