A question regarding recursion

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

A question regarding recursion

chalam
This is part of a bigger  non linear estimation. If I can figure this out, I will be able to run that estimation.

I have a variable A and a constant alpha.

I need to compute B, initial B is 0.

B(t) = B(t-1) + alpha * (A(t-1) - B(t-1))

i.e.

B = Lag(B) + alpha * (A - Lag(B))

I tried
Compute B = 0.
Compute B = Lag(B) + alpha*(A- Lag(B)).
Execute.

I couldn't get anywhere.
Reply | Threaded
Open this post in threaded view
|

Re: A question regarding recursion

Bruce Weaver
Administrator
Is this what you have in mind?

* Generate some data for testing.
NEW FILE.
DATASET CLOSE all.
DATA LIST free / t (F2.0).
BEGIN DATA
0 1 2 3 4 5 6 7 8 9
END DATA.

* Set alpha = a constant value.
COMPUTE alpha = 2.5.
* A is a variable.  
COMPUTE A = RV.NORMAL(50,10).

DO IF $casenum EQ 1. /* t = 0.
- COMPUTE B = 0.
ELSE. /* t > 0.
- COMPUTE B = Lag(B) + alpha * (A - Lag(B)).
END IF.
LIST.

Output:

t    alpha        A        B
 
 0     2.50    61.13      .00
 1     2.50    53.21   133.03
 2     2.50    53.91   -64.78
 3     2.50    55.63   236.23
 4     2.50    44.16  -243.96
 5     2.50    69.55   539.80
 6     2.50    42.00  -704.70
 7     2.50    45.18  1170.00
 8     2.50    35.20 -1667.00
 9     2.50    50.10  2625.76



chalam wrote
This is part of a bigger  non linear estimation. If I can figure this out, I will be able to run that estimation.

I have a variable A and a constant alpha.

I need to compute B, initial B is 0.

B(t) = B(t-1) + alpha * (A(t-1) - B(t-1))

i.e.

B = Lag(B) + alpha * (A - Lag(B))

I tried
Compute B = 0.
Compute B = Lag(B) + alpha*(A- Lag(B)).
Execute.

I couldn't get anywhere.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: A question regarding recursion

chalam
Thanks Bruce, this is pretty close to what we had in mind. Our next step is to estimate that alpha - which is easy in NLP program.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: A question regarding recursion

David Marso
Administrator
In reply to this post by chalam

Where do A and alpha come from?
Where do actual data fit into this scheme?
I'll bet you could program it with the MATRIX facility?
That is where I would go.
You might consider providing additional context.
---
quote author="chalam">
This is part of a bigger  non linear estimation. If I can figure this out, I will be able to run that estimation.

I have a variable A and a constant alpha.

I need to compute B, initial B is 0.

B(t) = B(t-1) + alpha * (A(t-1) - B(t-1))

i.e.

B = Lag(B) + alpha * (A - Lag(B))

I tried
Compute B = 0.
Compute B = Lag(B) + alpha*(A- Lag(B)).
Execute.

I couldn't get anywhere.

Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"