msVAR estimation is not estimating the transition matrix probability
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
Hi all,
I have been trying to estimate a 3-variable, 5-lag and 2-state MSVAR model using the following code:
msTbl = table(del_sent,del_cci,del_bci);
msMat = table2array(msTbl)
cons1 = [NaN; NaN; NaN]
AR31 = {[NaN NaN NaN; NaN NaN NaN; NaN NaN NaN] [NaN NaN NaN; NaN NaN NaN; NaN NaN NaN] [NaN NaN NaN; NaN NaN NaN; NaN NaN NaN] [NaN NaN NaN; NaN NaN NaN; NaN NaN NaN] [NaN NaN NaN; NaN NaN NaN; NaN NaN NaN]};
Sigm = NaN(3);
mdl1 = varm(Constant=cons1,AR=AR31,Covariance=Sigm);
mdl2 = varm(Constant=cons1,AR=AR31,Covariance=Sigm);
p = NaN(2)
mc = dtmc(p)
mdl = msVAR(mc,[mdl1; mdl2]);
% Initial values to start the estimation %
p0 = [0.5 0.5; 0.5 0.5];
mc0 = dtmc(p0);
c3 = [0; 0; 0];
AR3 = {[1 0 0; 0 1 0; 0 0 1] [1 0 0; 0 1 0; 0 0 1] [1 0 0; 0 1 0; 0 0 1] [1 0 0; 0 1 0; 0 0 1] [1 0 0; 0 1 0; 0 0 1]};
Sigma1 = 3*eye(3);
mdl01 = varm(Constant=c3,AR=AR3,Covariance=Sigma1);
mdl02 = varm(Constant=c3,AR=AR3,Covariance=Sigma1);
mdl0 = msVAR(mc0,[mdl01; mdl02]);
% Final estimation of MSVAR %
modest = estimate(mdl,mdl0,msMat);
summarize(modest)
'msMat' is my dataset with the three variables. As the model mandates initialization of model parameters, I am initializing the model with a square matrix with '0.5' as the value accross transition matrix. The videos on youtube and the tutorials i could find indicate that the model estimation would eventually estimate the true transition matrix. However, in my case the transition matrix is being fixed to the intitial specification and is not changing to true transition values post the estimation. I would really appreciate any help to solve this problem. Thank you. 
댓글 수: 0
답변 (1개)
  TARUN
 2025년 4월 25일
        If you're setting a transition matrix with fixed values (like 0.5), “MATLAB” interprets this as a fixed transition matrix which won’t be estimated. 
So, to estimate the transition probabilities, you need to set the transition matrix in “dtmc” to “NaN” values, like how you're doing for the “AR” and constant terms.  
Here's how you can modify your code: 
% Initial values to start the estimation 
p0 = NaN(2);  % Transition matrix elements to be estimated 
mc0 = dtmc(p0); 
c3 = [0; 0; 0]; 
AR3 = repmat({eye(3)}, 1, 5);  % 5 lags, each  with identity matrix 
Sigma1 = 3*eye(3);  
mdl01 = varm(Constant=c3, AR=AR3,  
Covariance=Sigma1); 
mdl02 = varm(Constant=c3, AR=AR3,  
Covariance=Sigma1); 
mdl0 = msVAR(mc0, [mdl01; mdl02]);  
% Final estimation of MSVAR 
modest = estimate(mdl, mdl0, msMat); 
summarize(modest) 
Feel free to learn more about “msVAR” here: 
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

