1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
|
\name{garchFit}
\alias{garchFit}
\alias{garchKappa}
\alias{.gogarchFit}
\concept{GARCH model}
\concept{APARCH model}
\concept{ARMA-GARCH model}
\concept{ARMA-APARCH model}
\concept{AR-GARCH model}
\concept{AR-APARCH model}
\concept{MA-GARCH model}
\concept{MA-APARCH model}
\concept{fit GARCH model}
\concept{fit APARCH model}
\concept{fit ARMA-GARCH model}
\concept{fit ARMA-APARCH model}
\concept{fit AR-GARCH model}
\concept{fit AR-APARCH model}
\concept{fit MA-GARCH model}
\concept{fit MA-APARCH model}
\title{Fit univariate and multivariate GARCH-type models}
\description{
Estimates the parameters of a univariate ARMA-GARCH/APARCH process, or
--- experimentally --- of a multivariate GO-GARCH process model. The
latter uses an algorithm based on \code{fastICA()}, inspired from
Bernhard Pfaff's package \CRANpkg{gogarch}.
}
\usage{
garchFit(formula = ~ garch(1, 1), data,
init.rec = c("mci", "uev"),
delta = 2, skew = 1, shape = 4,
cond.dist = c("norm", "snorm", "ged", "sged",
"std", "sstd", "snig", "QMLE"),
include.mean = TRUE, include.delta = NULL, include.skew = NULL,
include.shape = NULL,
leverage = NULL, trace = TRUE,
%recursion = c("internal", "filter", "testing"),
algorithm = c("nlminb", "lbfgsb", "nlminb+nm", "lbfgsb+nm"),
hessian = c("ropt", "rcd"),
control = list(),
title = NULL, description = NULL, \dots)
garchKappa(cond.dist = c("norm", "ged", "std", "snorm", "sged", "sstd", "snig"),
gamma = 0, delta = 2, skew = NA, shape = NA)
.gogarchFit(formula = ~garch(1, 1), data, init.rec = c("mci", "uev"),
delta = 2, skew = 1, shape = 4,
cond.dist = c("norm", "snorm", "ged", "sged",
"std", "sstd", "snig", "QMLE"),
include.mean = TRUE, include.delta = NULL, include.skew = NULL,
include.shape = NULL,
leverage = NULL, trace = TRUE,
algorithm = c("nlminb", "lbfgsb", "nlminb+nm", "lbfgsb+nm"),
hessian = c("ropt", "rcd"),
control = list(),
title = NULL, description = NULL, \dots)
}
\arguments{
% \item{recursion}{
% a string parameter that determines the recursion used for calculating
% the maximum log-likelihood function.
% Allowed values are ...
% }
\item{formula}{
\code{\link{formula}} object describing the mean and variance equation of the
ARMA-GARCH/APARCH model. A pure GARCH(1,1) model is selected
e.g., for \code{formula = ~garch(1,1)}. To specify an
ARMA(2,1)-APARCH(1,1) process, use \code{ ~ arma(2,1) + aparch(1,1)}.
}
\item{data}{
an optional \code{"timeSeries"} or \code{"data.frame"} object
containing the variables in the model. If not found in
\code{data}, the variables are taken from
\code{environment(formula)}, typically the environment from which
\code{armaFit} is called. If \code{data} is an univariate series,
then the series is converted into a numeric vector and the name of
the response in the formula will be neglected.
}
\item{init.rec}{
a character string indicating the method how to initialize the
mean and varaince recursion relation.
}
\item{delta}{
a numeric value, the exponent \code{delta} of the variance recursion.
By default, this value will be fixed, otherwise the exponent will be
estimated together with the other model parameters if
\code{include.delta=FALSE}.
}
\item{skew}{
a numeric value, the skewness parameter of the conditional
distribution.
}
\item{shape}{
a numeric value, the shape parameter of the conditional distribution.
}
\item{cond.dist}{
a character string naming the desired conditional distribution.
Valid values are \code{"dnorm"}, \code{"dged"}, \code{"dstd"},
\code{"dsnorm"}, \code{"dsged"}, \code{"dsstd"} and
\code{"QMLE"}. The default value is the normal distribution. See
Details for more information.
}
\item{include.mean}{
this flag determines if the parameter for the mean will be estimated
or not. If \code{include.mean=TRUE} this will be the case, otherwise
the parameter will be kept fixed durcing the process
of parameter optimization.
}
\item{include.delta}{a \code{\link{logical}} determining if the
parameter for the recursion equation \code{delta} will be estimated
or not. If false, the shape parameter will be kept fixed during the
process of parameter optimization.
}
\item{include.skew}{
a logical flag which determines if the parameter for the skewness
of the conditional distribution will be estimated or not. If
\code{include.skew=FALSE} then the skewness parameter will be kept
fixed during the process of parameter optimization.
}
\item{include.shape}{
a logical flag which determines if the parameter for the shape
of the conditional distribution will be estimated or not. If
\code{include.shape=FALSE} then the shape parameter will be kept
fixed during the process of parameter optimization.
}
\item{leverage}{
a logical flag for APARCH models. Should the model be leveraged?
By default \code{leverage=TRUE}.
}
\item{trace}{
a logical flag. Should the optimization process of fitting the
model parameters be printed? By default \code{trace=TRUE}.
}
\item{algorithm}{
a string parameter that determines the algorithm used for maximum
likelihood estimation.
% Allowed values are
% \code{"nmfb"},
% \code{"sqp"},
% \code{"nlminb"}, and
% \code{"bfgs"} where the third is the default
% setting. \code{"mnfb"} is a fully Fortran implemented and extremely
% fast version of the R-coded \code{"nlminb"} algorithm.
}
\item{hessian}{
a string denoting how the Hessian matrix should be evaluated,
either \code{hessian ="rcd"}, or \code{"ropt"}. The default,
\code{"rcd"} is a central difference approximation implemented
in \R and \code{"ropt"} uses the internal R function \code{optimhess}.
}
\item{control}{
control parameters, the same as used for the functions from
\code{nlminb}, and 'bfgs' and 'Nelder-Mead' from \code{optim}.
}
\item{gamma}{
APARCH leverage parameter entering into the formula for calculating
the expectation value.
}
\item{title}{
a character string which allows for a project title.
}
\item{description}{optional character string with a brief description.}
\item{\dots}{
additional arguments to be passed.
}
}
\details{
\code{"QMLE"} stands for Quasi-Maximum Likelihood Estimation, which
assumes normal distribution and uses robust standard errors for
inference. Bollerslev and Wooldridge (1992) proved that if the mean
and the volatility equations are correctly specified, the QML
estimates are consistent and asymptotically normally
distributed. However, the estimates are not efficient and \dQuote{the
efficiency loss can be marked under asymmetric ... distributions}
(Bollerslev and Wooldridge (1992), p. 166). The robust
variance-covariance matrix of the estimates equals the (Eicker-White)
sandwich estimator, i.e.
\deqn{V = H^{-1} G^{\prime} G H^{-1},}{V = H^(-1) G' G H^(-1),}
where \eqn{V}{V} denotes the variance-covariance matrix, \eqn{H}{H}
stands for the Hessian and \eqn{G}{G} represents the matrix of
contributions to the gradient, the elements of which are defined as
\deqn{G_{t,i} = \frac{\partial l_{t}}{\partial \zeta_{i}},}{%
G_{t,i} = derivative of l_{t} w.r.t. zeta_{i},}
where \eqn{t_{t}}{l_{t}} is the log likelihood of the t-th observation
and \eqn{\zeta_{i}}{zeta_{i}} is the i-th estimated parameter. See
sections 10.3 and 10.4 in Davidson and MacKinnon (2004) for a more
detailed description of the robust variance-covariance matrix.
}
\value{
for \code{garchFit}, an S4 object of class \code{"\linkS4class{fGARCH}"}.
Slot \code{@fit} contains the results from the optimization.
for \code{.gogarchFit()}: Similar definition for GO-GARCH modeling.
Here, \code{data} must be \emph{multivariate}.
Still \dQuote{preliminary}, mostly undocumented, and untested(!). At
least mentioned here...
}
\references{
ATT (1984);
\emph{PORT Library Documentation},
http://netlib.bell-labs.com/netlib/port/.
Bera A.K., Higgins M.L. (1993);
\emph{ARCH Models: Properties, Estimation and Testing},
J. Economic Surveys 7, 305--362.
Bollerslev T. (1986);
\emph{Generalized Autoregressive Conditional Heteroscedasticity},
Journal of Econometrics 31, 307--327.
Bollerslev T., Wooldridge J.M. (1992);
\emph{Quasi-Maximum Likelihood Estimation and Inference in Dynamic
Models with Time-Varying Covariance},
Econometric Reviews 11, 143--172.
Byrd R.H., Lu P., Nocedal J., Zhu C. (1995);
\emph{A Limited Memory Algorithm for Bound Constrained Optimization},
SIAM Journal of Scientific Computing 16, 1190--1208.
Davidson R., MacKinnon J.G. (2004);
\emph{Econometric Theory and Methods},
Oxford University Press, New York.
Engle R.F. (1982);
\emph{Autoregressive Conditional Heteroscedasticity with Estimates
of the Variance of United Kingdom Inflation},
Econometrica 50, 987--1008.
Nash J.C. (1990);
\emph{Compact Numerical Methods for Computers},
Linear Algebra and Function Minimisation,
Adam Hilger.
Nelder J.A., Mead R. (1965);
\emph{A Simplex Algorithm for Function Minimization},
Computer Journal 7, 308--313.
Nocedal J., Wright S.J. (1999);
\emph{Numerical Optimization},
Springer, New York.
}
\author{
Diethelm Wuertz for the Rmetrics \R-port,\cr
R Core Team for the 'optim' \R-port,\cr
Douglas Bates and Deepayan Sarkar for the 'nlminb' \R-port,\cr
Bell-Labs for the underlying PORT Library,\cr
Ladislav Luksan for the underlying Fortran SQP Routine, \cr
Zhu, Byrd, Lu-Chen and Nocedal for the underlying L-BFGS-B Routine.
Martin Maechler for cleaning up; \emph{mentioning}
\code{.gogarchFit()}.
}
\seealso{
\code{\link{garchSpec}},
\code{\link{garchFitControl}},
class \code{"\linkS4class{fGARCH}"}
}
\examples{
## UNIVARIATE TIME SERIES INPUT:
# In the univariate case the lhs formula has not to be specified ...
# A numeric Vector from default GARCH(1,1) - fix the seed:
N <- 200
x.vec <- as.vector(garchSim(garchSpec(rseed = 1985), n = N)[,1])
garchFit(~ garch(1,1), data = x.vec, trace = FALSE)
# An univariate timeSeries object with dummy dates:
stopifnot(require("timeSeries"))
x.timeSeries <- dummyDailySeries(matrix(x.vec), units = "GARCH11")
garchFit(~ garch(1,1), data = x.timeSeries, trace = FALSE)
\dontrun{
# An univariate zoo object:
require("zoo")
x.zoo <- zoo(as.vector(x.vec), order.by = as.Date(rownames(x.timeSeries)))
garchFit(~ garch(1,1), data = x.zoo, trace = FALSE)
}
# An univariate "ts" object:
x.ts <- as.ts(x.vec)
garchFit(~ garch(1,1), data = x.ts, trace = FALSE)
## MULTIVARIATE TIME SERIES INPUT:
##
# For multivariate data inputs the lhs formula must be specified ...
# A numeric matrix binded with dummy random normal variates:
X.mat <- cbind(GARCH11 = x.vec, R = rnorm(N))
garchFit(GARCH11 ~ garch(1,1), data = X.mat)
# A multivariate timeSeries object with dummy dates:
X.timeSeries <- dummyDailySeries(X.mat, units = c("GARCH11", "R"))
garchFit(GARCH11 ~ garch(1,1), data = X.timeSeries)
\dontrun{
# A multivariate zoo object:
X.zoo <- zoo(X.mat, order.by = as.Date(rownames(x.timeSeries)))
garchFit(GARCH11 ~ garch(1,1), data = X.zoo)
}
# A multivariate "mts" object:
X.mts <- as.ts(X.mat)
garchFit(GARCH11 ~ garch(1,1), data = X.mts)
## MODELING THE PERCENTUAL SPI/SBI SPREAD FROM LPP BENCHMARK:
stopifnot(require("timeSeries"))
X.timeSeries <- as.timeSeries(data(LPP2005REC))
X.mat <- as.matrix(X.timeSeries)
\dontrun{X.zoo <- zoo(X.mat, order.by = as.Date(rownames(X.mat)))}
X.mts <- ts(X.mat)
garchFit(100*(SPI - SBI) ~ garch(1,1), data = X.timeSeries)
# The remaining are not yet supported ...
# garchFit(100*(SPI - SBI) ~ garch(1,1), data = X.mat)
# garchFit(100*(SPI - SBI) ~ garch(1,1), data = X.zoo)
# garchFit(100*(SPI - SBI) ~ garch(1,1), data = X.mts)
## MODELING HIGH/LOW RETURN SPREADS FROM MSFT PRICE SERIES:
X.timeSeries <- MSFT
garchFit(Open ~ garch(1,1), data = returns(X.timeSeries))
garchFit(100*(High-Low) ~ garch(1,1), data = returns(X.timeSeries))
## GO-GARCH Modelling (not yet!!) % FIXME
## data(DowJones30, package="fEcofin") # no longer exists
## X <- returns(as.timeSeries(DowJones30)); head(X)
## N <- 5; ans <- .gogarchFit(data = X[, 1:N], trace = FALSE); ans
## ans@h.t
}
\keyword{models}
|