AIC.GARCHX <- function(object, ..., k){
  # Calculate initial value for sigma^2
  #sigma.init <- mean(object$eps[1:object$r]^2)
  sigma.init <- mean(object$eps[1:object$r]^object$delta)

  # Calculate epsilon^delta
  eps.delta <- object$eps^object$delta

  # Check if object is GARCHX or GARCH
  if(is.na(object$gamma[1])){
    null = TRUE
  } else {
    null = FALSE
  } # End if-else

  # Calculate QMLE using likelihood
  # QMLE <- Likelihood(object, sigma.init = sigma.init, length(object$eps),
  #                    eps.delta = eps.delta, null)
  # Do we need to use nlminb here?

  p <- object$order[1]
  q <- object$order[2]
  # Using likelihood, calculate AIC value
  AIC <- 2 * length(object$eps) * object$Likelihood + (1 + p + q + object$d) * 2

  # Return AIC value
  return(AIC)
} # End AIC.GARCHX
