muSigmaGarch {CLA} | R Documentation |
Compute (mu, Sigma) for a Set of Assets via GARCH fit
Description
Compute (mu, Sigma) for a set of assets via a GARCH fit to each
individual asset, using package
fGarch's garchFit()
.
Usage
muSigmaGarch(x, formula = ~garch(1, 1), cond.dist = "std", trace = FALSE,
...)
Arguments
x |
numeric matrix or data frame ( |
formula |
optional formula for |
cond.dist |
the conditional distribution to be used for the garch process. |
trace |
logical indicating if some progress of |
... |
optional arguments to |
Value
a list with components
mu |
numeric vector of length |
covar |
covariance matrix ( |
See Also
muS.sp500
which has been produced via muSigmaGarch
.
CLA
which needs (mu, covar)
as crucial input.
Examples
if(requireNamespace("FRAPO")) {
data(NASDAQ, package = "FRAPO")
## 12 randomly picked stocks from NASDAQ data
iS <- if(FALSE) { ## created (w/ warning, in new R) by
RNGversion("3.5.0"); set.seed(17); iS <- sample(ncol(NASDAQ), 12)
} else c(341L, 2126L, 1028L, 1704L, 895L, 1181L, 454L, 410L, 1707L, 425L, 950L, 5L)
X. <- NASDAQ[, iS]
muSig <- muSigmaGarch(X.)
stopifnot(identical(names(muSig$mu), names(NASDAQ)[iS]),
identical(dim(muSig$covar), c(12L,12L)),
all.equal(unname(muSig$mu),
c( 7.97, -4.05, -14, 21.5, -5.36, -15.3,
-15.9, 11.8, -1.64, -14, 3.13, 121) / 10000,
tol = 0.0015))
}
[Package CLA version 0.96-3 Index]