[Gogarch-commits] r16 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 2 23:01:10 CET 2009


Author: bpfaff
Date: 2009-02-02 23:01:09 +0100 (Mon, 02 Feb 2009)
New Revision: 16

Added:
   pkg/R/GoGARCH-formula.R
   pkg/R/GoGARCH-summary.R
   pkg/R/Goestml-formula.R
   pkg/R/Goestml-summary.R
   pkg/R/Goestml-update.R
   pkg/R/Gogarch-update.R
   pkg/R/Gosum-show.R
   pkg/man/Gosum-class.Rd
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/All-classes.R
   pkg/R/All-generics.R
   pkg/R/Goestml-goest.R
   pkg/R/gollh.R
   pkg/R/gotheta.R
   pkg/man/GoGARCH-class.Rd
   pkg/man/Goestml-class.Rd
   pkg/man/goest-methods.Rd
   pkg/man/gollh.Rd
Log:
Classes, methods and functions added.


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/DESCRIPTION	2009-02-02 22:01:09 UTC (rev 16)
@@ -1,13 +1,14 @@
 Package: gogarch
-Version: 0.3-0
+Version: 0.3-5
 Type: Package
 Title: Generalized Orthogonal GARCH (GO-GARCH) models
-Date: 2009-01-31
+Date: 2009-02-02
 Author: Bernhard Pfaff
 Maintainer: Bernhard Pfaff <bernhard at pfaffikus.de>
 Depends: R (>= 2.7.0), methods, stats, fGarch
 Suggests: vars
-Description: Implementation of the GO-GARCH model class. 
+Description: Implementation of the GO-GARCH model class 
 License: GPL (>= 2)
 LazyLoad: yes
 LazyLoad: yes
+

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/NAMESPACE	2009-02-02 22:01:09 UTC (rev 16)
@@ -2,13 +2,13 @@
 import(methods)
 
 ## Import functions
-importFrom(stats, coef, logLik, residuals)
+importFrom(stats, coef, formula, logLik, residuals, update)
 
 ## Classes       
-exportClasses(Goestml, GoGARCH, Goinit, Orthom)
+exportClasses(Goestml, GoGARCH, Goinit, Gosum, Orthom)
 
 ## Methods
-exportMethods(angles, cvar, ccor, ccov, coef, converged, goest, logLik, M, print, show, t, residuals)
+exportMethods(angles, cvar, ccor, ccov, coef, converged, formula, goest, logLik, M, print, show, summary, t, residuals, update)
 
 ## Functions
 export(gogarch, goinit, gollh, gotheta, Rd2, UprodR, unvech, validOrthomObject, validGoinitObject)

Modified: pkg/R/All-classes.R
===================================================================
--- pkg/R/All-classes.R	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/R/All-classes.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -11,6 +11,10 @@
 ##
 setClass(Class = "Goestml", representation(opt = "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 of orthogonal matrices
 ##
 setClass(Class = "Orthom", representation(M = "matrix"))

Modified: pkg/R/All-generics.R
===================================================================
--- pkg/R/All-generics.R	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/R/All-generics.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -1,7 +1,7 @@
 ##
 ## Generic definition for estimating GO-GARCH models
 ##
-setGeneric("goest", function(object, initial, garchlist, ...) standardGeneric("goest"))
+setGeneric("goest", function(object, ...) standardGeneric("goest"))
 ##
 ## Generic definition for extracting object at M for objects of class Orthom
 ##
@@ -30,6 +30,9 @@
 ## Setting Generics for coef, residuals, logLik and t
 ##
 setGeneric("coef")
+setGeneric("formula")
+setGeneric("logLik")
 setGeneric("residuals")
+setGeneric("summary")
 setGeneric("t")
-setGeneric("logLik")
+setGeneric("update")

Added: pkg/R/GoGARCH-formula.R
===================================================================
--- pkg/R/GoGARCH-formula.R	                        (rev 0)
+++ pkg/R/GoGARCH-formula.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,4 @@
+setMethod("formula", signature(x = "GoGARCH"), function(x, ...)
+  x at garchf
+)
+

Added: pkg/R/GoGARCH-summary.R
===================================================================
--- pkg/R/GoGARCH-summary.R	                        (rev 0)
+++ pkg/R/GoGARCH-summary.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,12 @@
+setMethod(f = "summary", signature(object = "GoGARCH"), definition = function(object){
+  name <- as.character(object at CALL$data)
+  method <- object at estby
+  model <- object at garchf
+  garchc <- lapply(object at models, function(x) x at fit$matcoef)
+  ynames <- paste("y", 1:ncol(object at X), sep = "")
+  names(garchc) <- paste("Component GARCH model of", ynames)
+  garchc <- garchc
+  Zinv <- solve(object at Z)
+  gosum <- new("Gosum", name = name, method = method, model = model, garchc = garchc, Zinv = Zinv)
+  return(gosum)
+})

Added: pkg/R/Goestml-formula.R
===================================================================
--- pkg/R/Goestml-formula.R	                        (rev 0)
+++ pkg/R/Goestml-formula.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,3 @@
+setMethod("formula", signature(x = "Goestml"), function(x, ...)
+  x at garchf
+)

Modified: pkg/R/Goestml-goest.R
===================================================================
--- pkg/R/Goestml-goest.R	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/R/Goestml-goest.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -1,6 +1,6 @@
-setMethod(f = "goest", signature(object = "Goestml", initial = "numeric", garchlist = "list"), definition = function(object, initial, garchlist, ...){
+setMethod(f = "goest", signature(object = "Goestml"), definition = function(object, initial, garchlist, ...){
   llobj <- nlminb(start = initial, objective = gollh, object = object, garchlist = garchlist, lower = 1.5e-8, upper = pi/2, ...)
-  gotheta <- gotheta(llobj$par, object)
+  gotheta <- gotheta(llobj$par, object, garchlist)
   result <- new("Goestml", opt = llobj, estby = "maximum likelihood", gotheta)
   return(result)  
 })

Added: pkg/R/Goestml-summary.R
===================================================================
--- pkg/R/Goestml-summary.R	                        (rev 0)
+++ pkg/R/Goestml-summary.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,3 @@
+setMethod(f = "summary", signature(object = "Goestml"), definition = function(object){
+  callNextMethod()
+})

Added: pkg/R/Goestml-update.R
===================================================================
--- pkg/R/Goestml-update.R	                        (rev 0)
+++ pkg/R/Goestml-update.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,17 @@
+setMethod("update", signature(object = "Goestml"), 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/Gogarch-update.R
===================================================================
--- pkg/R/Gogarch-update.R	                        (rev 0)
+++ pkg/R/Gogarch-update.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,22 @@
+setMethod("update", signature(object = "GoGARCH"), 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/Gosum-show.R
===================================================================
--- pkg/R/Gosum-show.R	                        (rev 0)
+++ pkg/R/Gosum-show.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,37 @@
+setMethod(f = "show", signature(object = "Gosum"), definition = function(object){
+  title <- "*** Summary 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")
+  cat(paste("Used object:", object at name))
+  cat("\n")  
+  cat("\n")
+  cat(paste("Components estimated by:", object at method))
+  cat("\n")
+  cat(paste("Formula for component GARCH models:", paste(as.character(object at model), collapse = " "), "\n"))
+  cat("\n")  
+  if(length(object at Zinv) != 0){
+    cat("The Inverse of the Linar Map Z:\n")
+    print(object at Zinv)
+    cat("\n")
+  }
+  cat("\n")
+  title2 <- "*** Estimated Component GARCH models ***"
+  stars2 <- paste(rep("*", nchar(title2)), collapse = "")
+  cat("\n")
+  cat(paste(stars2, "\n"))
+  cat(paste(title2, "\n"))
+  cat(paste(stars2, "\n"))
+  cnames <- names(object at garchc)
+  n <- length(object at garchc)
+  for(i in 1:n){
+    cat("\n")
+    cat(paste(cnames[i], "\n"))
+    print(object at garchc[[i]])  
+  }
+  invisible(object)
+})
+

Modified: pkg/R/gollh.R
===================================================================
--- pkg/R/gollh.R	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/R/gollh.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -1,10 +1,5 @@
 gollh <-
-function(params, object, 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)){
+function(params, object, garchlist){
   gotheta <- gotheta(theta = params, object = object, garchlist = garchlist)
   m <- ncol(object at X)
   n <- nrow(object at X)

Modified: pkg/R/gotheta.R
===================================================================
--- pkg/R/gotheta.R	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/R/gotheta.R	2009-02-02 22:01:09 UTC (rev 16)
@@ -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)
+  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())
   return(result)
 }

Modified: pkg/man/GoGARCH-class.Rd
===================================================================
--- pkg/man/GoGARCH-class.Rd	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/man/GoGARCH-class.Rd	2009-02-02 22:01:09 UTC (rev 16)
@@ -5,13 +5,16 @@
 \encoding{latin1}
 
 \alias{GoGARCH-class}
-\alias{show,GoGARCH-method}
 \alias{cvar,GoGARCH-method}
 \alias{ccov,GoGARCH-method}
 \alias{ccor,GoGARCH-method}
 \alias{coef,GoGARCH-method}
 \alias{converged,GoGARCH-method}
+\alias{formula,GoGARCH-method}
 \alias{residuals,GoGARCH-method}
+\alias{show,GoGARCH-method}
+\alias{summary,GoGARCH-method}
+\alias{update,GoGARCH-method}
 
 \title{Class "GoGARCH": Estimated GO-GARCH Models}
 
@@ -60,8 +63,11 @@
     \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{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{update}{Updates an object of class \code{GoGARCH}.}
   }
 }
 

Modified: pkg/man/Goestml-class.Rd
===================================================================
--- pkg/man/Goestml-class.Rd	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/man/Goestml-class.Rd	2009-02-02 22:01:09 UTC (rev 16)
@@ -17,9 +17,12 @@
 \alias{ccov,Goestml-method}
 \alias{coef,Goestml-method}
 \alias{converged,Goestml-method}
+\alias{formula,Goestml-method}
 \alias{logLik,Goestml-method}
 \alias{residuals,Goestml-method}
 \alias{show,Goestml-method}
+\alias{summary,Goestml-method}
+\alias{update,Goestml-method}
 
 \title{Class "Goestml": GO-GARCH  models estimated by Maximum-Likelihood}
 
@@ -68,11 +71,14 @@
     \item{ccov}{Returns the conditional covariances.}    
     \item{coef}{Returns the coeffiecients of the component GARCH models.}
     \item{converged}{Returns the convergence codes of the component
-  GARCH models.}  
+      GARCH models.}
+    \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{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{update}{Updates an object of class \code{Goestml}.}
   }
 }
 

Added: pkg/man/Gosum-class.Rd
===================================================================
--- pkg/man/Gosum-class.Rd	                        (rev 0)
+++ pkg/man/Gosum-class.Rd	2009-02-02 22:01:09 UTC (rev 16)
@@ -0,0 +1,51 @@
+\name{Gosum-class}
+
+\encoding{latin1}
+
+\docType{class}
+
+\alias{Gosum-class}
+\alias{show,Gosum-method}
+
+\title{Class "Gosum": Summary object of GO-GARCH model}
+
+\description{The formal summary class of \code{GoGARCH} objects or objects that
+  extend this class.}
+
+\section{Objects from the Class}{
+  Objects can be created by calls of the form \code{new("Gosum", ...)}
+  or are set by the summary-method. 
+}
+
+\section{Slots}{
+	 \describe{
+    \item{\code{name}:}{\code{character}: the name of the original data object.}
+    \item{\code{method}:}{\code{character}: the estimation method.}
+    \item{\code{model}:}{\code{formula}: The GARCH model formula for the
+	 component GARCH models.}
+    \item{\code{garchc}:}{\code{list}: The elements are \code{matcoef} matrices
+	 generated by \code{garchFit} for the components.}
+    \item{\code{Zinv}:}{\code{matrix}: The inverse of the linear map \eqn{X = Y
+	 Z}.}
+  }
+}
+
+\section{Methods}{
+  \describe{
+    \item{show}{show-method for objects of class \code{Gosum}.}
+  }
+}
+
+\author{
+  Bernhard Pfaff
+}
+
+\seealso{
+  \code{\linkS4class{GoGARCH}}, \code{\linkS4class{Goestml}} 
+}
+
+\examples{
+showClass("Gosum")
+}
+
+\keyword{classes}

Modified: pkg/man/goest-methods.Rd
===================================================================
--- pkg/man/goest-methods.Rd	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/man/goest-methods.Rd	2009-02-02 22:01:09 UTC (rev 16)
@@ -6,7 +6,7 @@
 
 \alias{goest-methods}
 
-\alias{goest,Goestml,numeric,list-method}
+\alias{goest,Goestml-method}
 
 \alias{goest}
 
@@ -19,7 +19,7 @@
 
 \section{Methods}{
   \describe{
-    \item{goest}{\code{signature(object = "Goestml", initial = "numeric", garchlist = "list")}}
+    \item{goest}{\code{signature(object = "Goestml")}}
   }
 }
 

Modified: pkg/man/gollh.Rd
===================================================================
--- pkg/man/gollh.Rd	2009-01-31 22:10:38 UTC (rev 15)
+++ pkg/man/gollh.Rd	2009-02-02 22:01:09 UTC (rev 16)
@@ -14,12 +14,7 @@
 }
 
 \usage{
-gollh(params, object, 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))
+gollh(params, object, garchlist)
 }
 
 \arguments{



More information about the Gogarch-commits mailing list