\name{GARCHX}
\alias{GARCHX}
\title{Fitting a GARCH-X model}
\usage{
GARCHX(
  eps,
  X,
  order = c(1, 1),
  delta = 2,
  covariates = "all",
  optim.method = "NR"
)
}
\arguments{
\item{eps}{Time series}

\item{X}{Matrix with exogenous covariates where the number of rows is equal to the length of eps and columns represent the covariates.}

\item{order}{Order of the GARCH model. Value of p cannot be 0.}

\item{delta}{Value of the power of the main time series to allow for Power GARCHX, default is 2 for GARCHX.}

\item{covariates}{Instead of slicing X when building partial models, you can specify a vector of column indices. Defaults to "all".}

\item{optim.method}{Optimization method for maximizing quasi-likelihood function. Options: "NR", "L-BFGS-B", "GA", "PS", "SA". Default value is "NR".}
}
\value{
An object of class GARCHX
}
\description{
Fits a GARCHX model with given data and estimates the coefficients for omega, alpha, beta, and gamma
}
\details{
Uses the GARCHX model \deqn{\mathcal{E}_t = \sigma_tw_t}
\deqn{\sigma^2_t = \omega_0 + \sum^{p}_{i=1}\alpha_i\mathcal{E}_{t-i}^2 + \sum^q_{j=1}\beta_j\sigma^2_{t-j}+\mathbf{\gamma}^T\mathbf{x}_{t-1}}

To estimate the coefficients for \deqn{\omega, \alpha, \beta, \gamma}.
}
\examples{
# We simulate a time-series as in the simulate.GARCHX example. 
set.seed(1)
n <- 200
d <- 4
valinit <- 100
n2 <- n + d + 1
omega <- 0.05
alpha <- 0.05
beta <- 0.05
delta <- 2
gamma <- rep(0.05, d)
e<-rnorm(n2+valinit)
Y<-e
for (t in 2:n2)
 Y[t]<- 0.2*Y[t-1]+e[t]
x<-exp(Y)
X <- matrix(0, nrow = (n+valinit), ncol = length(gamma))
for(j in 1:d)
 X[, j] <- x[(d+2-j):(n+d+1-j+valinit)]
data <- sim.GARCHX(n = n, omega = omega, alpha = alpha, beta = beta, 
                   delta = delta, X = X, gamma = gamma, valinit = valinit)

# Then we fit the model
model <- GARCHX(data$eps, data$X, order = c(1, 1), delta = 2, 
                covariates = "all", optim.method = "NR")

# We inspect the model summary
summary(model)
}
