Generating multiple arma models

Hi,

I'm trying to generate 100 ar(1) models with correlation 1 and standard normal white noise, each with different seeds/initial values.

I can't seem to find a way to repeat the arima.sim command 100 times (with n also 100) to create a 100*100 matrix of data (each of the 100 data sets having a different y0).

What would be the best way to do this? I'm a complete beginner so would be very appreciative if someone could share the full code.

Many thanks!

Hello Anton,
I know a good amount about R but not so much about arma models :frowning: , so I'll make you a deal, if you give me the code to do one simulation, I'll give you code to do it 100 times :slight_smile:
deal ?

Here's an example where we generate 3 replications of a time series of length 5:

replicate(3, arima.sim(n = 5, list(ar = 0.5)))
#>            [,1]        [,2]       [,3]
#> [1,]  0.3317528  0.45128945 -0.7448801
#> [2,] -1.0320203 -0.01145362 -1.0386216
#> [3,] -0.7867396  1.13977269 -0.2131131
#> [4,] -0.2833714  2.87683788 -0.6263452
#> [5,]  0.2448601  0.04664901 -0.5471205

Created on 2020-02-26 by the reprex package (v0.3.0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.