Would appreciate some help figuring out what's causing the errors.
I'm trying to put together a state-space model with all coefficients/variances already estimated, in order to use Eviews Kalman filter/smoother.
For some (but not all) combinations of my 200-300 signal variables I get "matrix near singular" errors while trying to initialize/estimate the state-space model.
I'm not sure what it's trying to estimate other than the final state vector, which I can try to estimate on my own using Kalman filter formulas and it works w/o a hitch (I do have to use @pinverse though, due to signal idiosyncratic error covariance matrix being rank-deficient).
A attach a small example workfile.
Estimating statespace 'now' on a sample of 1993m1 1993m1 yields the error.
Running the code below to calculate the final state works fine (and produces something fairly close to Eviews calculations for specifications where now.ml does not fail)
Code: Select all
'--------------------Estimate a couple of Kalman filter steps------------------.
' Filter notation:
vector(2) ksi1_0=0 'initial state
sym P1_0=@unvec(@inverse(@identity(4)-@kronecker(a1,a1))*@vec(sigmah),2) 'initial state MSE
matrix(dim,dim) K1=F*P1_0*H*@pinverse(@transpose(H)*P1_0*H+R) 'Kalman gain period 1
sample testsmpl 1993m1 1993m1
stomna(endog,y1,testsmpl) 'y1-vector of signals on 1993m1
vector(2) ksi2_1=F*ksi1_0+K1*(@transpose(y1)-@transpose(H)*ksi1_0) 'state forecast on 1993m2
sym P2_1=(F-K1*@transpose(H))*P1_0*(@transpose(F)-H*@transpose(K1))+K1*R*@transpose(K1)+Q 'state MSE on 1993m2
Thanks in advance to anyone who can help.
PS: my signal idiosyncratic error covariance matrix is rank-deficient in most specifications, even when now.ml goes w/o error.