1

I want to use ccgarch package in R. First of all, What are initial values in this package? How can I specify these values?

Besides, How can I use loglik.eccc and define param for it? For instance, when I have param=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14), this parameter doesn't change and I have previous default values for param.

# computing a likelihood value for the (E)CCC-GARCH(1,1) mdoel
   loglik.eccc <- function(param, dvar, model){
      nobs <- dim(dvar)[1]
      ndim <- dim(dvar)[2]
      para.mat <- p.mat(param, model, ndim)
      a <- para.mat$a
      A <- para.mat$A
      B <- para.mat$B
      R <- para.mat$R

      # check if R is positive definite
      eigenR <- eigen(R)$values
      if(max(abs(R[lower.tri(R)]))>1.0||min(eigenR)<0||!is.double(eigenR)){
         R <- diag(ndim)
      }
      h <- vector.garch(dvar, a, A, B)
      z <- dvar/sqrt(h)
      lndetR <- log(det(R))
      invR <- solve(R)
      lf <- -0.5*nobs*ndim*log(2*pi) - 0.5*sum(log(h)) - 0.5*nobs*lndetR - 0.5*sum((z%*%invR)*z)
      -lf

   }

1 Answers1

1

I want to use ccgarch package in R. First of all, What are initial values in this package?

I'm pretty sure there are no default parameters. If you try to run your code without specifying param you should get something along the lines (note: I did this with the command loglik.dcc):

Error in loglik.dcc(dvar = my.df, model = "diagonal") : 
argument "param" is missing, with no default

How can I specify these values?

I reccomend you check out the examples in the documentation to the ccgarch package. While there is no example given for loglik.eccc, there is however a nice example for loglik.dcc.

The documentation can be accessed here. The example on page 24/25 is the following:

## Not run:
# Simulating data from the original DCC-GARCH(1,1) process
  nobs <- 1000; cut <- 1000
  a <- c(0.003, 0.005, 0.001)
  A <- diag(c(0.2,0.3,0.15))
  B <- diag(c(0.75, 0.6, 0.8))
  uncR <- matrix(c(1.0, 0.4, 0.3, 0.4, 1.0, 0.12, 0.3, 0.12, 1.0),3,3)
  dcc.para <- c(0.01,0.98)
  dcc.data <- dcc.sim(nobs, a, A, B, uncR, dcc.para, model="diagonal")

# Estimating a DCC-GARCH(1,1) model
  dcc.results <- dcc.estimation(inia=a, iniA=A, iniB=B, ini.dcc=dcc.para,
  dvar=dcc.data$eps, model="diagonal")
# Parameter estimates and their robust standard errors
  dcc.results$out
# Computing the value of the log-likelihood at the estimates
  loglik.dcc(dcc.results$out[1,], dcc.data$eps, model="diagonal")
## End(Not run)

dcc.results$out will show you the estimated parameters:

> dcc.results$out
                   a1         a2          a3         A11       A22        A33          B11        B22        B33   dcc alpha
estimates 0.002390773 0.00477909 0.001010304 0.199707914 0.2738877 0.13370911 0.7644433750 0.61175081 0.82020157 0.018729549
std.err   0.000703168 0.03576364 0.032840012 0.001213087 0.0439388 0.05675561 0.0003626412 0.02548092 0.03398187 0.008090084
            dcc beta
estimates 0.93071563
std.err   0.03659041

Which you can use in the calculation of the loglik.dcc:

loglik.dcc(dcc.results$out[1,], dcc.data$eps, model="diagonal")
[1] 6316.604

Concluding from this you can:

1. Set a parameter vector yourself

Your example param=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14) violates some very important model restraints. I strongly recommend you read more about the restrictions of the model you're looking into (I find this is very nicely narrated in this journal article on p. 160 from the grandfather of all GARCH models, Robert Engle.)

In short: you can see in the above estimated parameters that they all are in the Range 0 < a, A and B < 1. If you go for something, orient yourself on those parameters.

2. Estimate them based on your data and use them as illustrated in the example above.

Note that example is for 3 series. If you use more/less dimensions you will need to adjust the initial parameters. The ccgarch2 package e. g. will let you do estimations without setting initial values. It will generate them randomly.

Besides, How can I use loglik.eccc and define param for it?

This should be covered by the examples / narration above.

Numb3rs
  • 345
  • 2
  • 8
  • 1
    I'm sorry, you lost me. So you estimated a model with `eccc.estimation` and don't want to use the parameters the estimation gave you? – Numb3rs Apr 14 '17 at 16:00
  • i want use this parameters ,but,How do I identify the appropriate initial values? – shadi norollah Apr 14 '17 at 16:27
  • 1
    Ah, now I get it. So you want to know if there is some sort of best-practice in how to set your initial parameters. Sadly I don't think there is. You could have a look at [this paper](http://faculty.washington.edu/ezivot/research/practicalgarchfinal.pdf). On page 10 and 12 they discuss that topic (on page 10 e. g. they name how initial parameters could be set in practice). – Numb3rs Apr 14 '17 at 19:32