[Uwgarp-commits] r153 - in pkg/GARPFRM: . R man sandbox vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 30 23:40:52 CEST 2014


Author: tfillebeen
Date: 2014-03-30 23:40:51 +0200 (Sun, 30 Mar 2014)
New Revision: 153

Modified:
   pkg/GARPFRM/DESCRIPTION
   pkg/GARPFRM/NAMESPACE
   pkg/GARPFRM/R/capm.R
   pkg/GARPFRM/R/garch11.R
   pkg/GARPFRM/man/CAPM.Rd
   pkg/GARPFRM/man/EWMA.Rd
   pkg/GARPFRM/man/backTestVaR.Rd
   pkg/GARPFRM/man/backtestVaR.GARCH.Rd
   pkg/GARPFRM/man/bootCor.Rd
   pkg/GARPFRM/man/bootCov.Rd
   pkg/GARPFRM/man/bootES.Rd
   pkg/GARPFRM/man/bootFUN.Rd
   pkg/GARPFRM/man/bootMean.Rd
   pkg/GARPFRM/man/bootSD.Rd
   pkg/GARPFRM/man/bootSimpleVolatility.Rd
   pkg/GARPFRM/man/bootStdDev.Rd
   pkg/GARPFRM/man/bootVaR.Rd
   pkg/GARPFRM/man/chartSML.Rd
   pkg/GARPFRM/man/efficientFrontier.Rd
   pkg/GARPFRM/man/efficientFrontierTwoAsset.Rd
   pkg/GARPFRM/man/endingPrices.Rd
   pkg/GARPFRM/man/estimateLambdaCor.Rd
   pkg/GARPFRM/man/estimateLambdaCov.Rd
   pkg/GARPFRM/man/estimateLambdaVol.Rd
   pkg/GARPFRM/man/forecast.Rd
   pkg/GARPFRM/man/forecast.uvEWMAvol.Rd
   pkg/GARPFRM/man/forecast.uvGARCH.Rd
   pkg/GARPFRM/man/getAlphas.Rd
   pkg/GARPFRM/man/getBetas.Rd
   pkg/GARPFRM/man/getCor.Rd
   pkg/GARPFRM/man/getCov.Rd
   pkg/GARPFRM/man/getEstimate.Rd
   pkg/GARPFRM/man/getStatistics.Rd
   pkg/GARPFRM/man/getVaREstimates.Rd
   pkg/GARPFRM/man/getVaRViolations.Rd
   pkg/GARPFRM/man/hypTest.Rd
   pkg/GARPFRM/man/minVarPortfolio.Rd
   pkg/GARPFRM/man/monteCarlo.Rd
   pkg/GARPFRM/man/plot.EWMA.Rd
   pkg/GARPFRM/man/plot.backtestVaR.Rd
   pkg/GARPFRM/man/plot.capm_mlm.Rd
   pkg/GARPFRM/man/plot.capm_uv.Rd
   pkg/GARPFRM/man/plot.efTwoAsset.Rd
   pkg/GARPFRM/man/plot.efficient.frontier.Rd
   pkg/GARPFRM/man/plotEndingPrices.Rd
   pkg/GARPFRM/man/portReturnTwoAsset.Rd
   pkg/GARPFRM/man/portSDTwoAsset.Rd
   pkg/GARPFRM/man/realizedCor.Rd
   pkg/GARPFRM/man/realizedCov.Rd
   pkg/GARPFRM/man/realizedVol.Rd
   pkg/GARPFRM/man/rollCor.Rd
   pkg/GARPFRM/man/rollCov.Rd
   pkg/GARPFRM/man/rollSD.Rd
   pkg/GARPFRM/man/rollSimpleVolatility.Rd
   pkg/GARPFRM/man/simpleVolatility.Rd
   pkg/GARPFRM/man/tangentPortfolio.Rd
   pkg/GARPFRM/sandbox/test_EWMA_GARCH.R
   pkg/GARPFRM/vignettes/CAPM_TF.Rnw
   pkg/GARPFRM/vignettes/CAPM_TF.pdf
   pkg/GARPFRM/vignettes/DelineatingEfficientPortfolios.pdf
   pkg/GARPFRM/vignettes/EstimatingVolatilitiesCorrelation.pdf
Log:
CAPM vignette update

Modified: pkg/GARPFRM/DESCRIPTION
===================================================================
--- pkg/GARPFRM/DESCRIPTION	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/DESCRIPTION	2014-03-30 21:40:51 UTC (rev 153)
@@ -17,15 +17,3 @@
     PortfolioAnalytics,
     foreach (>= 1.4.1)
 License: GPL
-Collate:
-    'backTestVaR.R'
-    'capm.R'
-    'EWMA.R'
-    'garch11.R'
-    'monte_carlo.R'
-    'efficient_frontier.R'
-    'rollFUN.R'
-    'volatility.R'
-    'boot.R'
-    'utils.R'
-    'generic_forecast.R'

Modified: pkg/GARPFRM/NAMESPACE
===================================================================
--- pkg/GARPFRM/NAMESPACE	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/NAMESPACE	2014-03-30 21:40:51 UTC (rev 153)
@@ -1,5 +1,32 @@
-export(backtestVaR.GARCH)
+S3method(fcstGarch11,DCCfit)
+S3method(forecast,uvEWMAvol)
+S3method(forecast,uvGARCH)
+S3method(getAlphas,capm_mlm)
+S3method(getAlphas,capm_uv)
+S3method(getBetas,capm_mlm)
+S3method(getBetas,capm_uv)
+S3method(getCor,mvEWMAcor)
+S3method(getCov,mvEWMAcov)
+S3method(getEstimate,EWMA)
+S3method(getEstimate,mvEWMAvol)
+S3method(getStatistics,capm_mlm)
+S3method(getStatistics,capm_uv)
+S3method(hypTest,capm_mlm)
+S3method(hypTest,capm_uv)
+S3method(plot,EWMA)
+S3method(plot,MonteCarlo)
+S3method(plot,backtestVaR)
+S3method(plot,capm_mlm)
+S3method(plot,capm_uv)
+S3method(plot,efTwoAsset)
+S3method(plot,efficient.frontier)
+S3method(print,EWMA)
+S3method(print,backtestVaR)
+S3method(print,mvEWMAvol)
+export(CAPM)
+export(EWMA)
 export(backtestVaR)
+export(backtestVaR.GARCH)
 export(bootCor)
 export(bootCov)
 export(bootES)
@@ -9,7 +36,6 @@
 export(bootSimpleVolatility)
 export(bootStdDev)
 export(bootVaR)
-export(CAPM)
 export(chartSML)
 export(efficientFrontier)
 export(efficientFrontierTwoAsset)
@@ -17,15 +43,14 @@
 export(estimateLambdaCor)
 export(estimateLambdaCov)
 export(estimateLambdaVol)
-export(EWMA)
+export(fcstGarch11)
 export(forecast)
+export(garch11)
 export(getAlphas)
 export(getBetas)
 export(getCor)
 export(getCov)
 export(getEstimate)
-export(getFit)
-export(getSpec)
 export(getStatistics)
 export(getVaREstimates)
 export(getVaRViolations)
@@ -44,30 +69,3 @@
 export(rollSimpleVolatility)
 export(simpleVolatility)
 export(tangentPortfolio)
-export(uvGARCH)
-S3method(forecast,uvEWMAvol)
-S3method(forecast,uvGARCH)
-S3method(getAlphas,capm_mlm)
-S3method(getAlphas,capm_uv)
-S3method(getBetas,capm_mlm)
-S3method(getBetas,capm_uv)
-S3method(getCor,mvEWMAcor)
-S3method(getCov,mvEWMAcov)
-S3method(getEstimate,EWMA)
-S3method(getEstimate,mvEWMAvol)
-S3method(getFit,uvGARCH)
-S3method(getSpec,uvGARCH)
-S3method(getStatistics,capm_mlm)
-S3method(getStatistics,capm_uv)
-S3method(hypTest,capm_mlm)
-S3method(hypTest,capm_uv)
-S3method(plot,backtestVaR)
-S3method(plot,capm_mlm)
-S3method(plot,capm_uv)
-S3method(plot,efficient.frontier)
-S3method(plot,efTwoAsset)
-S3method(plot,EWMA)
-S3method(plot,MonteCarlo)
-S3method(print,backtestVaR)
-S3method(print,EWMA)
-S3method(print,mvEWMAvol)

Modified: pkg/GARPFRM/R/capm.R
===================================================================
--- pkg/GARPFRM/R/capm.R	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/R/capm.R	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,25 +2,25 @@
 # Description for CAPM
 # @param r risk-free rate
 # @param mkrt market return
-# @return the function returns tstat upon default & pvalue when specified
+# @return the function returns tstat upon default & pvalue when spesignificanceLevelfied
 # @export
 # capm.tstats = function(r,mkrt,type = FALSE) {
-#   # Fiting CAPM and retrieve alpha specific tstats or pvalues
+#   # Fiting CAPM and retrieve alpha spesignificanceLevelfic tstats or pvalues
 #   capm.fit = lm(r~mkrt)    
 #   # Extract summary info
 #   capm.summary = summary(capm.fit) 
 #   if(is.null(type) | type=="pvalue"){
-#     # Retrieve p-value if specified
+#     # Retrieve p-value if spesignificanceLevelfied
 #     p.value = coef(capm.summary)[1,4]  
 #     p.value
 #   }else{
-#     # Otherwise retrieve t-stat if specified or on default
+#     # Otherwise retrieve t-stat if spesignificanceLevelfied or on default
 #     t.stat = coef(capm.summary)[1,3]  
 #     t.stat
 #   }
 # }
 
-#' Capital Asset Pricing Model
+#' Capital Asset PrisignificanceLevelng Model
 #' 
 #' TODO: Need a better description of the CAPM
 #' 
@@ -119,7 +119,7 @@
 #' Extract the standard error, t-values, and p-values from the CAPM object.
 #' 
 #' The t-statistic and corresponding two-sided p-value are calculated differently
-#' for the alpha and beta coefficients.
+#' for the alpha and beta coeffisignificanceLevelents.
 #' \itemize{
 #'   \item{alpha}{ the t-statistic and corresponding p-value are calculated to
 #'   test if alpha is significantly different from 0.
@@ -252,20 +252,20 @@
   # Plot Fitted SML
   plot(betas,mu.hat,main=main, ...=...)
   abline(sml.fit)
-  legend("topleft",1, "Estimated SML",1)                  
+  # legend("topleft",1, "Estimated SML",1)                  
 }
 
 
 #' CAPM Hypothesis Test
 #' 
-#' Test the CAPM coefficients for significance.
+#' Test the CAPM coeffisignificanceLevelents for significance.
 #' 
 #' @details
-#' This function tests the significance of the coefficients (alpha and beta)
+#' This function tests the significance of the coeffisignificanceLevelents (alpha and beta)
 #' estimated by the CAPM.
 #' 
 #' #' The t-statistic and corresponding two-sided p-value are calculated differently
-#' for the alpha and beta coefficients.
+#' for the alpha and beta coeffisignificanceLevelents.
 #' \itemize{
 #'   \item{alpha}{ the t-statistic and corresponding p-value are calculated to
 #'   test if alpha is significantly different from 0.
@@ -281,44 +281,44 @@
 #'   }
 #' }
 #' 
-#' If the p-value is less than the specified confidence level, the null 
-#' hypothesis is rejected meaning that the coefficient is significant. If 
-#' the p-value is greater than the specified confidence level, the null 
+#' If the p-value is less than the spesignificanceLevelfied confidence level, the null 
+#' hypothesis is rejected meaning that the coeffisignificanceLevelent is significant. If 
+#' the p-value is greater than the spesignificanceLevelfied confidence level, the null 
 #' hypothesis cannot be rejected.
 #' 
 #' @param object a capm object created by \code{\link{CAPM}}
-#' @param CI confidence level
-#' @return TRUE if the null hypothesis is rejected (i.e. the estimated coefficient is significant)
-#' FALSE if the null hypothesis cannot be rejected (i.e. the estimated coefficient is not significant)
+#' @param significanceLevel confidence level
+#' @return TRUE if the null hypothesis is rejected (i.e. the estimated coeffisignificanceLevelent is significant)
+#' FALSE if the null hypothesis cannot be rejected (i.e. the estimated coeffisignificanceLevelent is not significant)
 #' @seealso \code{\link{getStatistics}}
 #' @author Thomas Fillebeen
 #' @export
-hypTest <- function(object,CI){
+hypTest <- function(object,significanceLevel){
   UseMethod("hypTest")
 }
 
 #' @method hypTest capm_uv
 #' @S3method hypTest capm_uv
-hypTest.capm_uv <- function(object, CI = 0.05){
+hypTest.capm_uv <- function(object, significanceLevel = 0.05){
   if(!inherits(object, "capm_uv")) stop("object must be of class capm_uv")
   tmp_sm = getStatistics(object)
-  # test for alpha p-value < CI
-  tmp_A = tmp_sm[1,4] < CI
-  # test for beta p-value < CI
-  tmp_B = tmp_sm[2,4] < CI
+  # test for alpha p-value < significanceLevel
+  tmp_A = tmp_sm[1,4] < significanceLevel
+  # test for beta p-value < significanceLevel
+  tmp_B = tmp_sm[2,4] < significanceLevel
   result = list(alpha = tmp_A, beta = tmp_B)
   return(result)
 }
 
 #' @method hypTest capm_mlm
 #' @S3method hypTest capm_mlm
-hypTest.capm_mlm <- function(object, CI = 0.05){
+hypTest.capm_mlm <- function(object, significanceLevel = 0.05){
   if(!inherits(object, "capm_mlm")) stop("object must be of class capm_mlm")
   tmp_sm = getStatistics(object)
-  # test for alpha p-value < CI
-  tmp_A = tmp_sm[seq(1,nrow(tmp_sm),2),4] < CI
-  # test for beta p-value < CI
-  tmp_B = tmp_sm[seq(2,nrow(tmp_sm),2),4] < CI
+  # test for alpha p-value < significanceLevel
+  tmp_A = tmp_sm[seq(1,nrow(tmp_sm),2),4] < significanceLevel
+  # test for beta p-value < significanceLevel
+  tmp_B = tmp_sm[seq(2,nrow(tmp_sm),2),4] < significanceLevel
   result = list(alpha = tmp_A, beta = tmp_B)  
   return(result)
 }

Modified: pkg/GARPFRM/R/garch11.R
===================================================================
--- pkg/GARPFRM/R/garch11.R	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/R/garch11.R	2014-03-30 21:40:51 UTC (rev 153)
@@ -1,204 +1,50 @@
-
-# Because our function is a wrapper around functions in the rugarch and
-# rmgarch packages, we need to give proper credit (i.e. citation("rugarch")
-# and citation("rmgarch"))
-
-# rugarch: univariate garch models
-# rmgarch: multivariate garch models
-
-# we need to support GARCH models for both univariate and multivariate data
-
-## The GARP text does not have any discussion on multivariate GARCH models.
-## I think we should omit this for phase 1 and maybe reconsider in phase 2
-## or beyond.
-
-# GARCH Models
-# 
-# This function is a basic wrapper of functions in the rugarch and rmgarch
-# packages to specify and fit GARCH models. The rugarch and rmgarch packages
-# provide functions to specify and fit a rich set of GARCH models. 
-# The purpose of this function is to specify and fit a GARCH model while 
-# abstracting away some complexities.
-# 
-# The rugarch package implements univariate garch models and the
-# rmgarch package implements multivariate garch models. Univariate or 
-# multivariate data is automatically detected and the appropriate GARCH model
-# will be specified and fit.
-# 
-# For complete functionality of GARCH models, it is recommended to 
-# directly use functions in the rugarch and rmgarch packages.
-# 
-# @param R xts object of asset returns
-# @param model “sGARCH”, “fGARCH”, “eGARCH”, “gjrGARCH”, “apARCH” and “iGARCH” and “csGARCH”
-# @param distribution.model. Valid choices are “norm” for the normal distibution, “snorm” for the skew-normal distribution, “std” for the student-t, “sstd” for the skew-student, “ged” for the generalized error distribution, “sged” for the skew-generalized error distribution, “nig” for the normal inverse gaussian distribution, “ghyp” for the Generalized Hyperbolic, and “jsu” for Johnson's SU distribution. 
-# @export
-# By default we use UV N~GARCH(1,1) and Bollerslev for each series
-# garch11 <- function(R, model = "sGARCH", distribution.model = "norm"){
-#   # if univariate data, load the rugarch package
-#   # if multivariate data, load the rmgarch package
-#   
-#   garch11.spec = ugarchspec(mean.model = list(armaOrder = c(0,0)), 
-#                             variance.model = list(garchOrder = c(1,1), model = model), 
-#                             distribution.model)
-#   
-#   # DCC specification: GARCH(1,1) for conditional cor
-#   nbColumns = ncol(R)
-#   dcc.garch11.spec = dccspec(uspec = multispec( replicate(nbColumns, garch11.spec) ), 
-#                              dccOrder = c(1,1), distribution = "mvnorm")
-#   dcc.garch11.spec
-#   
-#   dcc.fit = dccfit(dcc.garch11.spec, data = R)
-#   class(dcc.fit)
-#   slotNames(dcc.fit)
-#   names(dcc.fit at mfit)
-#   names(dcc.fit at model)
-#   return(dcc.fit)
-# }
-
-# Forecast GARCH(1,1)
-# 
-# Description of forecast GARCH(1,1)
-# 
-# @param garch11 object created by \code{\link{garch11}}
-# @param window is the forecast window (default is set to window = 100)
-# @export
-# fcstGarch11 <- function(object, window){
-#   UseMethod("fcstGarch11")
-# }
-
-# @method fcstGarch11 Dccfit
-# @S3method fcstGarch11 DCCfit
-# fcstGarch11.DCCfit <- function(object, window = 100){
-#   #if ((window > nrow(object))) {stop("Window is too large to forecast")}
-#   result = dccforecast(object, n.ahead=window)
-#   class(result)
-#   slotNames(result)
-#   class(result at mforecast)
-#   names(result at mforecast)
-#   return(result)
-# }
-
-
-#' Univariate GARCH Model
+#' GARCH(1,1)
 #' 
-#' Specify and fit a univariate GARCH model
+#' Description of GARCH(1,1)
 #' 
-#' @details 
-#' This function is a basic wrapper of functions in the rugarch package
-#' to specify and fit GARCH models. The rugarch package
-#' provides functions to specify and fit a rich set of GARCH models. 
-#' The purpose of this function is to specify and fit a GARCH model while 
-#' abstracting away some complexities.
-#' 
-#' @param R xts object of asset returns.
-#' @param model GARCH Model to specify and fit. Valid GARCH models are
-#' "sGARCH", "fGARCH", "eGARCH", "gjrGARCH", "apARCH", "iGARCH", and "csGARCH".
-#' @param garchOrder the ARCH(q) and GARCH(p) orders.
-#' @param armaOrder the autoregressive and moving average orders.
-#' @param distribution conditional density to use for the innovations. Valid 
-#' distributions are "norm" for the normal distibution, "snorm" for the 
-#' skew-normal distribution, "std" for the student-t, 
-#' "sstd for the skew-student, "ged" for the generalized error distribution, 
-#' "sged" for the skew-generalized error distribution, 
-#' "nig" for the normal inverse gaussian distribution, 
-#' "ghyp" for the Generalized Hyperbolic, and "jsu" for Johnson's SU distribution.
-#' @param fixedParams named list of parameters to keep fixed.
-#' @param solver the solver to use to fit the GARCH model. Valid solvers are
-#' "nlminb", "solnp", "lbfgs", "gosolnp", "nloptr", or "hybrid". 
-#' @param outSample number of periods of data used to fit the model. 
-#' \code{nrow(R) - outSample} number of periods to keep as out of sample data
-#' points.
-#' @param fitControl named list of arguments for the fitting routine
-#' @param solverControl named list of arguments for the solver
-#' @return a list of length two containing GARCH specification and GARCH fit objects
-#' @author Ross Bennett
-#' @seealso \code{\link[rugarch]{ugarchspec}}, \code{\link[rugarch]{ugarchfit}}
+#' @param R GARCH(1,1)
+#' @param model “sGARCH”, “fGARCH”, “eGARCH”, “gjrGARCH”, “apARCH” and “iGARCH” and “csGARCH”
+#' @param distribution.model. Valid choices are “norm” for the normal distibution, “snorm” for the skew-normal distribution, “std” for the student-t, “sstd” for the skew-student, “ged” for the generalized error distribution, “sged” for the skew-generalized error distribution, “nig” for the normal inverse gaussian distribution, “ghyp” for the Generalized Hyperbolic, and “jsu” for Johnson's SU distribution. 
 #' @export
-uvGARCH <- function(R, model="sGARCH", 
-                    garchOrder=c(1, 1), 
-                    armaOrder=c(1,1), 
-                    distribution="norm",
-                    fixedParams=NULL,
-                    solver="hybrid",
-                    outSample=0,
-                    fitControl=NULL,
-                    solverControl=NULL){
-  # Function to specify and fit a univariate GARCH model
-  
-  stopifnot("package:rugarch" %in% search() || require("rugarch", quietly = TRUE))
-  
-  if(is.null(fixedParams)){
-    fixedParams <- list()
-  }
-  
-  # Specify the GARCH model
-  # uGARCHspec object
-  spec <- ugarchspec(variance.model=list(model=model, garchOrder=garchOrder),
-                     mean.model=list(armaOrder=armaOrder),
-                     distribution.model=distribution,
-                     fixed.pars=fixedParams)
-  
-  # Fit the GARCH model
-  # uGARCHfit object
-  
-  if(is.null(fitControl)){
-    fitControl <- list(stationarity = 1, fixed.se = 0, scale = 0, rec.init = 'all')
-  }
-  
-  if(is.null(solverControl)){
-    solverControl <- list()
-  }
-  
-  fit <- ugarchfit(spec=spec, data=R, out.sample=outSample, solver=solver, 
-                   fit.control=fitControl, solver.control=solverControl)
-  
-  # structure and return the univariate GARCH model specification and fit
-  return(structure(list(spec=spec, fit=fit),
-                   class="uvGARCH"))
-}
+# By default we use UV N~GARCH(1,1) and Bollerslev for each series
+garch11 <- function(R, model = "sGARCH", distribution.model = "norm"){
+garch11.spec = ugarchspec(mean.model = list(armaOrder = c(0,0)), 
+                          variance.model = list(garchOrder = c(1,1), model = model), 
+                          distribution.model)
 
-#' Get GARCH Model Specification
-#' 
-#' Function to extract the GARCH model specification object 
-#' 
-#' @param garch a GARCH model specification and fit created with \code{uvGARCH}
-#' @return an object of class uGARCHspec
-#' @export
-getSpec <- function(garch){
-  UseMethod("getSpec")
-}
+# DCC specification: GARCH(1,1) for conditional cor
+nbColumns = ncol(R)
+dcc.garch11.spec = dccspec(uspec = multispec( replicate(nbColumns, garch11.spec) ), 
+                           dccOrder = c(1,1), distribution = "mvnorm")
+dcc.garch11.spec
 
-#' @method getSpec uvGARCH
-#' @S3method getSpec uvGARCH
-getSpec.uvGARCH <- function(garch){
-  garch$spec
+dcc.fit = dccfit(dcc.garch11.spec, data = R)
+class(dcc.fit)
+slotNames(dcc.fit)
+names(dcc.fit at mfit)
+names(dcc.fit at model)
+return(dcc.fit)
 }
 
-#' Get Fitted GARCH Model
+#' Forecast GARCH(1,1)
 #' 
-#' Function to extract the fitted GARCH model object 
+#' Description of forecast GARCH(1,1)
 #' 
-#' @param garch a GARCH model specification and fit created with \code{uvGARCH}
-#' @return an object of class uGARCHfit
+#' @param garch11 object created by \code{\link{GARCH(1,1)}}
+#' @param window is the forecast window (default is set to window = 100)
 #' @export
-getFit <- function(garch){
-  UseMethod("getFit")
+fcstGarch11 <- function(object, window){
+  UseMethod("fcstGarch11")
 }
 
-#' @method getFit uvGARCH
-#' @S3method getFit uvGARCH
-getFit.uvGARCH <- function(garch){
-  garch$fit
-}
-
-#' Plot GARCH Model
-#' 
-#' Plots for fitted GARCH Models
-#' 
-#' @param x uvGARCH object create via \code{uvGARCH}
-#' @param y not used
-#' @param \dots additional parameters passed to plot method for uGARCHfit objects
-#' @param which plot selection
-plot.uvGARCH <- function(x, y, ..., which){
-  plot(getFit(x), which=which, ...=...)
-}
+#' @method fcstGarch11 Dccfit
+#' @S3method fcstGarch11 DCCfit
+fcstGarch11.DCCfit <- function(object, window = 100){
+  #if ((window > nrow(object))) {stop("Window is too large to forecast")}
+  result = dccforecast(object, n.ahead=window)
+  class(result)
+  slotNames(result)
+  class(result at mforecast)
+  names(result at mforecast)
+  return(result)
+}
\ No newline at end of file

Modified: pkg/GARPFRM/man/CAPM.Rd
===================================================================
--- pkg/GARPFRM/man/CAPM.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/CAPM.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -1,8 +1,8 @@
 \name{CAPM}
 \alias{CAPM}
-\title{Capital Asset Pricing Model}
+\title{Capital Asset PrisignificanceLevelng Model}
 \usage{
-  CAPM(R, Rmkt)
+CAPM(R, Rmkt)
 }
 \arguments{
   \item{R}{asset returns}
@@ -10,12 +10,12 @@
   \item{Rmkt}{market returns}
 }
 \description{
-  TODO: Need a better description of the CAPM
+TODO: Need a better description of the CAPM
 }
 \details{
-  Retrieves alphas, betas, as well as pvalue and tstats.
-  The CAPM is used to determine a theoretically appropriate
-  rate of return of the non-diversifiable risk of an asset.
+Retrieves alphas, betas, as well as pvalue and tstats. The
+CAPM is used to determine a theoretically appropriate rate
+of return of the non-diversifiable risk of an asset.
 }
 \examples{
 data(crsp.short)
@@ -30,6 +30,6 @@
 tmp <- CAPM(R=R, Rmkt=MKT)
 }
 \author{
-  Thomas Fillebeen
+Thomas Fillebeen
 }
 

Modified: pkg/GARPFRM/man/EWMA.Rd
===================================================================
--- pkg/GARPFRM/man/EWMA.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/EWMA.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,8 +2,8 @@
 \alias{EWMA}
 \title{EWMA Model}
 \usage{
-  EWMA(R, lambda = 0.94, initialWindow = 10, n = 10,
-    type = c("volatility", "covariance", "correlation"))
+EWMA(R, lambda = 0.94, initialWindow = 10, n = 10,
+  type = c("volatility", "covariance", "correlation"))
 }
 \arguments{
   \item{R}{xts object of asset returns}
@@ -23,21 +23,21 @@
   correlation.}
 }
 \value{
-  an EWMA object with the following elements \itemize{
-  \item \code{estimate} EWMA model estimated statistic
-  \item \code{model} list with model parameters \item
-  \code{data} list with original returns data and realized
-  statistic if applicable }
+an EWMA object with the following elements \itemize{ \item
+\code{estimate} EWMA model estimated statistic \item
+\code{model} list with model parameters \item \code{data}
+list with original returns data and realized statistic if
+applicable }
 }
 \description{
-  EWMA model to estimate volatility, covariance, and
-  correlation
+EWMA model to estimate volatility, covariance, and
+correlation
 }
 \details{
-  If lambda=NULL, the lambda value can be estimated for
-  univariate estimates of volatility, covariance, and
-  correlation by minimizing the mean squared error between
-  the estimated value and realized value.
+If lambda=NULL, the lambda value can be estimated for
+univariate estimates of volatility, covariance, and
+correlation by minimizing the mean squared error between
+the estimated value and realized value.
 }
 \examples{
 # data and parameters for EWMA estimate
@@ -78,6 +78,6 @@
 cor_mv
 }
 \author{
-  Ross Bennett and Thomas Fillebeen
+Ross Bennett and Thomas Fillebeen
 }
 

Modified: pkg/GARPFRM/man/backTestVaR.Rd
===================================================================
--- pkg/GARPFRM/man/backTestVaR.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/backTestVaR.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,9 +2,8 @@
 \alias{backtestVaR}
 \title{Backtest Value-at-Risk (VaR)}
 \usage{
-  backtestVaR(R, window = 100, p = 0.95,
-    method = "historical", bootstrap = FALSE,
-    replications = 1000, bootParallel = FALSE)
+backtestVaR(R, window = 100, p = 0.95, method = "historical",
+  bootstrap = FALSE, replications = 1000, bootParallel = FALSE)
 }
 \arguments{
   \item{R}{xts or zoo object of asset returns}
@@ -27,13 +26,12 @@
   parallel, (default FALSE).}
 }
 \description{
-  Backtesting Value-at-Risk estimate over a moving window.
+Backtesting Value-at-Risk estimate over a moving window.
 }
 \details{
-  The size of the moving window is set with the
-  \code{window} argument. For example, if the window size
-  is 100, periods 1:100 are used to estimate the VaR level
-  for period 101.
+The size of the moving window is set with the \code{window}
+argument. For example, if the window size is 100, periods
+1:100 are used to estimate the VaR level for period 101.
 }
 \examples{
 data(crsp_weekly)
@@ -45,10 +43,10 @@
 head(getVaRViolations(backtest))
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[PerformanceAnalytics]{VaR}},
-  \code{\link{bootVaR}}
+\code{\link[PerformanceAnalytics]{VaR}},
+\code{\link{bootVaR}}
 }
 

Modified: pkg/GARPFRM/man/backtestVaR.GARCH.Rd
===================================================================
--- pkg/GARPFRM/man/backtestVaR.GARCH.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/backtestVaR.GARCH.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,8 +2,8 @@
 \alias{backtestVaR.GARCH}
 \title{GARCH Model VaR Backtest}
 \usage{
-  backtestVaR.GARCH(garch, p = c(0.95, 0.99), nAhead = 1,
-    refitEvery = 25, window = 100)
+backtestVaR.GARCH(garch, p = c(0.95, 0.99), nAhead = 1, refitEvery = 25,
+  window = 100)
 }
 \arguments{
   \item{garch}{uvGARCH object create via
@@ -20,13 +20,13 @@
   VaR estimate.}
 }
 \description{
-  Function for rolling estimate of GARCH model and VaR
-  backtest
+Function for rolling estimate of GARCH model and VaR
+backtest
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[rugarch]{ugarchroll}}
+\code{\link[rugarch]{ugarchroll}}
 }
 

Modified: pkg/GARPFRM/man/bootCor.Rd
===================================================================
--- pkg/GARPFRM/man/bootCor.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootCor.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,7 +2,7 @@
 \alias{bootCor}
 \title{Bootstrap Correlation}
 \usage{
-  bootCor(R, ..., replications = 1000, parallel = FALSE)
+bootCor(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -16,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the correlation of an xts object or matrix of
-  asset returns
+Bootstrap the correlation of an xts object or matrix of
+asset returns
 }
 \examples{
 data(crsp_weekly)
@@ -27,9 +27,9 @@
 bootCor(R)
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[stats]{cor}}
+\code{\link[stats]{cor}}
 }
 

Modified: pkg/GARPFRM/man/bootCov.Rd
===================================================================
--- pkg/GARPFRM/man/bootCov.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootCov.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,7 +2,7 @@
 \alias{bootCov}
 \title{Bootstrap Covariance}
 \usage{
-  bootCov(R, ..., replications = 1000, parallel = FALSE)
+bootCov(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -16,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the covariance of an xts object or matrix of
-  asset returns
+Bootstrap the covariance of an xts object or matrix of
+asset returns
 }
 \examples{
 data(crsp_weekly)
@@ -26,9 +26,9 @@
 bootCov(R)
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[stats]{cov}}
+\code{\link[stats]{cov}}
 }
 

Modified: pkg/GARPFRM/man/bootES.Rd
===================================================================
--- pkg/GARPFRM/man/bootES.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootES.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,7 +2,7 @@
 \alias{bootES}
 \title{Bootstrap Expected Shortfall}
 \usage{
-  bootES(R, ..., replications = 1000, parallel = FALSE)
+bootES(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -16,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the Expected Shortfall (ES) of an xts object or
-  matrix of asset returns
+Bootstrap the Expected Shortfall (ES) of an xts object or
+matrix of asset returns
 }
 \examples{
 data(crsp_weekly)
@@ -27,9 +27,9 @@
 bootVaR(R, p=0.9, method="historical", invert=FALSE)
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[PerformanceAnalytics]{ES}}
+\code{\link[PerformanceAnalytics]{ES}}
 }
 

Modified: pkg/GARPFRM/man/bootFUN.Rd
===================================================================
--- pkg/GARPFRM/man/bootFUN.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootFUN.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,8 +2,7 @@
 \alias{bootFUN}
 \title{Bootstrap}
 \usage{
-  bootFUN(R, FUN = "mean", ..., replications = 1000,
-    parallel = FALSE)
+bootFUN(R, FUN = "mean", ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of data passed to
@@ -19,41 +18,39 @@
   in parallel.}
 }
 \description{
-  Bootstrap a function
+Bootstrap a function
 }
 \details{
-  \code{R} is the data passed to \code{FUN}. \code{FUN}
-  must have \code{x} or \code{R} as arguments for the data.
-  For example, see the functions linked to in the 'See
-  Also' section. Care must be taken when using
-  \code{bootFUN} on multivariate data. This function is
-  designed to only accept univariate (i.e. ncol(R) = 1)
-  data, however is made to work with bivariate data for
-  \code{bootCor} and \code{bootCov}. For multivariate data,
-  a wrapper function should be written to apply the
-  bootstrap function to each column of data.
+\code{R} is the data passed to \code{FUN}. \code{FUN} must
+have \code{x} or \code{R} as arguments for the data. For
+example, see the functions linked to in the 'See Also'
+section. Care must be taken when using \code{bootFUN} on
+multivariate data. This function is designed to only accept
+univariate (i.e. ncol(R) = 1) data, however is made to work
+with bivariate data for \code{bootCor} and \code{bootCov}.
+For multivariate data, a wrapper function should be written
+to apply the bootstrap function to each column of data.
 
-  To run the bootstrap in parallael, this function uses the
-  \code{foreach} pacakge. According to the
-  \code{\link[foreach]{foreach}} documentation, the
-  parallel computation depends upon a parallel backend that
-  must be registered before performing the computation. The
-  parallel backends available will be system-specific, but
-  include \code{doParallel}, which uses R's built-in
-  parallel package, \code{doMC}, which uses the multicore
-  package, and \code{doSNOW}. Each parallel backend has a
-  specific registration function, such as
-  \code{registerDoParallel} or \code{registerDoSNOW}.
+To run the bootstrap in parallael, this function uses the
+\code{foreach} pacakge. According to the
+\code{\link[foreach]{foreach}} documentation, the parallel
+computation depends upon a parallel backend that must be
+registered before performing the computation. The parallel
+backends available will be system-specific, but include
+\code{doParallel}, which uses R's built-in parallel
+package, \code{doMC}, which uses the multicore package, and
+\code{doSNOW}. Each parallel backend has a specific
+registration function, such as \code{registerDoParallel} or
+\code{registerDoSNOW}.
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link{bootMean}}, \code{\link{bootSD}},
-  \code{\link{bootStdDev}},
-  \code{\link{bootSimpleVolatility}},
-  \code{\link{bootCor}}, \code{\link{bootCov}},
-  \code{\link{bootVaR}}, \code{\link{bootES}},
-  \code{\link[foreach]{foreach}}
+\code{\link{bootMean}}, \code{\link{bootSD}},
+\code{\link{bootStdDev}},
+\code{\link{bootSimpleVolatility}}, \code{\link{bootCor}},
+\code{\link{bootCov}}, \code{\link{bootVaR}},
+\code{\link{bootES}}, \code{\link[foreach]{foreach}}
 }
 

Modified: pkg/GARPFRM/man/bootMean.Rd
===================================================================
--- pkg/GARPFRM/man/bootMean.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootMean.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,7 +2,7 @@
 \alias{bootMean}
 \title{Bootstrap Mean}
 \usage{
-  bootMean(R, ..., replications = 1000, parallel = FALSE)
+bootMean(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -16,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the mean of an xts object or matrix of asset
-  returns
+Bootstrap the mean of an xts object or matrix of asset
+returns
 }
 \examples{
 data(crsp_weekly)
@@ -26,9 +26,9 @@
 bootMean(R)
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[base]{mean}}
+\code{\link[base]{mean}}
 }
 

Modified: pkg/GARPFRM/man/bootSD.Rd
===================================================================
--- pkg/GARPFRM/man/bootSD.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootSD.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,7 +2,7 @@
 \alias{bootSD}
 \title{Bootstrap Standard Deviation}
 \usage{
-  bootSD(R, ..., replications = 1000, parallel = FALSE)
+bootSD(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -16,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the standard deviation of an xts object or
-  matrix of asset returns
+Bootstrap the standard deviation of an xts object or matrix
+of asset returns
 }
 \examples{
 data(crsp_weekly)
@@ -26,9 +26,9 @@
 bootSD(R)
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link[stats]{sd}}
+\code{\link[stats]{sd}}
 }
 

Modified: pkg/GARPFRM/man/bootSimpleVolatility.Rd
===================================================================
--- pkg/GARPFRM/man/bootSimpleVolatility.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootSimpleVolatility.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,8 +2,7 @@
 \alias{bootSimpleVolatility}
 \title{Bootstrap Simple Volatility}
 \usage{
-  bootSimpleVolatility(R, ..., replications = 1000,
-    parallel = FALSE)
+bootSimpleVolatility(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -17,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the simple volatility of an xts object or
-  matrix of asset returns
+Bootstrap the simple volatility of an xts object or matrix
+of asset returns
 }
 \examples{
 data(crsp_weekly)
@@ -27,9 +26,9 @@
 bootSimpleVolatility(R)
 }
 \author{
-  Ross Bennett
+Ross Bennett
 }
 \seealso{
-  \code{\link{simpleVolatility}}
+\code{\link{simpleVolatility}}
 }
 

Modified: pkg/GARPFRM/man/bootStdDev.Rd
===================================================================
--- pkg/GARPFRM/man/bootStdDev.Rd	2014-03-30 17:51:50 UTC (rev 152)
+++ pkg/GARPFRM/man/bootStdDev.Rd	2014-03-30 21:40:51 UTC (rev 153)
@@ -2,7 +2,7 @@
 \alias{bootStdDev}
 \title{Bootstrap StdDev}
 \usage{
-  bootStdDev(R, ..., replications = 1000, parallel = FALSE)
+bootStdDev(R, ..., replications = 1000, parallel = FALSE)
 }
 \arguments{
   \item{R}{xts object or matrix of asset returns}
@@ -16,8 +16,8 @@
   bootstrap in parallel.}
 }
 \description{
-  Bootstrap the StdDev of an xts object or matrix of asset
-  returns
+Bootstrap the StdDev of an xts object or matrix of asset
+returns
 }
 \examples{
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/uwgarp -r 153


More information about the Uwgarp-commits mailing list