
Hi,
I'm wondering if it's possible to recursively calculate 'var1' as shown in the following example in IRIS. All variables are tseries objects.
e.g.
var1(date range) = var1{1} + var2(and other calculations)
The "+ var2" part here is just for illustration, it could be any kind of calculations.
Many thanks.


Coordinator
Jun 6, 2014 at 8:27 PM
Edited Jun 6, 2014 at 8:34 PM

Yes. Use the function arf (type help tseries/arf to see help on this function).
In general, if you want to evaluate recursively an expression like
x = a1 x{1} + a2 x{2} + ... + ak x{k} + y
you call the function in the following way:
x = arf(x,[1,a1,a2,...,ak],y,range)
where range is the range on which the expression will be evaluated; of course, the initial values must exist in the tseries object
x before you run this function. Note also how the autoregressive polynomial is entered:
[1,a1,a2,...,ak] .
In your particular example, you'd run
var1 = arf(var1,[1,1],var2,date_range);
Hope this helps.
Best,
Jaromir



Many thanks, Jaromir. It definitely helps!
Can you apply other functions for var1, for example:
var1(date_range) =exp(var1{1}) + var2



or this
var1(date_range) = log((var2+1) * exp(var1{1}))
Thanks a lot!


Coordinator
Jun 6, 2014 at 9:17 PM

Unfortunately, the function arf only works for linear models at the moment.
But I can create a general function that would evaluate any recursive expression. Feel free to submit a request for such a function.
Best,
Jaromir



Thank you very much Jaromir. Will submit a request.

