Page 1 of 2

Joint transition probability

Posted: Wed Nov 30, 2016 2:31 am
by fan
Hi Tom,
I am trying to study a joint transition process. In this study, I have X and Y, two discrete variables, for economic condition and political party in power respectively. I would like to study whether political partisanship has any impact on the transition probability for economic condition; and similarly, whether economic condition has any impact on the transition probability for party in power. I am wondering what likelihood function is needed here; and do you know any study material in topic or similar topic I can learn from. Thank you in advance

Re: Joint transition probability

Posted: Wed Nov 30, 2016 9:03 am
by TomDoan
Wouldn't that just be a four-regime Markov chain?

Re: Joint transition probability

Posted: Wed Nov 30, 2016 4:26 pm
by fan
TomDoan wrote:Wouldn't that just be a four-regime Markov chain?
Thank you for the quick reply. Yes, it is a four regime Markov chain with observed states. However, I am not sure how to model those transition processes. Could you please kindly suggest what I should do?

Re: Joint transition probability

Posted: Wed Nov 30, 2016 9:33 pm
by TomDoan
An unrestricted Markov model for four regimes would have 12 free parameters. If there are two independent Markov processes governing the two regime pairs, there would be just 4, and the 12 in the full model would be a function of those 4.

Re: Joint transition probability

Posted: Tue Dec 06, 2016 1:16 am
by fan
TomDoan wrote:An unrestricted Markov model for four regimes would have 12 free parameters. If there are two independent Markov processes governing the two regime pairs, there would be just 4, and the 12 in the full model would be a function of those 4.
Thank you for the reply. In my case, the Markov processes governing the two regime pairs are not independent. For example, I would like to study the potential impact from economic condition on the transition process. Whether economic expansion will help the incumbent president or his party remain in power. On the other hand, I would like to study whether presidential partisanship has any impact on economic condition transition. Could you please kindly share more advice with me? Thank you

Re: Joint transition probability

Posted: Tue Dec 06, 2016 7:50 am
by TomDoan
So you have transition probabilities which are conditional on the lagged state of the "other" variable. (The full unrestricted model has transition from (say) (1,1) possibly having no relationship to the transition from (1,0)).

Re: Joint transition probability

Posted: Tue Dec 06, 2016 2:34 pm
by fan
TomDoan wrote:So you have transition probabilities which are conditional on the lagged state of the "other" variable. (The full unrestricted model has transition from (say) (1,1) possibly having no relationship to the transition from (1,0)).
Yes, you are right. How could I model these transition processes?

Re: Joint transition probability

Posted: Tue Dec 06, 2016 3:10 pm
by TomDoan
Are you asking me how conditional probabilities work? The 4 x 4 transition allows for effectively any type of relationship. In order to get a restricted parameter set, you need to make assumptions about how the two current regimes are generated given the past regimes.
nestedmarkov.png
nestedmarkov.png (1.28 KiB) Viewed 29239 times
Assuming two choices for each, the first term (in complete generality) has 8 free parameters (one for each combination of the three conditioning variables) and the second term has 4. If the first doesn't depend upon R(t) (so the regimes are independently chosen conditioned on the past), you're down to 4. If the second doesn't depend upon lagged S, then it has two, etc. You can flip the whole thing around to condition first on S, and get a different set of possible restrictions.

Re: Joint transition probability

Posted: Thu Dec 08, 2016 2:18 pm
by fan
TomDoan wrote:Are you asking me how conditional probabilities work? The 4 x 4 transition allows for effectively any type of relationship. In order to get a restricted parameter set, you need to make assumptions about how the two current regimes are generated given the past regimes.
nestedmarkov.png
Assuming two choices for each, the first term (in complete generality) has 8 free parameters (one for each combination of the three conditioning variables) and the second term has 4. If the first doesn't depend upon R(t) (so the regimes are independently chosen conditioned on the past), you're down to 4. If the second doesn't depend upon lagged S, then it has two, etc. You can flip the whole thing around to condition first on S, and get a different set of possible restrictions.
Dear Tom, thank you for your detailed reply. In my case p(St,Rt|St-1,Rt-1)=p(St|St-1,Rt-1)p(Rt|St-1,Rt-1). I would like to know how to model the the conditional probabilities as I would like to the questions: whether past economic condition will affect the probability for incumbent president to be re-elected; and whether president will have any impact on economic condition transition.

My initial guess is that if I let p(St=1|St-1=1)=Qs, p(St=1|St-1=0)=1-Qs, p(St=0|St-1=0)=Ps, p(St=0|St-1=1)=1-Ps; and similarly for p(Rt=1|Rt-1=1)=Qr, p(Rt=1|Rt-1=0)=1-Qr, p(Rt=0|Rt-1=0)=Pr, p(Rt=0|Rt-1=1)=1-Pr. And I am thinking to model the conditional probabilities using binomial distributions,e.g. p(St=1|St-1=1)=Π_t^TQs^(1-St)(1-St-1), and p(St=1|St-1=0)=Π_t^T(1-Qs)^(St)(St-1).

Therefore the condition probability P(St=0,Rt=0|St-1,Rt-1)=[p(St=0|St-1=0,Rt-1=0)*p(Rt=0|St-1=0,Rt-1=0)]*[p(St=0|St-1=0,Rt-1=1)*p(Rt=0|St-1=0,Rt-1=1)]*[p(St=0|St-1=1,Rt-1=0)*p(Rt=0|St-1=1.Rt-1=0)]*[p(St=0|St-1=1,Rt-1=1)*p(Rt=0|St-1=1.Rt-1=1)]. I am thinking to model the conditional probability as P(St=0,Rt=0|St-1,Rt-1)= Π_t^T [[Qs^((1-St)(1-St-1)) Qr^((1-Rt)(1-Rt-1))] [Qs^(1-St)(1-St-1) (1-Qr)^((1-Rt)(Rt-1))] [(1-Qs)^(1-St)(St-1) Qr^((1-Rt)(Rt-1))][(1-Qs)^(1-St)(St-1) (1-Qr)^((1-Rt)(Rt-1))].

Could you please kindly correct me if my initial thought is incorrect ? Many Thanks in advance

Re: Joint transition probability

Posted: Thu Dec 08, 2016 2:51 pm
by TomDoan
Aren't your R's and S's observable? And if the R's and S's are conditionally independent, then there's no reason to do a joint likelihood.

Re: Joint transition probability

Posted: Thu Dec 08, 2016 3:50 pm
by fan
TomDoan wrote:Aren't your R's and S's observable? And if the R's and S's are conditionally independent, then there's no reason to do a joint likelihood.
Dear Tom, thanks for the quick reply. R's and S's are observable in my case. Additionally, R's and S's are considered to be conditionally dependent as I would like to test the questions: whether past economic condition will affect the probability for incumbent president to be re-elected; and whether president will have any impact on economic condition transition. However, I am not sure how to model the conditional probability p(St,Rt|St-1,Rt-1)=p(St|St-1,Rt-1)p(Rt|St-1,Rt-1) so I can empirically test the questions.

Re: Joint transition probability

Posted: Thu Dec 08, 2016 4:28 pm
by TomDoan
Wouldn't that be just two logit models, one for R(t) and one for S(t)?

Re: Joint transition probability

Posted: Thu Dec 15, 2016 12:14 pm
by fan
Hi Tom,

In the attachment is my transition matrix and log likelihood function. Could you please kindly take a quick look and let me know if there is any mistake?

My code for maximization

Code: Select all

nolin T1 T2 T3 T4 T5 T6 T7 T8 T9 T10 T11 T12 

frml llfrml = dem{1}*dem*expansion{1}*expansion*log(T1) $
             +dem{1}*dem*expansion{1}*(1-expansion)*log(T2) $
             +dem{1}*(1-dem)*expansion{1}*expansion*log(T3) $
             +dem{1}*(1-dem)*expansion{1}*(1-expansion)*log(1-T1-T2-T3) $
             +dem{1}*dem*(1-expansion){1}*expansion*log(T4) $
             +dem{1}*dem*(1-expansopm){1}*(1-expansion)*log(T5) $
             +dem{1}*(1-dem)*(1-expansion){1}*expansion*log(T6) $
             +dem{1}*(1-dem)*(1-expansion){1}*(1-expansion)*log(1-T4-T5-T6) $
             +(1-dem){1}*dem*expansion{1}*expansion*log(T7) $
             +(1-dem){1}*dem*expansion{1}*(1-expansion)*log(T8) $
             +(1-dem){1}*(1-dem)*expansion{1}*expansion*log(T9) $
             +(1-dem){1}*(1-dem)*expansion{1}*(1-expansion)*log(1-T7-T8-T9) $
             +(1-dem)[1}*dem*(1-expansion){1}*expansion*log(T10) $
             +(1-dem){1}*dem*(1-expansion){1}*(1-expansion)*log(T11) $
             +(1-dem){1}*(1-demo)*(1-expansion){1}*expansion*log(T12) $
             +(1-dem){1}*(1-demo)*(1-expansion){1}*(1-expansion)*log(1-T10-T11-T12)

compute  T1=XX,T2=XX,T3=XX,T4=XX,T5=XX,T6=XX,T7=XX,T8=XX,T9=XX,T10=XX,T11=XX,T12=XX

maximize(method=bfgs,robusterrors,iters=200) llfrml


Re: Joint transition probability

Posted: Thu Dec 15, 2016 1:18 pm
by TomDoan
Yes. That would work. You do realize that you can estimate all those probabilities by just doing crosstabs of the combinations.

Re: Joint transition probability

Posted: Fri Dec 16, 2016 8:55 am
by fan
TomDoan wrote:Yes. That would work. You do realize that you can estimate all those probabilities by just doing crosstabs of the combinations.
Hi Tom, thank you for the quick reply. Could you kindly show me how to do crosstabs in my case? I really would like to learn