BIC.GARCHX <- function(object, ...){
  # Calculate initial value of sigma^2
  #sigma2.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 the object is a GARCHX or GARCH object
  if(is.na(object$gamma[1])){
    null = FALSE
  } else {
    null = TRUE
  } # End if-else

  # Calculate QMLE of GARCHX object
  # QMLE <- Likelihood(object, sigma.init = sigma.init, length(object$eps),
  #                    eps.delta = eps.delta, null = null)
  # Should nlminb be used here?

  p <- object$order[1]
  q <- object$order[2]
  # Calculate BIC of object
  BIC <- 2 * length(object$eps) * object$Likelihood + (1 + p + q + object$d) * log(length(object$eps))

  return(BIC)
} # End BIC.GARCHX
