public class Dai2011HMM extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Dai2011HMM.CalibrationParam |
static class |
Dai2011HMM.ModelParam |
Constructor and Description |
---|
Dai2011HMM(Dai2011HMM.ModelParam model) |
Dai2011HMM(Dai2011HMM that)
Copy constructor.
|
Dai2011HMM(double mu1,
double mu2,
double lambda1,
double lambda2,
double sigma)
Constructs a two-state Markov switching Geometric Brownian Motion.
|
Modifier and Type | Method and Description |
---|---|
HMMRNG |
getHMM() |
Dai2011HMM |
getReciprocal()
Gets the reciprocal state switching GBM.
|
double |
lambda1()
Gets the transition intensity from bull market to bear market.
|
double |
lambda2()
Gets the transition intensity from bear market to bull market.
|
double |
mu1()
Gets the drift in the bull market.
|
double |
mu2()
Gets the drift in the bear market.
|
double |
nextP(double pt,
double St,
double St1)
Gets the evolution of pt, the conditional
probability
of being in an uptrend given all information, i.e.,
\(p_t = P(\alpha_t = 1 | \mathcal{F}_t)\).
|
double |
nextX(double xt,
double St,
double newSt)
Gets the evolution of xt, logit of the
conditional probability from (0, 1) onto \((-\infty, +\infty)\),
i.e.,
\(x_t = \log{\frac{p_t}{1-p_t}}\).
|
double |
sigma()
Gets the diffusion volatility.
|
String |
toString() |
public Dai2011HMM(double mu1, double mu2, double lambda1, double lambda2, double sigma)
mu1
- bull market returnmu2
- bear market returnlambda1
- bull-to-bear intensitylambda2
- bear-to-bull intensitysigma
- the volatility, assume to be constantpublic Dai2011HMM(Dai2011HMM.ModelParam model)
public Dai2011HMM(Dai2011HMM that)
that
- a two-state Markov switching GBM instancepublic double lambda1()
public double lambda2()
public double mu1()
public double mu2()
public double sigma()
public Dai2011HMM getReciprocal()
public double nextP(double pt, double St, double St1)
See (eq.13) in "Optimal Trend Following Trading Rules", M. Dai, 2011.
The evolution of \(p_t\) is
\[
dp_t = g(p_t) dt + \frac{(\mu_1-\mu_2)p_t(1-p_t)}{\sigma^2}
d\log{S_t},
\]
where
\[
g(p_t) = -\lambda_1 p_t + \lambda_2 (1-p_t) -
\frac{(\mu_1-\mu_2)p_t(1-p_t)((\mu_1-\mu_2)p_t+\mu_2-\sigma^2/2)}{\sigma^2}.
\]
In discrete form, it becomes
\[
p_{t+1} = \min{\left(1,\max{\left(0, p_t + g(p_t)dt +
\frac{(\mu_1-\mu_2)p_t(1-p_t)}{\sigma^2}\log{S_{t+1}/S_t}\right)}\right)}.
\]
pt
- the previous conditional probabilitySt
- the previous stock priceSt1
- the latest stock pricepublic double nextX(double xt, double St, double newSt)
The evolution of \(x_t\) can be derived as \[ dx_t = -(\frac{\mu_1-\mu_2}{\sigma^2} (\mu_1-\frac{\sigma^2}{2}) + \lambda_1 - \lambda_2) dt -(\lambda_1 e^{x_t} - \lambda_2 e^{-x_t} + \frac{(\mu_1-\mu_2)^2}{\sigma^2} \frac{1}{1+e^{x_t}}) dt + \frac{\mu_1-\mu_2}{\sigma^2} d\log{S_t}. \]
xt
- the previous valueSt
- the previous stock pricenewSt
- the latest stock pricepublic HMMRNG getHMM()
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.