[Gogarch-commits] r17 - in pkg: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Feb 3 22:42:00 CET 2009
Author: bpfaff
Date: 2009-02-03 22:42:00 +0100 (Tue, 03 Feb 2009)
New Revision: 17
Added:
pkg/R/GoGARCH-predict.R
pkg/R/Goestml-predict.R
pkg/R/Goestnls-ccor.R
pkg/R/Goestnls-ccov.R
pkg/R/Goestnls-coef.R
pkg/R/Goestnls-converged.R
pkg/R/Goestnls-cvar.R
pkg/R/Goestnls-formula.R
pkg/R/Goestnls-goest.R
pkg/R/Goestnls-predict.R
pkg/R/Goestnls-residuals.R
pkg/R/Goestnls-show.R
pkg/R/Goestnls-summary.R
pkg/R/Goestnls-update.R
pkg/R/Gopredict-ccor.R
pkg/R/Gopredict-ccov.R
pkg/R/Gopredict-cvar.R
pkg/R/Gopredict-show.R
pkg/R/gonls.R
pkg/man/Goestnls-class.Rd
pkg/man/Gopredict-class.Rd
pkg/man/gonls.Rd
Modified:
pkg/DESCRIPTION
pkg/NAMESPACE
pkg/R/All-classes.R
pkg/R/All-generics.R
pkg/R/GoGARCH-summary.R
pkg/R/Gosum-show.R
pkg/R/gogarch.R
pkg/R/goinit.R
pkg/R/gotheta.R
pkg/man/GoGARCH-class.Rd
pkg/man/Goestml-class.Rd
pkg/man/Goinit-class.Rd
pkg/man/Gosum-class.Rd
pkg/man/gogarch.Rd
Log:
Classes, methods and functions added.
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/DESCRIPTION 2009-02-03 21:42:00 UTC (rev 17)
@@ -1,8 +1,8 @@
Package: gogarch
-Version: 0.3-5
+Version: 0.4-0
Type: Package
Title: Generalized Orthogonal GARCH (GO-GARCH) models
-Date: 2009-02-02
+Date: 2009-02-03
Author: Bernhard Pfaff
Maintainer: Bernhard Pfaff <bernhard at pfaffikus.de>
Depends: R (>= 2.7.0), methods, stats, fGarch
@@ -11,4 +11,3 @@
License: GPL (>= 2)
LazyLoad: yes
LazyLoad: yes
-
Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/NAMESPACE 2009-02-03 21:42:00 UTC (rev 17)
@@ -2,16 +2,16 @@
import(methods)
## Import functions
-importFrom(stats, coef, formula, logLik, residuals, update)
+importFrom(stats, coef, formula, logLik, predict, residuals, update)
## Classes
-exportClasses(Goestml, GoGARCH, Goinit, Gosum, Orthom)
+exportClasses(Goestml, Goestnls, GoGARCH, Goinit, Gopredict, Gosum, Orthom)
## Methods
-exportMethods(angles, cvar, ccor, ccov, coef, converged, formula, goest, logLik, M, print, show, summary, t, residuals, update)
+exportMethods(angles, cvar, ccor, ccov, coef, converged, formula, goest, logLik, M, predict, print, show, summary, t, residuals, update)
## Functions
-export(gogarch, goinit, gollh, gotheta, Rd2, UprodR, unvech, validOrthomObject, validGoinitObject)
+export(gogarch, goinit, gollh, gonls, gotheta, Rd2, UprodR, unvech, validOrthomObject, validGoinitObject)
Modified: pkg/R/All-classes.R
===================================================================
--- pkg/R/All-classes.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/All-classes.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -1,7 +1,7 @@
##
## Class definition of initial GO-GARCH objects
##
-setClass(Class = "Goinit", representation(X = "matrix", V = "matrix", P = "matrix", Dsqr = "matrix", garchf = "formula"))
+setClass(Class = "Goinit", representation(X = "matrix", V = "matrix", P = "matrix", Dsqr = "matrix", garchf = "formula", name = "character"))
##
## Class definition of GO-GARCH objects
##
@@ -11,10 +11,18 @@
##
setClass(Class = "Goestml", representation(opt = "list"), contains = "GoGARCH")
##
+## Class definition of GO-GARCH objects, estimated by Maximum-Likelihood
+##
+setClass(Class = "Goestnls", representation(nls = "list"), contains = "GoGARCH")
+##
## Class definition for summary objects from GoGARCH
##
setClass(Class = "Gosum", representation(name = "character", method = "character", model = "formula", garchc = "list", Zinv = "matrix"))
##
+## Class definition for predict objects from GoGARCH
+##
+setClass(Class = "Gopredict", representation(Hf = "list", Xf = "matrix", CGARCHF = "list"))
+##
## Class definition of orthogonal matrices
##
setClass(Class = "Orthom", representation(M = "matrix"))
Modified: pkg/R/All-generics.R
===================================================================
--- pkg/R/All-generics.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/All-generics.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -32,6 +32,7 @@
setGeneric("coef")
setGeneric("formula")
setGeneric("logLik")
+setGeneric("predict")
setGeneric("residuals")
setGeneric("summary")
setGeneric("t")
Added: pkg/R/GoGARCH-predict.R
===================================================================
--- pkg/R/GoGARCH-predict.R (rev 0)
+++ pkg/R/GoGARCH-predict.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,18 @@
+setMethod(f = "predict", signature(object = "GoGARCH"), definition = function(object, n.ahead = 10, ...){
+ n.ahead <- abs(as.integer(n.ahead))
+ m <- ncol(object at X)
+ n <- nrow(object at X)
+ Z <- object at Z
+ delta <- object at models[[1]]@fit$params$params["delta"]
+ predictions <- lapply(object at models, predict, n.ahead = n.ahead)
+ mean.pred.y <- matrix(unlist(lapply(predictions, function(x) x[, 1])), ncol = m)
+ mean.pred.x <- mean.pred.y %*% Z
+ rownames(mean.pred.x) <- seq(from = 1, to = n.ahead) + n
+ colnames(mean.pred.x) <- paste(colnames(object at X), ".f", sep = "")
+ h.pred.y <- matrix(unlist(lapply(predictions, function(x) x[, 3]^delta)), ncol = m)
+ H.pred.y <- data.frame(t(h.pred.y))
+ H.pred.x <- lapply(H.pred.y, function(x) Z %*% diag(x) %*% t(Z))
+ names(H.pred.x) <- rownames(mean.pred.x)
+ fcst <- new("Gopredict", Hf = H.pred.x, Xf = mean.pred.x, CGARCHF = predictions)
+ return(fcst)
+})
Modified: pkg/R/GoGARCH-summary.R
===================================================================
--- pkg/R/GoGARCH-summary.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/GoGARCH-summary.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -1,5 +1,5 @@
setMethod(f = "summary", signature(object = "GoGARCH"), definition = function(object){
- name <- as.character(object at CALL$data)
+ name <- object at name
method <- object at estby
model <- object at garchf
garchc <- lapply(object at models, function(x) x at fit$matcoef)
Added: pkg/R/Goestml-predict.R
===================================================================
--- pkg/R/Goestml-predict.R (rev 0)
+++ pkg/R/Goestml-predict.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "predict", signature(object = "Goestml"), definition = function(object, n.ahead = 10, ...){
+ callNextMethod()
+})
Added: pkg/R/Goestnls-ccor.R
===================================================================
--- pkg/R/Goestnls-ccor.R (rev 0)
+++ pkg/R/Goestnls-ccor.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "ccor", signature(object = "Goestnls"), definition = function(object){
+ ccor(as(object, "GoGARCH"))
+})
Added: pkg/R/Goestnls-ccov.R
===================================================================
--- pkg/R/Goestnls-ccov.R (rev 0)
+++ pkg/R/Goestnls-ccov.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "ccov", signature(object = "Goestnls"), definition = function(object){
+ ccov(as(object, "GoGARCH"))
+})
Added: pkg/R/Goestnls-coef.R
===================================================================
--- pkg/R/Goestnls-coef.R (rev 0)
+++ pkg/R/Goestnls-coef.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,4 @@
+setMethod(f = "coef", signature(object = "Goestnls"), definition = function(object){
+ callNextMethod()
+})
+
Added: pkg/R/Goestnls-converged.R
===================================================================
--- pkg/R/Goestnls-converged.R (rev 0)
+++ pkg/R/Goestnls-converged.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "converged", signature(object = "Goestnls"), definition = function(object){
+ converged(as(object, "GoGARCH"))
+})
Added: pkg/R/Goestnls-cvar.R
===================================================================
--- pkg/R/Goestnls-cvar.R (rev 0)
+++ pkg/R/Goestnls-cvar.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "cvar", signature(object = "Goestnls"), definition = function(object){
+ cvar(as(object, "GoGARCH"))
+})
Added: pkg/R/Goestnls-formula.R
===================================================================
--- pkg/R/Goestnls-formula.R (rev 0)
+++ pkg/R/Goestnls-formula.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod("formula", signature(x = "Goestnls"), function(x, ...)
+ x at garchf
+)
Added: pkg/R/Goestnls-goest.R
===================================================================
--- pkg/R/Goestnls-goest.R (rev 0)
+++ pkg/R/Goestnls-goest.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,27 @@
+setMethod(f = "goest", signature(object = "Goestnls"), definition = function(object, initial, garchlist, ...){
+ X <- object at X
+ m <- ncol(X)
+ n <- nrow(X)
+ Dsqr <- object at Dsqr
+ Dsqri <- diag(1 / diag(Dsqr))
+ P <- object at P
+ S <- data.frame(t(X %*% Dsqri %*% P))
+ SSI <- lapply(S, function(x) x %*% t(x) - diag(m))
+ SSI0 <- SSI[-1]
+ SSI1 <- SSI[-n]
+ SSI <- list(SSI0 = SSI0, SSI1 = SSI1)
+ nlsobj <- optim(par = initial, fn = gonls, SSI = SSI, ...)
+ B <- unvech(nlsobj$par)
+ U <- svd(B)$u
+ U <- eigen(B)$vectors
+ Z <- P %*% Dsqr %*% t(U)
+ Zinv <- solve(Z)
+ Y <- X %*% Zinv
+ fitted <- apply(Y, 2, function(x) do.call("garchFit", c(list(formula = object at garchf, data = quote(x)), garchlist)))
+ H <- matrix(unlist(lapply(fitted, function(x) x at h.t)), ncol = m, nrow = n)
+ Hdf <- data.frame(t(H))
+ Ht <- lapply(Hdf, function(x) Z %*% diag(x) %*% t(Z))
+ names(Ht) <- rownames(object at X)
+ result <- new("Goestnls", nls = nlsobj, estby = "non-linear Least-Squares", Z = Z, Y = Y, H = Ht, models = fitted, X = object at X, P = object at P, Dsqr = object at Dsqr, V = object at V, garchf = object at garchf, name = object at name)
+ return(result)
+})
Added: pkg/R/Goestnls-predict.R
===================================================================
--- pkg/R/Goestnls-predict.R (rev 0)
+++ pkg/R/Goestnls-predict.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "predict", signature(object = "Goestnls"), definition = function(object, n.ahead = 10, ...){
+ callNextMethod()
+})
Added: pkg/R/Goestnls-residuals.R
===================================================================
--- pkg/R/Goestnls-residuals.R (rev 0)
+++ pkg/R/Goestnls-residuals.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,5 @@
+setMethod(f = "residuals", signature(object = "Goestnls"), definition = function(object, standardize = FALSE){
+ callNextMethod(object = object, standardize = standardize)
+})
+
+
Added: pkg/R/Goestnls-show.R
===================================================================
--- pkg/R/Goestnls-show.R (rev 0)
+++ pkg/R/Goestnls-show.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "show", signature(object = "Goestml"), definition = function(object){
+ callNextMethod()
+})
Added: pkg/R/Goestnls-summary.R
===================================================================
--- pkg/R/Goestnls-summary.R (rev 0)
+++ pkg/R/Goestnls-summary.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,3 @@
+setMethod(f = "summary", signature(object = "Goestnls"), definition = function(object){
+ callNextMethod()
+})
Added: pkg/R/Goestnls-update.R
===================================================================
--- pkg/R/Goestnls-update.R (rev 0)
+++ pkg/R/Goestnls-update.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,17 @@
+setMethod("update", signature(object = "Goestnls"), function(object, formula., ..., evaluate = TRUE){
+ call <- object at CALL
+ extras <- match.call(expand.dots = FALSE)$...
+ if (!missing(formula.))
+ call$formula <- update.formula(formula(object), formula.)
+ if (length(extras) > 0) {
+ existing <- !is.na(match(names(extras), names(call)))
+ for (a in names(extras)[existing]) call[[a]] <- extras[[a]]
+ if (any(!existing)) {
+ call <- c(as.list(call), extras[!existing])
+ call <- as.call(call)
+ }
+ }
+ if (evaluate)
+ eval(call, parent.frame())
+ else call
+})
Added: pkg/R/Gopredict-ccor.R
===================================================================
--- pkg/R/Gopredict-ccor.R (rev 0)
+++ pkg/R/Gopredict-ccor.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,14 @@
+setMethod(f = "ccor", signature(object = "Gopredict"), definition = function(object){
+ m <- ncol(object at Xf)
+ d <- m * (m - 1) / 2
+ n <- nrow(object at Xf)
+ cnames <- colnames(object at Xf)
+ ccor <- matrix(c(unlist(lapply(object at Hf, function(x) cov2cor(x)[lower.tri(x)]))), ncol = d, nrow = n, byrow = TRUE)
+ ngrid <- data.frame(expand.grid(cnames, cnames), stringsAsFactors = FALSE)
+ mgrid <- paste(ngrid[, 1], ngrid[, 2], sep = " & ")
+ mgrid <- matrix(mgrid, nrow = m, ncol = m)
+ names <- mgrid[lower.tri(mgrid)]
+ colnames(ccor) <- names
+ rownames(ccor) <- rownames(object at Xf)
+ return(ccor)
+})
Added: pkg/R/Gopredict-ccov.R
===================================================================
--- pkg/R/Gopredict-ccov.R (rev 0)
+++ pkg/R/Gopredict-ccov.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,14 @@
+setMethod(f = "ccov", signature(object = "Gopredict"), definition = function(object){
+ m <- ncol(object at Xf)
+ d <- m * (m - 1) / 2
+ n <- nrow(object at Xf)
+ cnames <- colnames(object at Xf)
+ ccov <- matrix(c(unlist(lapply(object at Hf, function(x) x[lower.tri(x)]))), ncol = d, nrow = n, byrow = TRUE)
+ ngrid <- data.frame(expand.grid(cnames, cnames), stringsAsFactors = FALSE)
+ mgrid <- paste(ngrid[, 1], ngrid[, 2], sep = " & ")
+ mgrid <- matrix(mgrid, nrow = m, ncol = m)
+ names <- mgrid[lower.tri(mgrid)]
+ colnames(ccov) <- names
+ rownames(ccov) <- rownames(object at Xf)
+ return(ccov)
+})
Added: pkg/R/Gopredict-cvar.R
===================================================================
--- pkg/R/Gopredict-cvar.R (rev 0)
+++ pkg/R/Gopredict-cvar.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,8 @@
+setMethod(f = "cvar", signature(object = "Gopredict"), definition = function(object){
+ m <- ncol(object at Xf)
+ n <- nrow(object at Xf)
+ cvar <- matrix(c(unlist(lapply(object at Hf, function(x) diag(x)))), ncol = m, nrow = n, byrow = TRUE)
+ colnames(cvar) <- paste("V.", colnames(object at Xf), sep = "")
+ rownames(cvar) <- rownames(object at Xf)
+ return(cvar)
+})
Added: pkg/R/Gopredict-show.R
===================================================================
--- pkg/R/Gopredict-show.R (rev 0)
+++ pkg/R/Gopredict-show.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,26 @@
+setMethod(f = "show", signature = "Gopredict", function(object){
+ title <- "*** Forecasts of GO-GARCH Model ***"
+ stars <- paste(rep("*", nchar(title)), collapse = "")
+ cat("\n")
+ cat(paste(stars, "\n"))
+ cat(paste(title, "\n"))
+ cat(paste(stars, "\n"))
+ cat("\n")
+ if(nrow(object at Xf) <= 10){
+ cat("Conditional variances:\n")
+ print(cvar(object))
+ cat("\n")
+ cat("\n")
+ cat("Forecasts of Mean Equation:\n")
+ print(object at Xf)
+ cat("\n")
+ } else {
+ cat("Head of conditional variances:\n")
+ print(head(cvar(object)))
+ cat("\n")
+ cat("\n")
+ cat("Forecasts of Mean Equation:\n")
+ print(head(object at Xf))
+ cat("\n")
+ }
+})
Modified: pkg/R/Gosum-show.R
===================================================================
--- pkg/R/Gosum-show.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/Gosum-show.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -34,4 +34,4 @@
}
invisible(object)
})
-
+
Modified: pkg/R/gogarch.R
===================================================================
--- pkg/R/gogarch.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/gogarch.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -1,22 +1,36 @@
-gogarch <- function(data, formula, scale = FALSE, method = c("ml"), initial = NULL, garchlist = list(init.rec = "mci", delta = 2, skew = 1, shape = 4, cond.dist = "norm", include.mean = FALSE, include.delta = NULL, include.skew = NULL, include.shape = NULL, leverage = NULL, trace = FALSE, algorithm = "nlminb", hessian = "ropt", control = list(), title = NULL, description = NULL), ...){
+gogarch <- function(data, formula, scale = FALSE, method = c("ml", "nls"), initial = NULL, garchlist = list(init.rec = "mci", delta = 2, skew = 1, shape = 4, cond.dist = "norm", include.mean = FALSE, include.delta = NULL, include.skew = NULL, include.shape = NULL, leverage = NULL, trace = FALSE, algorithm = "nlminb", hessian = "ropt", control = list(), title = NULL, description = NULL), ...){
method <- match.arg(method)
Call <- match.call()
d <- ncol(data)
- if(is.null(initial)){
- l <- d * (d - 1)/2
- initial <- seq(3.0, 0.1, length.out = l)
- } else {
- l <- length(initial)
- if (l != d * (d - 1)/2) {
- stop(paste("\nLength of initial vector does not match implied dimension of orthogonal matrix.\n", "It should have length: ", d, sep = ""))
- }
- }
gini <- goinit(X = data, garchf = formula, scale = scale)
gomod <- new("GoGARCH", gini)
if(method == "ml"){
+ if(is.null(initial)){
+ l <- d * (d - 1)/2
+ initial <- seq(3.0, 0.1, length.out = l)
+ } else {
+ l <- length(initial)
+ if (l != d * (d - 1)/2) {
+ stop(paste("\nLength of initial vector does not match implied dimension of orthogonal matrix.\n", "It should have length: ", d * (d - 1)/2, sep = ""))
+ }
+ }
goestml <- new("Goestml", gomod)
gogarch <- goest(object = goestml, initial = initial, garchlist = garchlist, ...)
}
+ if(method == "nls"){
+ if(is.null(initial)){
+ l <- d * (d + 1)/2
+ initial <- rep(0.1, l)
+ } else {
+ l <- length(initial)
+ if (l != d * (d + 1)/2) {
+ stop(paste("\nLength of initial vector does not match length of vech(B).\n", "It should have length: ", d * (d + 1)/2, sep = ""))
+ }
+ }
+ goestnls <- new("Goestnls", gomod)
+ gogarch <- goest(object = goestnls, initial = initial, garchlist = garchlist, ...)
+ }
gogarch at CALL <- Call
+ gogarch at name <- deparse(substitute(data))
return(gogarch)
}
Modified: pkg/R/goinit.R
===================================================================
--- pkg/R/goinit.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/goinit.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -1,4 +1,5 @@
goinit <- function(X, garchf = ~ garch(1, 1), scale = FALSE){
+ dname <- deparse(substitute(X))
X <- as.matrix(X)
if(ncol(X) > nrow(X)){
stop("\nMatrix has more columns than rows.\n")
@@ -11,6 +12,6 @@
svd <- svd(V)
P <- svd$u
Dsqr <- diag(sqrt(svd$d))
- result <- new("Goinit", X = X, V = V, P = P, Dsqr = Dsqr, garchf = garchf)
+ result <- new("Goinit", X = X, V = V, P = P, Dsqr = Dsqr, garchf = garchf, name = dname)
return(result)
}
Added: pkg/R/gonls.R
===================================================================
--- pkg/R/gonls.R (rev 0)
+++ pkg/R/gonls.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,12 @@
+gonls <-
+function(params, SSI){
+ B <- unvech(params)
+ n <- length(SSI[[1]]) - 1
+ fl <- list()
+ length(fl) <- n
+ for(i in 1:n){
+ fl[[i]] <- (SSI[[1]][[i]] - B %*% SSI[[2]][[i]] %*% B)^2
+ }
+ f <- sum(unlist(lapply(fl, function(x) sum(diag(x))))) / n
+ return(f)
+}
Modified: pkg/R/gotheta.R
===================================================================
--- pkg/R/gotheta.R 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/R/gotheta.R 2009-02-03 21:42:00 UTC (rev 17)
@@ -19,6 +19,6 @@
Hdf <- data.frame(t(H))
Ht <- lapply(Hdf, function(x) Z %*% diag(x) %*% t(Z))
names(Ht) <- rownames(object at X)
- result <- new("GoGARCH", Z = Z, Y = Y, H = Ht, models = fitted, X = object at X, P = object at P, Dsqr = object at Dsqr, V = object at V, garchf = object at garchf, CALL = match.call())
+ result <- new("GoGARCH", Z = Z, Y = Y, H = Ht, models = fitted, X = object at X, P = object at P, Dsqr = object at Dsqr, V = object at V, garchf = object at garchf, name = object at name, CALL = match.call())
return(result)
}
Modified: pkg/man/GoGARCH-class.Rd
===================================================================
--- pkg/man/GoGARCH-class.Rd 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/man/GoGARCH-class.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -11,6 +11,7 @@
\alias{coef,GoGARCH-method}
\alias{converged,GoGARCH-method}
\alias{formula,GoGARCH-method}
+\alias{predict,GoGARCH-method}
\alias{residuals,GoGARCH-method}
\alias{show,GoGARCH-method}
\alias{summary,GoGARCH-method}
@@ -48,7 +49,9 @@
eigenvalues on diagonal, else zero.}
\item{\code{garchf}:}{Object of class \code{"formula"}: Garch
formula used for uncorrelated component GARCH models.}
- }
+ \item{\code{name}:}{Object of class \code{"character"}: The name of
+ the original data object.}
+ }
}
\section{Extends}{
@@ -64,9 +67,13 @@
\item{converged}{Returns the convergence codes of the component
GARCH models.}
\item{formula}{Returns the formula for the component GARCH models.}
+ \item{predict}{Returns the conditional covariances and mean
+ forecasts and the forecasts of the component GARCH models, object is
+ of class \code{Gopredict}.}
\item{residuals}{Returns the residuals of the component GARCH models.}
\item{show}{show-method for objects of class \code{GoGARCH}.}
- \item{summary}{summary-method for objects of class \code{Goestml}.}
+ \item{summary}{summary-method for objects of class \code{GoGARCH},
+ object is of class \code{Gosum}.}
\item{update}{Updates an object of class \code{GoGARCH}.}
}
}
@@ -76,7 +83,7 @@
}
\seealso{
- \code{\linkS4class{Goinit}}
+ \code{\linkS4class{Goinit}}, \code{\linkS4class{Gosum}}, \code{\linkS4class{Gopredict}}
}
\keyword{classes}
Modified: pkg/man/Goestml-class.Rd
===================================================================
--- pkg/man/Goestml-class.Rd 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/man/Goestml-class.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -19,6 +19,7 @@
\alias{converged,Goestml-method}
\alias{formula,Goestml-method}
\alias{logLik,Goestml-method}
+\alias{predict,Goestml-method}
\alias{residuals,Goestml-method}
\alias{show,Goestml-method}
\alias{summary,Goestml-method}
@@ -27,17 +28,18 @@
\title{Class "Goestml": GO-GARCH models estimated by Maximum-Likelihood}
\description{This class contains the \code{GoGARCH} class and has the
- outcome of \code{optim} as an additional slot.
+ outcome of \code{nlminb} as an additional slot.
}
\section{Objects from the Class}{
-Objects can be created by calls of the form \code{new("Goestml", ...)}.
+Objects can be created by calls of the form \code{new("Goestml", ...)},
+or with the function \code{gogarch}.
}
\section{Slots}{
\describe{
\item{\code{opt}:}{Object of class \code{"list"}: List returned by
- \code{optim}.}
+ \code{nlminb}.}
\item{\code{Z}:}{Object of class \code{"matrix"}: Transformation matrix.}
\item{\code{Y}:}{Object of class \code{"matrix"}: Extracted
component matrix.}
@@ -55,6 +57,8 @@
eigenvalues on diagonal, else zero.}
\item{\code{garchf}:}{Object of class \code{"formula"}: Garch
formula used for uncorrelated component GARCH models.}
+ \item{\code{name}:}{Object of class \code{"character"}: The name of
+ the original data object.}
}
}
@@ -75,9 +79,13 @@
\item{formula}{Returns the formula for the component GARCH models.}
\item{goest}{ML-Estimation of Go-GARCH models.}
\item{logLik}{Returns the value of the log-Likelihood function.}
+ \item{predict}{Returns the conditional covariances and mean
+ forecasts and the forecasts of the component GARCH models, object is
+ of class \code{Gopredict}.}
\item{residuals}{Returns the residuals of the component GARCH models.}
\item{show}{show-method for objects of class \code{Goestml}.}
- \item{summary}{summary-method for objects of class \code{Goestml}.}
+ \item{summary}{summary-method for objects of class \code{Goestml},
+ object is of class \code{Gosum}.}
\item{update}{Updates an object of class \code{Goestml}.}
}
}
@@ -89,6 +97,7 @@
\seealso{
\code{\linkS4class{GoGARCH}}, \code{\linkS4class{Goinit}},
+ \code{\linkS4class{Gosum}}, \code{\linkS4class{Gopredict}},
\code{\link{goest-methods}}
}
Added: pkg/man/Goestnls-class.Rd
===================================================================
--- pkg/man/Goestnls-class.Rd (rev 0)
+++ pkg/man/Goestnls-class.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,94 @@
+\name{Goestnls-class}
+
+\encoding{latin1}
+
+\docType{class}
+
+\alias{Goestnls-class}
+\alias{cvar,Goestnls-method}
+\alias{ccov,Goestnls-method}
+\alias{ccor,Goestnls-method}
+\alias{coef,Goestnls-method}
+\alias{converged,Goestnls-method}
+\alias{formula,Goestnls-method}
+\alias{goest,Goestnls-method}
+\alias{predict,Goestnls-method}
+\alias{residuals,Goestnls-method}
+\alias{show,Goestnls-method}
+\alias{summary,Goestnls-method}
+\alias{update,Goestnls-method}
+
+\title{Class "Goestnls": GO-GARCH models estimated by non-linear Least-Squares}
+
+\description{
+ This class contains the \code{GoGARCH} class and has the
+ outcome of \code{optim} as an additional slot.
+}
+
+\section{Objects from the Class}{
+Objects can be created by calls of the form \code{new("Goestnls", ...)},
+or with the function \code{gogarch}.
+}
+
+\section{Slots}{
+ \describe{
+ \item{\code{nls}:}{Object of class \code{"list"}: List returned by
+ \code{nlminb}.}
+ \item{\code{Z}:}{Object of class \code{"matrix"}: Transformation matrix.}
+ \item{\code{Y}:}{Object of class \code{"matrix"}: Extracted
+ component matrix.}
+ \item{\code{H}:}{Object of class \code{"list"}: List of conditional
+ variance/covariance matrices.}
+ \item{\code{models}:}{Object of class \code{"list"}: List of
+ univariate GARCH model fits.}
+ \item{\code{estby}:}{Object of class \code{"character"}: Estimation method.}
+ \item{\code{X}:}{Object of class \code{"matrix"}: The data matrix.}
+ \item{\code{V}:}{Object of class \code{"matrix"}: Covariance matrix
+ of \code{X}.}
+ \item{\code{P}:}{Object of class \code{"matrix"}: Left singular
+ values of Var/Cov matrix of \code{X}.}
+ \item{\code{Dsqr}:}{Object of class \code{"matrix"}: Square roots of
+ eigenvalues on diagonal, else zero.}
+ \item{\code{garchf}:}{Object of class \code{"formula"}: Garch
+ formula used for uncorrelated component GARCH models.}
+ \item{\code{name}:}{Object of class \code{"character"}: The name of
+ the original data object.}
+ }
+}
+\section{Extends}{
+Class \code{"\linkS4class{GoGARCH}"}, directly.
+Class \code{"\linkS4class{Goinit}"}, by class "GoGARCH", distance 2.
+}
+\section{Methods}{
+ \describe{
+ \item{cvar}{Returns the conditional variances.}
+ \item{ccov}{Returns the conditional co-variances.}
+ \item{ccor}{Returns the conditional correlations.}
+ \item{coef}{Returns the coeffiecients of the component GARCH models.}
+ \item{converged}{Returns the convergence codes of the component
+ GARCH models.}
+ \item{formula}{Returns the formula for the component GARCH models.}
+ \item{goest}{NLS-Estimation of Go-GARCH models.}
+ \item{predict}{Returns the conditional covariances and mean
+ forecasts and the forecasts of the component GARCH models, object is
+ of class \code{Gopredict}.}
+ \item{residuals}{Returns the residuals of the component GARCH models.}
+ \item{show}{show-method for objects of class \code{Goestnls}.}
+ \item{summary}{summary-method for objects of class \code{GoGARCH},
+ object is of class \code{Gosum}.}
+ \item{update}{Updates an object of class \code{GoGARCH}.}
+ }
+}
+
+\author{
+ Bernhard Pfaff
+}
+
+\seealso{
+ \code{\linkS4class{GoGARCH}}, \code{\linkS4class{Goinit}},
+ \code{\linkS4class{Gosum}}, \code{\linkS4class{Gopredict}},
+ \code{\link{goest-methods}}
+}
+
+
+\keyword{classes}
Modified: pkg/man/Goinit-class.Rd
===================================================================
--- pkg/man/Goinit-class.Rd 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/man/Goinit-class.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -28,7 +28,8 @@
eigenvalues on diagonal, else zero.}
\item{\code{garchf}:}{Object of class \code{"formula"}: Garch
formula used for uncorrelated component GARCH models.}
-
+ \item{\code{name}:}{Object of class \code{"character"}: The name of
+ the original data object.}
}
}
Added: pkg/man/Gopredict-class.Rd
===================================================================
--- pkg/man/Gopredict-class.Rd (rev 0)
+++ pkg/man/Gopredict-class.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,63 @@
+\name{Gopredict-class}
+
+\encoding{latin1}
+
+\docType{class}
+
+\alias{Gopredict-class}
+\alias{ccor,Gopredict-method}
+\alias{ccov,Gopredict-method}
+\alias{cvar,Gopredict-method}
+\alias{show,Gopredict-method}
+
+\title{Class "Gopredict": Prediction of GO-GARCH Models}
+
+\description{
+ This class defines the slots for forecasts from a GO-GARCH model.
+}
+
+\section{Objects from the Class}{
+ Objects can be created by calls of the form \code{new("Gopredict",
+ ...)}, or with the method \code{predict} of formal class objects
+ \code{GoGARCH} and \code{Goestml}.
+}
+
+\section{Slots}{
+ \describe{
+ \item{\code{Hf}:}{Object of class \code{"list"}: The forecasted
+ conditional covariances.}
+ \item{\code{Xf}:}{Object of class \code{"matrix"}: The transformed
+ forecasts of the component GARCH mean models.}
+ \item{\code{CGARCHF}:}{Object of class \code{"list"}: The original
+ forecasts of the component GARCH models.}
+ }
+}
+
+\section{Methods}{
+ \describe{
+ \item{ccor}{Returns the forecasted conditional correlations.}
+ \item{ccov}{Returns the forecasted conditional co-variances.}
+ \item{cvar}{Returns the forecasted conditional variances.}
+ \item{show}{show-method for objects of class \code{Gopredict}.}
+ }
+}
+
+\author{
+ Bernhard Pfaff
+}
+
+\note{
+ In case more than 10 forecasts steps are computed, the
+ \code{show}-method displays only the \code{head} of the returned
+ objects. Furthermore, the \code{show}-method displays the forecasted
+ conditional variances only. The forecasted conditional co-variances
+ and/or the forecasted conditional correlations can be retrieved with
+ the methods \code{ccov} or \code{ccor}, respectively.
+}
+
+
+\seealso{
+ \code{\linkS4class{GoGARCH}}, \code{\linkS4class{Goestml}}
+}
+
+\keyword{classes}
Modified: pkg/man/Gosum-class.Rd
===================================================================
--- pkg/man/Gosum-class.Rd 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/man/Gosum-class.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -44,8 +44,4 @@
\code{\linkS4class{GoGARCH}}, \code{\linkS4class{Goestml}}
}
-\examples{
-showClass("Gosum")
-}
-
\keyword{classes}
Modified: pkg/man/gogarch.Rd
===================================================================
--- pkg/man/gogarch.Rd 2009-02-02 22:01:09 UTC (rev 16)
+++ pkg/man/gogarch.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -13,7 +13,7 @@
models.
}
\usage{
-gogarch(data, formula, scale = FALSE, method = c("ml"), initial = NULL,
+gogarch(data, formula, scale = FALSE, method = c("ml", "nls"), initial = NULL,
garchlist = list(init.rec = "mci", delta = 2, skew = 1, shape =
4, cond.dist = "norm", include.mean = FALSE, include.delta = NULL,
include.skew = NULL, include.shape = NULL, leverage = NULL, trace =
@@ -26,8 +26,8 @@
\item{formula}{Formula: valid formula for univariate GARCH models.}
\item{scale}{Logical, if \code{TRUE} the data is scaled. The default
is \code{scale = FALSE}.}
- \item{method}{Character: currently only Maximum-Likelihood estimation
- is implemented.}
+ \item{method}{Character: by Maximum-Likelihood \code{method = "ml"} or by non-linear
+ Least-Squares \code{method = "nls"}.}
\item{initial}{Numeric: starting values for Euler angles (see Details).}
\item{garchlist}{List: Elements are passed to \code{garchFit}.}
\item{\dots}{Ellipsis argument: is passed to \code{nlminb}.}
Added: pkg/man/gonls.Rd
===================================================================
--- pkg/man/gonls.Rd (rev 0)
+++ pkg/man/gonls.Rd 2009-02-03 21:42:00 UTC (rev 17)
@@ -0,0 +1,62 @@
+\name{gonls}
+
+\encoding{latin1}
+
+\alias{gonls}
+
+\title{
+ Non-linear least-squares estimation of matrix B
+}
+
+\description{
+ This is the target function for estimating the matrix \eqn{B} by
+ non-linear least-squares. It is used in the estimation method
+ \code{goest} if \code{method = "nls"} is chosen.
+}
+
+\usage{
+gonls(params, SSI)
+}
+
+\arguments{
+ \item{params}{The initial values of the \eqn{vech(B)}.}
+ \item{SSI}{A list with two elements, each a list itself, containing
+ \eqn{S_t = s_t s_t' - I_m} and \eqn{S_{t-1} = s_{t-1} s_{t-1}' -
+ I_m}, respectively.}
+}
+
+\details{
+ Boswijk and van der Weiden (2006) proposed the following criterion
+ function:
+
+ \deqn{
+ S(A) = \frac{1}{n} \sum_{t = 1}^n tr([s_t s_t' - I_m - B(s_{t-1}
+ s_{t-1}' - I_m)B]^2) = S^*(B)
+ }
+
+ for retrieving the matrix \eqn{U}. This matrix is the eigen vector
+ matrix of \eqn{B}. The linear map \eqn{Z = P \Delta^{1/2} U} and its
+ inverse can then be computed for calculating the component matrix
+ \eqn{Y = X Z^{-1}}.
+}
+\value{
+ \item{f}{\code{numeric}: The value of the target function.}
+}
+
+\references{
+ Boswijk, H. Peter and van der Weide, Roy (2006), Wake me up before
+ you GO-GARCH, \emph{Tinbergen Institute Discussion Paper}, \bold{TI
+ 2006-079/4}, University of Amsterdam and Tinbergen Institute.
+}
+
+\author{
+ Bernhard Pfaff
+}
+
+\seealso{
+ \code{\link{gogarch}}
+}
+
+\keyword{models}
+\concept{GARCH}
+\concept{GO-GARCH}
More information about the Gogarch-commits
mailing list