On Apr 1, 2010, at 9:56 AM, [email protected] wrote:

Hi,
I need to generate the time series of the production, but as I'm new to this topic I am not able to do that. This is what the time series should be:

PROD(t)=PROD(t,T)
PROD(t-1)=PROD(t-1,T)
PROD(t-2)=PROD(t-1)*PROD(t-2,T-1)/PROD(t-1,T-1)
PROD(t-3)=PROD(t-2)*PROD(t-3,T-2)/PROD(t-2,T-2)

It would make more sense to give a name to the LHS series that was different than the (higher dimensional) data input.

...
...
...
from PROD(t-2)...it will get the same expression; where PROD(t,T) is the value
of the production at t for the sample of firms presented at T and T-1;
Someone knows how to get it???

You have not provided a reproducible example from which to proceed (and have not even used correct R syntax in what you request), but it appears you will probable get success with matrix indexing that generates diagonal or sub-diagonal series processed with the cumprod function.

> PROD <- matrix(1:25, nrow=5)
[4,]    9   14   19   24
> PROD[row(PROD)==col(PROD)+1]
[1]  2  8 14 20

> cumprod(PROD[row(PROD)==col(PROD)+1])
[1]    2   16  224 4480

#cumulative product of first sub-diagonal.

--
David Winsemius.

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to