[Vars-commits] r105 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Aug 5 12:47:00 CEST 2018


Author: bpfaff
Date: 2018-08-05 12:46:59 +0200 (Sun, 05 Aug 2018)
New Revision: 105

Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/stability.R
   pkg/man/stability.Rd
Log:
Converted stability() as a method


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2014-01-11 16:36:56 UTC (rev 104)
+++ pkg/DESCRIPTION	2018-08-05 10:46:59 UTC (rev 105)
@@ -2,10 +2,21 @@
 Type: Package
 Title: VAR Modelling
 Version: 1.5-3
-Date: 2013-08-15
+Date: 2018-08-05
 Authors at R: c(person("Bernhard", "Pfaff", email = "bernhard at pfaffikus.de", role = c("aut", "cre")), person("Matthieu", "Stigler", role = "ctb"))
-Depends: R (>= 2.0.0), MASS, strucchange, urca (>= 1.1-6), lmtest (>= 0.9-26), sandwich (>= 2.2-4)
+Depends: R (>= 2.0.0), MASS, strucchange, urca (>= 1.1-6), lmtest (>=
+        0.9-26), sandwich (>= 2.2-4)
 LazyLoad: yes
 Description: Estimation, lag selection, diagnostic testing, forecasting, causality analysis, forecast error variance decomposition and impulse response functions of VAR models and estimation of SVAR and SVEC models.
 License: GPL (>= 2)
 URL: http://www.pfaffikus.de
+Author: Bernhard Pfaff [aut, cre],
+  Matthieu Stigler [ctb]
+Maintainer: Bernhard Pfaff <bernhard at pfaffikus.de>
+Repository: CRAN
+Repository/R-Forge/Project: vars
+Repository/R-Forge/Revision: 99
+Repository/R-Forge/DateTimeStamp: 2013-07-21 14:35:42
+Date/Publication: 2013-07-22 10:42:44
+Packaged: 2018-07-24 09:02:43 UTC; pfaffb
+NeedsCompilation: no

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2014-01-11 16:36:56 UTC (rev 104)
+++ pkg/NAMESPACE	2018-08-05 10:46:59 UTC (rev 105)
@@ -55,26 +55,38 @@
 S3method(residuals, varest)
 S3method(residuals, vec2var)
 
+S3method(stability, default)
+S3method(stability, varest)
+
 S3method(summary, varest)
 S3method(summary, svarest)
-S3method(summary, svecest)
-
-
-importFrom(lmtest, coeftest)
-importFrom(sandwich, bread)
-importFrom(sandwich, estfun)
-importFrom(sandwich, vcovHC)
-
-S3method(toMlm, varest)
-S3method(coeftest, varest)
-S3method(bread, varest)
-S3method(estfun, varest)
-S3method(vcovHC, varest)
-S3method(vcov, varest)
+S3method(summary, svecest)
 
+importFrom(lmtest, coeftest)
+importFrom(sandwich, bread)
+importFrom(sandwich, estfun)
+importFrom(sandwich, vcovHC)
+
+S3method(toMlm, varest)
+S3method(coeftest, varest)
+S3method(bread, varest)
+S3method(estfun, varest)
+S3method(vcovHC, varest)
+S3method(vcov, varest)
+
 importFrom(urca, ca.jo)
 importFrom(urca, cajorls)
 
+importFrom("grDevices", "gray", "gray.colors", "xy.coords")
+importFrom("graphics", "abline", "axis", "barplot", "box", "hist",
+           "layout", "lines", "mtext", "par", "plot", "polygon",
+           "title")
+importFrom("stats", "acf", "as.formula", "coef", "cor", "cov",
+           "density", "embed", "fitted", "lm", "lm.fit",
+           "model.matrix", "na.omit", "optim", "pacf", "pchisq", "pf",
+           "plot.ts", "predict", "printCoefmat", "qnorm", "quantile",
+           "resid", "residuals", "rnorm", "update", "vcov")
+importFrom("utils", "head", "tail")
 
-
-
+import(MASS)
+import(strucchange)

Modified: pkg/R/stability.R
===================================================================
--- pkg/R/stability.R	2014-01-11 16:36:56 UTC (rev 104)
+++ pkg/R/stability.R	2018-08-05 10:46:59 UTC (rev 105)
@@ -1,8 +1,19 @@
 "stability" <-
-function(x, type = c("OLS-CUSUM", "Rec-CUSUM", "Rec-MOSUM", "OLS-MOSUM", "RE", "ME", "Score-CUSUM", "Score-MOSUM", "fluctuation"), h = 0.15, dynamic = FALSE, rescale = TRUE){
-  if(!(class(x)=="varest")){
-    stop("\nPlease provide an object of class 'varest', generated by 'var()'.\n")
-  }
+function(x, ...){
+  UseMethod("stability")
+}
+
+"stability.default" <-
+    function(x, type = c("OLS-CUSUM", "Rec-CUSUM", "Rec-MOSUM", "OLS-MOSUM", "RE",
+                         "ME", "Score-CUSUM", "Score-MOSUM", "fluctuation"),
+             h = 0.15, dynamic = FALSE, rescale = TRUE, ...){
+        strucchange::sctest(x, ...)
+}
+
+"stability.varest" <-
+    function(x, type = c("OLS-CUSUM", "Rec-CUSUM", "Rec-MOSUM", "OLS-MOSUM", "RE",
+                         "ME", "Score-CUSUM", "Score-MOSUM", "fluctuation"),
+             h = 0.15, dynamic = FALSE, rescale = TRUE, ...){
   type <- match.arg(type)
   K <- x$K
   stability <- list()

Modified: pkg/man/stability.Rd
===================================================================
--- pkg/man/stability.Rd	2014-01-11 16:36:56 UTC (rev 104)
+++ pkg/man/stability.Rd	2018-08-05 10:46:59 UTC (rev 105)
@@ -1,7 +1,8 @@
 \name{stability}
 
 \alias{stability}
-
+\alias{stability.default}
+\alias{stability.varest}
 \alias{print.varstabil}
 
 \title{Structural stability of a VAR(p)}
@@ -16,9 +17,12 @@
 }
 
 \usage{
-stability(x, type = c("OLS-CUSUM", "Rec-CUSUM", "Rec-MOSUM",
-"OLS-MOSUM", "RE", "ME", "Score-CUSUM", "Score-MOSUM",
-"fluctuation"), h = 0.15, dynamic = FALSE, rescale = TRUE)
+\method{stability}{default}(x, type = c("OLS-CUSUM", "Rec-CUSUM",
+"Rec-MOSUM", "OLS-MOSUM", "RE", "ME", "Score-CUSUM", "Score-MOSUM",
+"fluctuation"), h = 0.15, dynamic = FALSE, rescale = TRUE, ...)
+\method{stability}{varest}(x, type = c("OLS-CUSUM", "Rec-CUSUM",
+"Rec-MOSUM", "OLS-MOSUM", "RE", "ME", "Score-CUSUM", "Score-MOSUM",
+"fluctuation"), h = 0.15, dynamic = FALSE, rescale = TRUE, ...)
 }
 
 \arguments{
@@ -36,7 +40,8 @@
     standardized by the regressor matrix of the corresponding subsample;
     if \sQuote{\code{FALSE}} the whole regressor matrix will be
     used. (only if \sQuote{\code{type}} is either \sQuote{\code{RE}} or
-    \sQuote{\code{E}}).}    
+    \sQuote{\code{E}}).}
+  \item{...}{Ellipsis, is passed to \code{strucchange::sctest()}, as default.}
 }
 \details{
   For details, please refer to documentation \code{\link[strucchange]{efp}}.



More information about the Vars-commits mailing list