s-news
[Top] [All Lists]

[S] Re: generating time lag-data

To: jdavis@pdf.com, s-news@wubios.wustl.edu
Subject: [S] Re: generating time lag-data
From: Tim Downie <tim.downie@cmis.csiro.au>
Date: Thu, 30 Dec 1999 13:42:51 +1100
Sender: owner-s-news@wubios.wustl.edu
> Dear S-news,
> 
> I am trying to simulate values from a simple (right now, anyway) delay
> model. For instance, X[i] = 1 + A*X[i-1] + B*X[-2]. Of course, I can
> generate these using loops, etc, but I'm pretty sure that I can get the
> Splus time-series or filter functions to do this for me in a more
> elegant fashion.
> 
> There seems to be a function 'arima.sim', but I can't quite get it to do
> what I want, including not adding any random noise.
> 
> Can someone point me in the right direction?
> 
> Thank you very much!
Hi,

If you don't have random noise then you just have a difference equation,
so there are (probably) analytical techniques for you to compute the
sequence directly, at least to within a certain approximation.
Also if A and B are in (-1,1) the sequence is convergent and appears
to converge very quickly. So I'm wondering why you want to generate such
a
"time series".

Anyway to answer your question directly, you can use arima.sim.
one of the arguments is rand.gen, which is by default the function
rnorm. 
Instead you want an ar(A,B) process where the random component is
replaced by the
value 1 each time. So create a simple function
S> rep1<-function(n)
+ rep(1,n)

and then pass rep1 in as the rand.gen ie
S>arima.sim(n=200,model=list(ar=c(A,B)),rand.gen=rep1)
you will proabaly want to play about with the start.innov argument
as well.

Cheers
Tim

-- 
Tim Downie
Analysis of Large and Complex Datasets Project
CSIRO Mathematical and Information Sciences   
Locked Bag 17, North Ryde, NSW 1670, Australia   
Phone: +61 2 9325 3256  Fax: +61 2 9325 3200
    
email:tim.downie@cmis.csiro.au, 
url:http://www.dms.csiro.au/~timd/research.html
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

<Prev in Thread] Current Thread [Next in Thread>
  • [S] Re: generating time lag-data, Tim Downie <=