large panel dynamic factor model
Posted: Tue Jul 09, 2013 9:40 am
Hi
I am working on dynamic factor models, using sspace and a large panel of time series as observation variables, and I am looking for a method to define the signal and state equations within loops.
The problem is as follows:
in matrix notation the observation equation is:
X(t) = A*F(t) + e(t), where the dimensions are: X(t) - nx1, A - nxr, F(t) - rx1, e(t) - nx1
and the state equation is:
F(t) = B*F(t-1) + u(t), where the dimensions are: B - rxr (or r*lags x r*lags if I have more lags), u(t) - qx1
thus, I have to specify n signal equations with r+1 (r columns of F plus constant term) terms plus the error term
and r state equations with r terms plus the error term
Specifying the n and r equations accordingly doesn't seem to be a problem as I use the following for example:
for !i = 1 to !n
' define observation equation
ss1.append @signal sig{!i} = c({count1}) + c({count2})*sv_1 + c({count3})*sv_2 + e{!i}
next
where count1 etc come from previous calculations where I keep track of the total number of parameters. The problem seems to be the specification of the RHS terms. Here I have only 2+1+1 terms, but how do I deal with r+1+1 terms? That is, can I create a loop where I give r as input and it gives:
ss1.append @signal sig{!i} = c({count1}) + c({count2})*sv_1 + c({count3})*sv_2 +...+ c({count(r-1)})*sv_r + e{!i}
I had posted a related enquiry under ‘increasing number of regressors’ where I wanted to add terms on the RHS of the regression equation and the trick was to regress the LHS on a group of series, RHS, where RHS was constructed using RHS.add nameofseries in a loop.
Hence, I am looking for a similar way to create the right hand side of the @signal and @state equations.
I would appreciate any help.
Cheers
I am working on dynamic factor models, using sspace and a large panel of time series as observation variables, and I am looking for a method to define the signal and state equations within loops.
The problem is as follows:
in matrix notation the observation equation is:
X(t) = A*F(t) + e(t), where the dimensions are: X(t) - nx1, A - nxr, F(t) - rx1, e(t) - nx1
and the state equation is:
F(t) = B*F(t-1) + u(t), where the dimensions are: B - rxr (or r*lags x r*lags if I have more lags), u(t) - qx1
thus, I have to specify n signal equations with r+1 (r columns of F plus constant term) terms plus the error term
and r state equations with r terms plus the error term
Specifying the n and r equations accordingly doesn't seem to be a problem as I use the following for example:
for !i = 1 to !n
' define observation equation
ss1.append @signal sig{!i} = c({count1}) + c({count2})*sv_1 + c({count3})*sv_2 + e{!i}
next
where count1 etc come from previous calculations where I keep track of the total number of parameters. The problem seems to be the specification of the RHS terms. Here I have only 2+1+1 terms, but how do I deal with r+1+1 terms? That is, can I create a loop where I give r as input and it gives:
ss1.append @signal sig{!i} = c({count1}) + c({count2})*sv_1 + c({count3})*sv_2 +...+ c({count(r-1)})*sv_r + e{!i}
I had posted a related enquiry under ‘increasing number of regressors’ where I wanted to add terms on the RHS of the regression equation and the trick was to regress the LHS on a group of series, RHS, where RHS was constructed using RHS.add nameofseries in a loop.
Hence, I am looking for a similar way to create the right hand side of the @signal and @state equations.
I would appreciate any help.
Cheers