MS Regression Time Varying TP Overwriting the Transition Mat
Posted: Wed Jul 27, 2016 9:29 am
Hello Tom,
I am quiet new on RATS and have to estimate a TVTP MS model of the following form:
Number of states: 2
deurchf=a_t +e_t, e_t~N(0, sigma^2_t)
deurchf is the first difference of the exchange rate, a_t is an intercept which is switching between state 1 and state 2. The variance sigma^2 is also switching between state 1 and state 1.
My FTP code is the following:
Now I have the following variable for the TVTP: drreur1m
I tryed to use the code and suggestions of the following post: https://estima.com/forum/viewtopic.php? ... vtp#p11162
Here is the TVTP code I wrote:
The estimates are the following:
What did I do wrong? Could you send me any example code which is doing tvtp estimates and which is simple? I tryed to read the Filardo(1994) replication code, but it is very complicated for someone who is new to RATS.
Thank you very much for your help!
Best
Jules
I am quiet new on RATS and have to estimate a TVTP MS model of the following form:
Number of states: 2
deurchf=a_t +e_t, e_t~N(0, sigma^2_t)
deurchf is the first difference of the exchange rate, a_t is an intercept which is switching between state 1 and state 2. The variance sigma^2 is also switching between state 1 and state 1.
My FTP code is the following:
Code: Select all
@MSREGRESSION(States=2, Switch=CH) DEURCHF
# Constant
nonlin(parmset=regparms) betas sigsqv gammas
nonlin(parmset=msparms) p
compute gstart=2011:09:06,gend=2015:12:15
@MSRegInitial gstart gend
compute sigmalimit=1.e-6*%minvalue(sigsqv)
frml logl = f=%MSRegFVec(t),fpt=%MSProb(t,f),log(fpt)
@MSFilterInit
maximize(start=%(sigmatest=%MSRegInitVariances(),pstar=%msinit()),$
parmset=regparms+msparms,$
reject=sigmatest<sigmalimit,$
method=bfgs) logl gstart gend
I tryed to use the code and suggestions of the following post: https://estima.com/forum/viewtopic.php? ... vtp#p11162
Here is the TVTP code I wrote:
Code: Select all
source msregression.src
@MSREGRESSION(States=2, Switch=CH) DEURCHF
# Constant
nonlin(parmset=regparms) betas sigsqv gammas
nonlin(parmset=tvtpparms) d10 d11 d20 d21
*************Overwiting the Transition Matrix:**************
frml pfrml = %cdf(d10+d11*drreur1m)
frml qfrml = %cdf(d20+d21*drreur1m)
function %MSRegPMat time
type rect %MSRegPmat
type int time
*
compute %MSRegPMat=||pfrml(time),1-qfrml(time)|1-pfrml(time),qfrml(time)||
end
**************************************************************
*Guess values for the first iteration drawn from the FTP Model:
compute d10 = 1.845
compute d20 = -1.21
compute gstart = 2011:09:06
compute gend = 2015:12:15
@MSRegInitial gstart gend
compute sigmalimit=1.e-6*%minvalue(sigsqv)
frml logl = fpt=%MSRegProb(t),log(fpt)
@MSFilterInit
maximize(start=%(sigmatest=%MSRegInitVariances(),pstar=%msinit()),$
parmset=regparms+tvtpparms,$
reject=sigmatest<sigmalimit,$
method=bfgs,pmethod=simplex,piters=5) logl gstart gend
Code: Select all
MAXIMIZE - Estimation by BFGS
Convergence in 14 Iterations. Final criterion was 0.0000085 <= 0.0000100
Daily(5) Data From 2011:09:07 To 2015:12:15
Usable Observations 1115
Function Value 4806.6321
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. BETAS(1)(1) -0.000206005 0.000050549 -4.07534 0.00004595
2. BETAS(2)(1) 0.000107612 0.000459697 0.23409 0.81491235
3. SIGSQV(1) 0.000001883 0.000000171 10.98407 0.00000000
4. SIGSQV(2) 0.000121085 0.000010378 11.66757 0.00000000
5. D10 1.845000000 0.000000000 0.00000 0.00000000
6. D11 0.000000000 0.000000000 0.00000 0.00000000
7. D20 -1.210000000 0.000000000 0.00000 0.00000000
8. D21 0.000000000 0.000000000 0.00000 0.00000000
Thank you very much for your help!
Best
Jules