I have some problem in following part,
Code: Select all
set rs = uu(t)(1,1)
set rf = uu(t)(2,2)
set fs = (1+%exp(-L*rs{1}))^(-1)
set ff = (1+%exp(-L*rf{1}))^(-1)
gset F = ||fs,ff||
"## SX22. Expected Type REAL, Got MATRIX(REAL) Instead
>>>>xp(-L*rs{1}))^(-1)<<<<"
But I don't know how to revise these part.
Following is whole code.
Code: Select all
compute n=2
compute gstart=1,gend=1555
*
dec series[vect] Y
dec frml[vect] R
dec vect[series] U(n)
dec series[vect] ECT
*
*
* The paths of the covariance matrices and uu' are saved in the
* SERIES[SYMM] named H and UU. UX and HX are used for the current values
* of the residual vector and H matrices
*
declare series[symm] G uu
*
* ux is used when extracting a u vector
*
declare symm Gx(n,n)
declare vect ux(n)
*
* These will be the parameters for the mean equations. These are adjusted to add
* variance or covariance terms as needed.
*
dec vect F(n)
dec vect EC(n) C1(n) C2(n)
dec rect T1(n,n) T2(n,n) F1(n,n) F2(n,n)
nonlin(parmset=meanparms) EC C1 C2 T1 T2 F1 F2 L
*
* Mean model = VAR(1) with sqrt(G) "M" term
*
frml R = Y-EC.*ECT{1}-C1-C2.*F-T1*Y{1}-T2.*F*Y{1}-F1*%sqrt(%xdiag(G))-F2.*F*%sqrt(%xdiag(G))
*
gset Y = ||dLSP,dLF1M||
linreg LSP / ECTEQ
# LF1M
gset ECT = ||ECTEQ,ECTEQ||
*
* Run preliminary VAR(4) to get estimates of residuals
*
*
linreg dLSP / u(1)
# constant dLSP{1} dLF1M{1} ecteq{1}
linreg dLF1M / u(2)
# constant dLSP{1} dLF1M{1} ecteq{1}
*
linreg dLSP
# constant dLSP{1} DLF1M{1} u(1) u(2) ecteq{1}
compute C1(1)=%beta(1),C2(1)=%beta(1),$
T1(1,1)=%beta(2),T2(1,1)=%beta(2),$
T1(1,2)=%beta(3),T2(1,2)=%beta(3),$
F1(1,1)=%beta(4),F2(1,1)=%beta(4),$
F1(1,2)=%beta(5),F2(1,2)=%beta(5),$
EC(1)=%beta(6)
linreg dLF1M
# constant dLSP{1} dLF1M{1} u(1) u(2) ecteq{1}
compute C1(2)=%beta(1),C2(2)=%beta(1),$
T1(2,1)=%beta(2),T2(2,1)=%beta(2),$
T1(2,2)=%beta(3),T2(2,2)=%beta(3),$
F1(2,1)=%beta(4),F2(2,1)=%beta(4),$
F1(2,2)=%beta(5),F2(2,2)=%beta(5),$
EC(2)=%beta(6)
vcv(matrix=WWW)
# u
*
* These are used to initialize pre-sample variances.
*
gset G * gend = WWW
gset uu * gend = WWW
set u(1) = 0.0
set u(2) = 0.0
*
declare frml[symm] Gf
*
frml logl = $
Gx = Gf(t) , $
G(t) = Gx, $
ux = R , $
uu(t) = %outerxx(ux), $
%pt(u,t,ux),$
%logdensity(Gx,ux)
*
set rs = uu(t)(1,1)
set rf = uu(t)(2,2)
set fs = (1+%exp(-L*rs{1}))^(-1)
set ff = (1+%exp(-L*rf{1}))^(-1)
gset F = ||fs,ff||