1

I am currently working on a group project estimating VaR and ES for a series of returns. One of the tasks is to estimate the degrees of freedom of a t distribution.

I am using the following approach:

make_loglik  <-  function(x){  Vectorize( function(nu) sum(dt(x, df=nu,  log=TRUE)) )}

t_nu_mle  <-  function(x) {
  loglik  <-  make_loglik(x)
  res  <-  optimize(loglik, interval=c(0.01, 2000), maximum=TRUE)$maximum
  res   
}

Which yields for example:

set.seed(123)
t <- rt(20000,df=3)
t_nu_mle(t)

[1] 2.986434

However on the empirical data that is given in the assignment I get a different value for the DF using for example the package MASS:

library(MASS)
fitdistr(t, "t")

Additionally, my other group members obtain different results as well when using the actual data set.

Is my function above flawed? What could be the issue here?

VDAA
  • 11
  • 2

0 Answers0