Message Boards Message Boards

0
|
14316 Views
|
7 Replies
|
4 Total Likes
View groups...
Share
Share this post:

TimeSeriesModelFit // (G)ARCH estimating methods

Posted 11 years ago

Hi,

How can I know which method has been chosen by TimeSeriesModelFit to estimate the GARCH porcess?

In case it is "Maximum Likelihood", does it always assume that the residuals are normally distributed? How do I estimate a GARCH model with conditionally t-distributed residuals?

POSTED BY: Sandu Ursu
7 Replies
Posted 10 years ago

Thanks for the package. No, I didn't check the log likelyhoods of TimeSeriesModelFit or EstimatedProcess - simply because I don't know how to! Could you point me in the right direction?

POSTED BY: Xavier Vallee
Posted 10 years ago

Hi Xavier,

since GarchProcess is built in, I would say that one. Have you checked the log likelihoods? Like I said earlier you would need to tune solver, try different combinations of WorkingPrecision and MaxIterations. Or try my package---> https://www.dropbox.com/s/s2yxfvpsg0d5v2i/garch%20package.rar?dl=0

POSTED BY: milos cipo
Posted 10 years ago

Hi Milos,

Thanks for the mathematica code and notebook. One quick question: do you know why your algorithm returns different parameters to the GarchProcess function in Mathematica 10.x? Which one is correct in your opinion?

POSTED BY: Xavier Vallee
Posted 10 years ago

Hi, Milos

Thanks a lot for the code! I'll have a look shortly.

POSTED BY: Sandu Ursu
Posted 10 years ago

Hi Sandu,here is my first code that uses Memorization

garch[s_] := Module[{k = s, R, \[Sigma]sqr, ll, sll, u},
  k = Flatten@k;
  R[t_] := Flatten[k][[t]];
  \[Sigma]sqr[1, w_, a_, b_] := Variance[Flatten[k]];
  \[Sigma]sqr[t_, w_?NumberQ, a_?NumberQ, 
    b_?NumberQ] := \[Sigma]sqr[t, w, a, b] = 
    w + a R[t - 1]^2 + b \[Sigma]sqr[t - 1, w, a, b];
  ll[t_, w_?NumberQ, a_?NumberQ, b_?NumberQ] := 
   ll[t, w, a, b] = 
    If[\[Sigma]sqr[t, w, a, b] > 
      0, -.5 (Log[2 \[Pi]] + Log[\[Sigma]sqr[t, w, a, b]] + 
        R[t]^2/\[Sigma]sqr[t, w, a, b]), -1000]; 
  sll = Sum[ll[t, w, a, b], {t, 2, k // Length}];
  u = NMaximize[{sll, a > 0, b > 0, w > 0, a + b < 1}, {w, a, b}, 
    WorkingPrecision -> 12, MaxIterations -> 100];
  Print[u];
  Remove[k];
  Remove[R];
  Remove[\[Sigma]sqr];
  Remove[ll];
  Remove[sll];
  ClearAll[k, R, \[Sigma]sqr, ll, sll, u];]

I used If function to avoid numerical obstacles of imaginary numbers (log(negative value) may occur) as in Christoffersen book. This is Garch with normal innovation but you can always change log likelihood. Unfortunately this is still kinda slow so after some time i found a new way, I wont post the code here, instead I'll attach a notebook with code.It is pretty fast and If you want your function to be entirely in Mathematica it will do.The problem for me was (as will be for you) the mathematica optimizer, it didn't always converge and it needs tuning( WorkingPrecision and MaxIterations) in order to give satisfying result (I use default algorithm Neldear Mead). And finally If you give me your mail I'll send you my package with installation instructions, it has functions for univariate and multivariate garch estimation and it took me a lot of time to develop it.Please contact me on this post if you have any questions.

Attachments:
POSTED BY: milos cipo
Posted 10 years ago

Thank you, Milos

Is it possible to see the code from the package?

Which maximization procedure did you use?

The problem which I encountered when I was trying to estimate a GARCH(p,q) was related to maximization of the log-likelihood function. FindMaximum and NMaximize take years to find the parameters (especially if they are many).

I tried to implement my own maximization based on the Newton-Raphson algorithm... which didn't behave as expected, and because I was time constrained I gave up and went on to use OxMetrics. But if I see your code, I may try to tackle the problem again.

POSTED BY: Sandu Ursu
Posted 10 years ago

It's something I'm wondering about too.I don't know the answer to that question but I can provide you with code so you can do Garch parameter estimation yourself.This is something I've been tackling for the past few months.Finally I created a package that does exactly that it's based on R functions and RLink.Basically if you want to for example estimate Garch(1,3) model with Student cond. distribution the command in package would be:

Ugarch[data,"garch(1,3)","coef",ConditionalDistribution->"StudentTDistribution"]

For Generalized error :

Ugarch[data,"garch(1,3)","coef",ConditionalDistribution->"Erf"]

For Skewed Student:

Ugarch[data,"garch(1,3)","coef",ConditionalDistribution->"SkewStudentTDistribution"]

,and so on.Interested??

POSTED BY: milos cipo
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract