Home Loop for Stochastic equations
Reply: 0

Loop for Stochastic equations

user630
1#
user630 Published in April 25, 2018, 12:36 am

I would like to generate a sequence of stochastic equations for 100 different seed using the following expression:

set.seed(123)
N <- 100
  T <- 1
  x <- 10
  theta <- c (0 , 5 , 3.5)
  Dt <- 1 /N
  Y <- numeric (N +1)
  Y [1] <- x
  Z <- rnorm (N)
    for (i in 1: N)
    {Y[ i +1] <- Y[ i] + ( theta [1] - theta [2] * Y[ i ]) * Dt + theta [3] * sqrt ( Dt ) *Z [i ]
    Y <- ts (Y , start =0 , deltat =1 /N )

Finally, I want to save the 100 "Y" time series into a matrix.

How can I create a loop that save every value for "Y" time series?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297717 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO