Re: Joint transition probability
Posted: Fri Dec 16, 2016 9:09 am
Everything's observable. For each combination, just count up R(t),S(t),R(t-1),S(t-1) and divide by the number of R(t-1),S(t-1).
A Forum for RATS Software and Econometrics Discussions
https://www.estima.com/forum/
Code: Select all
OPEN DATA "C:\Users\Sam\Desktop\condition prob yearly.xlsx"
CALENDAR(A) 1875:1
DATA(FORMAT=XLSX,ORG=COLUMNS) 1875:01 2010:01 year yearofpres afterelec elec dem rep
@nbercycles(downs=recession)
print / recession
Thank you for the explanation. I am tryingto estimate the transition matrix and I am facing a error message "## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points" . I am not sure what caused the error. So I am seeking for you help. The following is my primitive codeTomDoan wrote:The NBER cycle dating doesn't go down to annual data. They give months and quarters. (Some recessions are over within a year).
Code: Select all
nonlin p11 p12 p13 p14 p21 p22 p23 p24 p31 p32 p33 p34 p41 p42 p43 p44 $
p11.ge.0. p12.ge.0. p13.ge.0. p11+p12+p13+p14==1.0 $
p21.ge.0. p22.ge.0. p23.ge.0. p21+p22+p23+p24==1.0 $
p31.ge.0. p32.ge.0. p33.ge.0. p31+p32+p33+p34==1.0 $
p41.ge.0. p42.ge.0. p43.ge.0. p41+p42+p43+p44==1.0
frml l = s1{1}*log(p11)*s1+s1{1}*log(p12)*s2+s1{1}*log(p13)*s3+s1{1}*log(p14)*s4 $
+s2{1}*log(p21)*s1+s2{1}*log(p22)*s2+s2{1}*log(p23)*s3+s2{1}*log(p24)*s4 $
+s3{1}*log(p31)*s1+s3{1}*log(p32)*s2+s3{1}*log(p33)*s3+s3{1}*log(p34)*s4 $
+s4{1}*log(p41)*s1+s4{1}*log(p42)*s2+s4{1}*log(p43)*s3+s4{1}*log(p44)*s4
compute p11=0.9, p12=0.08, p13=0.02, p14=0.0, p21=0.15, p22=0.78, p23=0.0, p24=0.07, $
p31=0.0, p32=0.0, p33=0.85, p34=0.15, p41=0.0, p42=0.03, p43=0.11, p44=0.86
max(method=simplex,iters=5) l 1875:02 1945:04
max(iters=200) l 1875:02 1945:04
Dear Tom, Thank you for your reply. The reason why I don't compute the transition probabilities by counting up is because that I would like to reduce the number of parameters to estimated. As you can see in the attached file, there are 16 parameters, ranging from Pd11,Pd01,Pr11,Pr00 to P11, P12 until P43, need to be estimated. As suggested by my professor, I would reduce the number of estimates based on certain assumptions. Such as, if the economic transition is assumed to independent from political transition, then I can set Pd11 = P11/(P11+P12), Pd01=P21/(P21+P22), Pr11=P33/(P33+P34), and Pr01=P43/(P43+P44).TomDoan wrote:Your guess values have p14=0, so log(p14) is NA.
I don't understand why you don't compute those by counting up. You really can't use variational methods to estimate those probabilities since at least some of the combinations probably have 0 counts.
I have no idea what your last question means.
Code: Select all
frml l = s1{1}*log(p11)*s1+s1{1}*log(p12)*s2+s1{1}*log(p13)*s3+s1{1}*log(p14)*s4 $
+s2{1}*log(p21)*s1+s2{1}*log(p22)*s2+s2{1}*log(p23)*s3+s2{1}*log(p24)*s4 $
+s3{1}*log(p31)*s1+s3{1}*log(p32)*s2+s3{1}*log(p33)*s3+s3{1}*log(p34)*s4 $
+s4{1}*log(p41)*s1+s4{1}*log(p42)*s2+s4{1}*log(p43)*s3+s4{1}*log(p44)*s4
Thank you, Tom. I have a new question and I am seeking for your help. As you know that my S = (X, Y), I am wondering is it possible to express the transition of S in something like VAR structure of (X, Y)?TomDoan wrote:Go back and look at https://estima.com/forum/viewtopic.php?p=13364#p13364. If the S transition doesn't depend upon R, the first factor collapses to just P(S(t)|S(t-1)). You can compute those probabilities (there are just two free ones) using all the data (doesn't matter whether it's an election or not, since R doesn't enter it). The second factor can be computed using the election years only.
SSTATS with %IF works fine if done correctly. Obviously, you're doing something wrong---perhaps you're not allowing for the fact that you don't have a lagged value for entry 1.
Variational methods will work even with some cells having 0 probability, but you can't start with a true 0 as 0 x log(0) produces NA, not 0. It will estimate it to some very small number. The estimated standard error on the 0 probability won't be correct since it's at a boundary.
Given that you already have the FRML written out, there's no real point to writing it in matrix form.