Transition or migration matrices in RatS

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
Aqu_nb

Re: Transition or migration matrices in RatS

Unread post by Aqu_nb »

sorry the matrix looks like:


0.39581 0.07705 0.01245 0.00205 0.00085 0.00013 0.01165
0.04980 0.32419 0.09470 0.01749 0.00290 0.00045 0.01046
0.00463 0.05876 0.32108 0.08518 0.01558 0.00227 0.01250
0.00092 0.01041 0.09079 0.28290 0.08201 0.01024 0.02273
0.00034 0.00204 0.02927 0.14299 0.22622 0.05427 0.04488
0.00002 0.00017 0.00232 0.02726 0.08753 0.29964 0.08306

and the rows and colums does not add to 1 or 100 %?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Transition or migration matrices in RatS

Unread post by TomDoan »

The rows are adding to 1/2 rather than 1 which is very puzzling. It looks like you need to send the program and data file to support@estima.com so we can try to run it and see what's going on. That should work.
Aqu_nb

Re: Transition or migration matrices in RatS

Unread post by Aqu_nb »

Aqu_nb wrote:
TomDoan wrote:display transit

will do that.
Yes it works. But the problem now is that the rows or colums does not sum 1 (100%). The ouput looks like following:

1 2 3 4 5 6 Default
1 0.39581 0.07705 0.01245 0.00205 0.00085 0.00013 0.01165
2 0.04980 0.32419 0.09470 0.01749 0.00290 0.00045 0.01046
3 0.00463 0.05876 0.32108 0.08518 0.01558 0.00227 0.01250
4 0.00092 0.01041 0.09079 0.28290 0.08201 0.01024 0.02273
5 0.00034 0.00204 0.02927 0.14299 0.22622 0.05427 0.04488
6 0.00002 0.00017 0.00232 0.02726 0.08753 0.29964 0.08306

What do you think the problem can be?

Thanx again:-)
Sorry the matrix looks like:


0.39581 0.07705 0.01245 0.00205 0.00085 0.00013 0.01165
0.04980 0.32419 0.09470 0.01749 0.00290 0.00045 0.01046
0.00463 0.05876 0.32108 0.08518 0.01558 0.00227 0.01250
0.00092 0.01041 0.09079 0.28290 0.08201 0.01024 0.02273
0.00034 0.00204 0.02927 0.14299 0.22622 0.05427 0.04488
0.00002 0.00017 0.00232 0.02726 0.08753 0.29964 0.08306
Aqu_nb

Re: Transition or migration matrices in RatS

Unread post by Aqu_nb »

TomDoan wrote:The rows are adding to 1/2 rather than 1 which is very puzzling. It looks like you need to send the program and data file to support@estima.com so we can try to run it and see what's going on. That should work.
Sorry I did not saw your mail it was on page 2. I will send the program and the data to support@estima.com .
Aqu_nb

Re: Transition or migration matrices in RatS

Unread post by Aqu_nb »

TomDoan wrote:The rows are adding to 1/2 rather than 1 which is very puzzling. It looks like you need to send the program and data file to support@estima.com so we can try to run it and see what's going on. That should work.
Ok now I have send a mail with the data (attached) and the program to support@estima.com.
Aqu_nb

Re: Transition or migration matrices in RatS

Unread post by Aqu_nb »

Dear Tom,

I actually think that I have the transition matrices correct. Now I need to calculate whether the estimated probabilities of recession and expantion matrices are significantly different from the unconditional matrix. In oeder to do so I will need some standard errors. How do I calculate the standard errors.

Regards
Atef
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Transition or migration matrices in RatS

Unread post by TomDoan »

Aqu_nb wrote:Dear Tom,

I actually think that I have the transition matrices correct. Now I need to calculate whether the estimated probabilities of recession and expantion matrices are significantly different from the unconditional matrix. In oeder to do so I will need some standard errors. How do I calculate the standard errors.

Regards
Atef
There's a separate nclass x nclass covariance matrix for the elements of each row. The row estimates are independent of each other.

Code: Select all

dec vect[symm] rowcv(nclass)
do c=1,nclass
   dim rowcv(c)(nclass,nclass)
   ewise rowcv(c)(i,j)=(transit(c,i)*(i==j)-transit(c,i)*transit(c,j))*rowscales(c)
end do c
The covariance matrix of the difference between two (independent) estimates of a row in the transition matrix is the sum of corresponding covariance matrices, that is, if you compute a rowcv1 and rowcv2, the covariance matrix for the difference between row i in the two estimates will be rowcv1(i)+rowcv2(i). Note that this is a singular matrix since the probabilities have to sum to 1. The %qforminv function can compute a chi-squared test statistic that allow for the singular covariance matrix. For instance, if you have two estimates of the transition matrix, the test for whether the 1st rows are the same can be done with:

Code: Select all

compute test1=%qforminv(rowcv1(1)+rowcv2(1),%xrow(transit2,1)-%xrow(transit1,1))
cdf chisqr test1 nclass-1
The degrees of freedom is nclass-1 rather than nclass because of the singularity.
Post Reply