Looping over two sets of series
Looping over two sets of series
Hi all - long time reader first time questioner. Lol.
Let's say I have two sets of conformal series: A1 A2 A3....AT and B1 B2 ... BT
T i s a large number, so I don't want to repeat the same bit of instructions for all T
I want to perform an instruction - let's say its an RREG command, with A1 on the lhs and B1 on the rhs, save some results (specifically, i want the conditional distribution of B_i on A_i) and then go to A_i+1 to B_i+1, through to AT on BT. I would use two DOFOR loops, but I don't want to loop trhough all of B1, B2, through BT ontn A1, just so A_i is equal to B_i.
Can anyone suggest some code, please. Thanks.
Let's say I have two sets of conformal series: A1 A2 A3....AT and B1 B2 ... BT
T i s a large number, so I don't want to repeat the same bit of instructions for all T
I want to perform an instruction - let's say its an RREG command, with A1 on the lhs and B1 on the rhs, save some results (specifically, i want the conditional distribution of B_i on A_i) and then go to A_i+1 to B_i+1, through to AT on BT. I would use two DOFOR loops, but I don't want to loop trhough all of B1, B2, through BT ontn A1, just so A_i is equal to B_i.
Can anyone suggest some code, please. Thanks.
Re: Looping over two sets of series
Are they actually named An and Bn for different values of n? That would make it easier as you could use %S("a"+i) and %S("b"+i) to refer to the series in the <<i>> iteration of a loop.
Re: Looping over two sets of series
i could easily create the series names to be A1 A2 etc and B1 B2 etc.
However, wouldn't two dofor loops still index A1, A2...AT on B1,, and then A1 A2 ...AT on B2, etc?
The A's are spot currencies, and the Bs are implied vols... I want to look at the vols conditioned on same currency spots. so AUD vol on AUD spot, BRL vol on BRL spot etc down through ZAR (if you can imagine they are in alphabetical order, for example).
However, wouldn't two dofor loops still index A1, A2...AT on B1,, and then A1 A2 ...AT on B2, etc?
The A's are spot currencies, and the Bs are implied vols... I want to look at the vols conditioned on same currency spots. so AUD vol on AUD spot, BRL vol on BRL spot etc down through ZAR (if you can imagine they are in alphabetical order, for example).
Re: Looping over two sets of series
No. You would want just a single loop. Something like:
dec VECTOR betas(N)
DO I=1,N
RREG %S("A"+I)
# constant %S("B"+I)
compute betas(i)=%beta(2)
END DO I
would save the RREG slope coefficients.
dec VECTOR betas(N)
DO I=1,N
RREG %S("A"+I)
# constant %S("B"+I)
compute betas(i)=%beta(2)
END DO I
would save the RREG slope coefficients.