Help with rolling regression
Posted: Thu Dec 10, 2020 3:38 pm
Hi,
I am trying to do a rolling regression to find reasonable guess values for a Deibold and Li style dynamic factor model. I have a vector of "times to maturity" which I have creates as follows:
Then I want to run the following regression
Where yvars here is Tx7 matrix of yields. What I am trying to do is loop through time and run a regression of yvars on tau, and tau is transformed bases on the expressions above. However, I get the following error when executing the frml instruction:
The error message is rather informative, however, I don't know how to go about resolving it.
Note, I am aware that I don't need to use nlls here and can use the linreg instruction - I still get the same error when trying to compute or set the exogenous variables.
Any suggestions?
Adam
I am trying to do a rolling regression to find reasonable guess values for a Deibold and Li style dynamic factor model. I have a vector of "times to maturity" which I have creates as follows:
Code: Select all
dec vect tau(7)
dofor tenor = 40 1 4 4 8 1 8
compute tau(%doforpass) = tenor
end dofor tenor
Code: Select all
compute lambda1 = 0.06
nonlin b1 b2
frml ns = constant+b1*(1-exp(-lambda1*tau))/(lambda1*tau)+b2*((1-exp(-lambda1*tau))/(lambda1*tau)-exp(-lambda1*tau))
do i= 1, %nobs
nlls(frml = ns) %eqnxvector(yvars,i)
end do i
Where yvars here is Tx7 matrix of yields. What I am trying to do is loop through time and run a regression of yvars on tau, and tau is transformed bases on the expressions above. However, I get the following error when executing the frml instruction:
Code: Select all
Can't Find Match for EXP(MATRIX[REAL]). Possibilities are EXP(REAL)
## SX27. Illegal Combination of Data Types for Operation
>>>>1-exp(-lambda1*tau)<<<<
The error message is rather informative, however, I don't know how to go about resolving it.
Note, I am aware that I don't need to use nlls here and can use the linreg instruction - I still get the same error when trying to compute or set the exogenous variables.
Any suggestions?
Adam