I have the following sequence.

enter image description here

Consider a model that follows a geometric Brownian motion whose drift switches between two different regimes representing the up trend and down trend. The regime switching is assumed to be the result of a hidden Markov chain with two states.

Let $X_t$ denote the value at time $t$ satisfying the equation

$\qquad dX_t=X_t[\ \mu(\alpha_t)\ dt + \sigma \ dB_t]$,

where $\mu(i)=\mu_i, i=1,2$, are the expected growth rates, $\alpha_t \in \{ 1,2 \}$ is a two-state Markov chain, $\sigma>0$ is the standard deviation, and $B_t$ is a standard Brownian motion. We will assume $\mu_1>\mu_2$ and let Q denote the generator (transition matrix) of $\alpha_t$.

$\qquad Q= \begin{pmatrix} -\lambda_1 & \lambda_1 \\ \lambda_2 & -\lambda_2 \end{pmatrix} $ with $\ \lambda_1, \lambda_2>0$.

I would like to estimate the parameters $\mu_1, \ \mu_2, \ \lambda_1, \ \lambda_2$ and $\sigma$ that best describe the data.

I already found the function EstimatedProcess which can get the parameters of a geometric Brownian process assuming just one state, but I am stuck on the two state problem.

The data is available via,

data = Flatten[Import["http://pastebin.com/raw/W1gE4HXS", "Table"];


I found a makeshift solution by calculating $S_t=Log(\frac{X_t}{X_{t-1}})$ and applying a MeanFilter on $S_t$ to separate the up and down states via EstimatedProcess[filtered, HiddenMarkovProcess[2, "Gaussian"]. This wil give you $\alpha_t$ and thus the $\lambda$'s. Next is creating two datasets, one for each state, and use these to estimate the parameters of the geometric Brownian motion.

The only problem here lies with the choice of the filer, different radius will give different estimates.


Your Answer

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

Browse other questions tagged or ask your own question.