# Time as an endogenous variable

Hi,

y=theta+e
Suppose part of my model is thetabar, which is an average past y up to this point : y1+y2+y3…+yt/t
To do this time is an endogenous variable t=t(-1)+1
However time is not stationary, has no deterministic steady state.

Is there a way to do this?

I understand there is a trend option for the observational variable. But I don’t think it works here. This is a calibration, no data imported, ie. y does not come from data and there is no datasheet to be imported for y. y has its own dynamic evolution equation.

If I understand you correctly, there is no way to do this as there is no way to stationarize your model. In the way you wrote it down, thetabar has infinite memory. In particular, the sum is dependent on the number of time periods since the system started. Moreover, as t goes to infinity thetabar should converge to the long-run/ergodic mean and should not be influenced by new observations. In this case, the model itself becomes stationary again, but I guess you are not interested in the limit case.

Are you sure you don’t want to take some kind of moving average. What you describe sounds like a learning model. You either assume a fixed memory and take the average over the last T observations with e.g.:

``````@#define T = 20
thetabar(0) = 1/@{T} * (
@#for index in 0:( T - 1 )
y(-@{index}) +
@#endfor
0 );``````

Or you run constant gain learning with:

``thetabar(0) = (1-gamma)*thetabar(-1)+gamma*y(0);``

Tom