FxPaul

Math in finance or vice versa

Hidden Markov Model for application store ratings

leave a comment »

Hidden Markov model (HMM) is a statistical model in which the system is assumed to be a Markov process with hidden states. Those states can be recovered by outputs, observed sequences. In other words, it is possible to infer some probabilistic properties of the system by outputs.

As an off-topic, application stores usually give ranking to apps by user comments and rankings. The simplest way to derive an app rating is to calculate average or median, i.e. some statistical property based on rating samples. For average rating not being a robust statistics, its value is affected by outliers, for instance, by deviant rankings submitted by users. Thus a robust procedure might be used to improve ranking.

In fact we can apply HMM mechanics to infer real application rating by the most likely explanation of observed user rankings. Let’s see how to do that.

Read the rest of this entry »

Advertisements

Written by fxpaul

November 2, 2011 at 17:10

Posted in thoughts

Tagged with , ,

Maximum Likelihood Estimation of Stochastic Process Parameters

with 4 comments

Maximum Likelihood estimation (MLE) is a method of parameter estimations of statistical model. The base idea is to establish joint density probability for observations and to maximize its value by model’s parameters. To say it differently, we are looking for the most probable explanation of observed data.

Problem setup

Assume that we’re given a one-dimensional stochastic process:
dS_t = \mu dt + \sigma dW_t
where \mu and \sigma are some functions of arguments \theta.

We observe this process by measuring $\latex S_i(t_i)$ where i=1..N. For sake of simplicity assume that observations are equidistant in time, i.e. \Delta t = t_{i-1} - t_i = const.

So, let’s estimate parameters.

Read the rest of this entry »

Written by fxpaul

November 2, 2011 at 08:00

Posted in trading math

Tagged with , ,

SABR model calibration – attempt 2

leave a comment »

The SABR model is a stochastic volatility model, which attempts to capture the volatility smile in derivatives markets. The name stands for “Stochastic Alpha, Beta, Rho”, referring to the parameters of the model. It was developed by Patrick Hagan, Deep Kumar, Andrew Lesniewski, and Diana Woodward.

The SABR model describes a single forward F, such as a LIBOR forward rate, a forward swap rate, or a forward stock price. The volatility of the forward F is described by a parameter σ. SABR is a dynamic model in which both F and σ are represented by stochastic state variables whose time evolution is given by the following system of stochastic differential equations:
dF_t = \sigma_t F_t^{\beta} dW_t
d\sigma_t = \alpha\sigma_t dZ_t
Constant parameters should satisfy the condition 0 \leq \beta \leq 1, \alpha \geq 0
Here, W_t and Z_t are two correlated Wiener processes with correlation coefficient -1\leq\rho\leq 1. For simplicity sake, we assume that \beta = 1, therefore, we put dZ_t dW_t = \rho dt:
dF_t = \sigma_t F_t dW_t
d\sigma_t = \alpha\sigma_t dZ_t

Read the rest of this entry »

Written by fxpaul

November 1, 2011 at 13:50

Posted in trading math

Correlation trading on FX

leave a comment »

Correlation trading is based on few simple ideas:

  1. Correlations are changing with time
  2. Correlations of pairs of 3 currencies are bounded by strict equation
  3. Correlation is bound in the interval [-1, 1]

Therefore, one may try to “buy correlation” at -1 and to “sell it” at +1.

Read the rest of this entry »

Written by fxpaul

November 1, 2011 at 13:04

Exponential Ornstein-Uhlenbeck process and USD/CHF

leave a comment »

In the previous post USD/CHF is considered to follow a mean-reverting process. Let’s look at the dynamics of the process during the days of year 2010.

Calibration procedure

Calibration is simple: get logs of prices and calibrate against classic Ornstein-Uhlenbeck process as it is described here.
Read the rest of this entry »

Written by fxpaul

July 25, 2011 at 14:19

Posted in trading math

Tagged with

SABR model calibration

leave a comment »

Don’t use this!

The SABR model is a stochastic volatility model, which attempts to capture the volatility smile in derivatives markets. The name stands for “Stochastic Alpha, Beta, Rho”, referring to the parameters of the model. It was developed by Patrick Hagan, Deep Kumar, Andrew Lesniewski, and Diana Woodward.

The SABR model describes a single forward F, such as a LIBOR forward rate, a forward swap rate, or a forward stock price. The volatility of the forward F is described by a parameter σ. SABR is a dynamic model in which both F and σ are represented by stochastic state variables whose time evolution is given by the following system of stochastic differential equations:
dF_t = \sigma_t F_t^{\beta} dW_t
d\sigma_t = \alpha\sigma_t dZ_t
Constant parameters should satisfy the condition 0 \leq \beta \leq 1, \alpha \geq 0
Here, W_t and Z_t are two correlated Wiener processes with correlation coefficient -1\leq\rho\leq 1. For simplicity sake, we assume that \rho = 1, therefore, we put Z_t = W_t:
dF_t = \sigma_t F_t^{\beta} dW_t
d\sigma_t = \alpha\sigma_t dW_t

Read the rest of this entry »

Written by fxpaul

June 17, 2011 at 09:27

Posted in trading math

Is EUR/USD mean reverting?

with 2 comments

Nassim Taleb in his book “Dynamic Hedging” provides an empirical rule to validate if the market has mean reversion tendency. It states that if volatility lowers if the longer time frame is used, then the mean reversion takes place.
Read the rest of this entry »

Written by fxpaul

June 16, 2011 at 20:52

Posted in trading math