2
$\begingroup$

I have a random walk where by at certain times or conditions the increments follow one distribution, and then another distribution under different conditions - how can I model this random walk (states can have fixed or random probabilities)

For example, An economy has a bull and bear state with transition probabilties of staying the same as 80% and moving to the other state as 20%. The increments of a random walk of exchange rates follow a t-distribution in a bull state and a lognormal distribution in a bear state. How would you go about modelling the exchange rate random walk?

$\endgroup$
2
$\begingroup$

It sounds like a Hidden Markov model will do exactly what you want. A HMM assumes there is a discrete set of latent (unobservable) states which evolve according to a discrete time Markov process and generate observations which depend only on the current state. Thus a HMM is defined by a set of latent states $Q$, an initial distribution $p(q)$, a transition probability $p(q | q^\prime)$, and an emission probability $p(o|q)$.

Given a state hidden state sequence $q_1 q_2 \cdots q_T$ and observation seqeunce $o_1 o_2 \cdots o_T$ the joint probability can be calculated as

$$ p(q_1, \ldots, q_T, o_1, \ldots, o_T) = p(q_1)P(o_1|q_1)\prod_{t=2}^T p(q_t|q_{t-1})P(o_t|q_t). $$

For your particular example you would have 2 latent states (one for bear and the other for bull), with the emission distribution being t and normal respectively.

$\endgroup$
  • $\begingroup$ @user40124 alto's answer sounds right if one takes the process of increments as the "observale" process $\endgroup$ – Stéphane Laurent Mar 28 '14 at 16:32
1
$\begingroup$

The increments of a random walk of exchange rates follow a t-distribution in a bull state and a lognormal distribution in a bear state

If by increment you mean the change from step to step, I don't understand how this can follow a lognormal distribution since these values will all be positive. The below R code uses a t distribution with 10 df and center=1 in the bull state and a normal distribution with mean=-1 and sd=3 in the bear state. Points are blue when in the bull state, and red in bear.

enter image description here

state<-1
duration<-1000
x<-matrix(nrow=duration, ncol=3)
x[1,]<-cbind(1,state,100)

for(t in 2:duration){
  transition<-rbinom(1,1,.2)

  if(transition==1){
    if(state==1){
      state=0
    }else{
      state=1
    }
  }
  if(state==0){
    x.new<-x[t-1,3]+rnorm(1,-1,2)
  }else{
    x.new<-x[t-1,3]+rt(1,10,1)
  }
  x[t,]<-cbind(t,state,x.new)

  plot(x[,1],x[,3],
       xlab="Time", ylab="Exchange Rate", 
       col=c("Red","Blue")[1+x[,2]])
}
$\endgroup$
  • $\begingroup$ Apologies, it's the logged increments im using and they follow t and normal. Thanks for this, is there anything more theoretical I can read/look up about this type of problem? $\endgroup$ – user40124 Mar 27 '14 at 18:13
  • $\begingroup$ @user40124 Sorry this is not my field and I haven't looked at the literature. The above is just the simple way I thought of. One idea that may be good is to look at the historical data to decide what is bull/bear state and divide the increments into those two categories, then sample from these empirical distributions rather than using t and normal. $\endgroup$ – Livid Mar 27 '14 at 18:18
  • $\begingroup$ @user40124 you should edit the corrected information into your question to clarify your question (I'd suggest by adding a better framed question to the bottom to reflect this clarifying information). $\endgroup$ – Glen_b -Reinstate Monica Mar 27 '14 at 23:38
  • $\begingroup$ I'm afraid i'll find it difficult to be clearer 'mathematically' as this is just some conceptual thinking i've been doing and asked the question to see if anyone could give a more direction and clarity as to what this type of process might be. I'll break my thinking down as much as I can; $\endgroup$ – user40124 Mar 28 '14 at 12:51
  • 1
    $\begingroup$ @Livid, your code simulates a Hidden Markov model, which is very well known. I describe HMMs in my answer. $\endgroup$ – alto Mar 28 '14 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.