Dear list,
I have the following problem, what i'm trying to do is to built a function which does the following calculationg in a recursive way:
I have a data frame more or less like this:
variable year DELTA
EC01 2006 /
EC01 2007 10
EC01 2008 5
EC01 2009 9
And then I have at time 2009 a variable called R_EC01(2009)=5
What I have to do is to construct the R_EC01 time series by starting from the 2009 value:
R_EC01(2008)=R_EC01(2009)-DELTA(2009)
R_EC01(2007)=R_EC01(2008)-DELTA(2008)
R_EC01(2006)=R_EC01(2007)-DELTA(2007)
In terms of number, the results that i should get are:
R_EC01(2008)=5-9=-4
R_EC01(2007)=-4-5=-9
R_EC01(2006)=-9-10=-19
so my data frame should looks like this
SERIES YEAR value
R_EC01 2006 -19
R_EC01 2007 -9
R_EC01 2008 -4
R_EC01 2009 5
Anyone Knows hot to do it??
My dataframe is not set as a time series...
Thanks a lot!!!
[[alternative HTML version deleted]]