Student’s t: location-scale

Motivation

Often when we examine financial data, we find that logarithmic returns exhibit fatter tails than the normal distribution. Hence, we need a distribution with more probability mass in the tails, and – coming from traditional financial mathematics with normally distributed log-returns – the natural first choice is the student’s t-distribution.

However, the standard student’s t-distribution has zero mean, and a variance determined through its degrees of freedom parameter. This is usually too restrictive, since one major characteristic of financial data is changing volatility, which ideally should be captured without further changes of the shape of the distribution. To gain such extended flexibility, the student’s t-distribution can be extended through linear transformation, so that mean, standard deviation and tails can be adapted flexibly.

Standard student’s t-distribution

For X\sim t the variance depends on the degrees of freedom parameter \nu:

\displaystyle \mathbb{V}(X)=\frac{\nu}{\nu-2}

## set parameter
nu <- 8

## number of samples
n <- 10000

## simulate
t <- rt(n,nu)

## analytically calculated variance
variance <- nu/(nu-2)
sprintf("True variance: %f",variance)

## get sample variance
sprintf( "Sample variance: %f",var(t))

: [1] “True variance: 1.333333” : [1] “Sample variance: 1.291841”

Location-scale transformation

Through application of a linear transformation, we can easily shift the center of the distribution and affect the divergence from its mean.

\displaystyle \begin{aligned} Y&=aX + b,\quad X\sim t \\ \mathbb{E}[Y]&=b \\ \mathbb{V}(Y)&=a^{2}\mathbb{V}(X) \\ &=a^{2} \frac{\nu}{\nu-2} \end{aligned}

Note, that the standard deviation of the new random variable Y does not equal the scaling factor a, but is a composition of scaling factor and original standard deviation determined by \nu.

The cumulative distribution function after the transformation can easily be obtained through:

\displaystyle \begin{aligned} \mathbb{P}(Y\leq x)&= \mathbb{P}(aX+b\leq x)\\ &= \mathbb{P}\left(X\leq \frac{x-b}{a}\right)\\ &= F_{X}\left(\frac{x-b}{a}\right) \end{aligned}

Taking this result, we can derive the inverse cdf:

\displaystyle \begin{aligned} F_{Y}(x)&=F_{X}\left(\frac{x-b}{a}\right)=p \\ \Leftrightarrow &\frac{x-b}{a}=(F_{X})^{-1}(p)\\ \Leftrightarrow &x=a(F_{X})^{-1}(p)+b \\ \Leftrightarrow &(F_{Y})^{-1}(p)=a(F_{X})^{-1}(p)+b \end{aligned}

Getting the density of Y is slightly more demanding, since we need an additional rescaling in order to guarantee that integration of the density function still yields an area of 1. Hence, we need to apply the transformation theorem:

\displaystyle f_{Y}(z)=f_{X}(g^{-1}(z)) |(g^{-1})'(z)|,

with g given by g(X)=aX+b.

Calculating g^{-1} requires exchanging X and Y and solving for Y:

\displaystyle X=aY+b \Leftrightarrow Y=\frac{X-b}{a}

Taking the derivative:

\displaystyle (g^{-1})'(X)=\left(\frac{X-b}{a}\right)'=\frac{1}{a}

Putting the parts together, we get:

\displaystyle f_{Y}(x)=f_{X}\left(\frac{x-b}{a}\right)\left|\frac{1}{a}\right|

Implementation

The functions now can be implemented in R. We use the code provided by wikipedia:

dt_ls <- function(x, df, mu, a) 1/a * dt((x - mu)/a, df)
pt_ls <- function(x, df, mu, a) pt((x - mu)/a, df)
qt_ls <- function(prob, df, mu, a) qt(prob, df)*a + mu
rt_ls <- function(n, df, mu, a) rt(n,df)*a + mu

We can now try to fit the t-location-scale distribution to simulated data.

library(MASS)

## set parameters
n <- 10000
mu <- 0.4
a <- 1.2
nu <- 4

## simulate values
simVals <- rt_ls(n, nu,mu,a)
fit <- fitdistr(simVals,"t")
print(fit)
There were 12 warnings (use warnings() to see them)
       m            s            df    
  0.40849216   1.20630991   4.00772609 
 (0.01427656) (0.01498895) (0.16515696)

Christian Groll on Google+

Posted on 2013/04/30, in financial econometrics, R and tagged , , , , . Bookmark the permalink. 2 Comments.

Leave a comment