[Xts-commits] r630 - in pkg/xtsExtra: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 13 19:55:02 CEST 2012


Author: weylandt
Date: 2012-06-13 19:55:01 +0200 (Wed, 13 Jun 2012)
New Revision: 630

Added:
   pkg/xtsExtra/R/StructTS.R
   pkg/xtsExtra/man/HoltWinters.xts.Rd
   pkg/xtsExtra/man/StructTS.xts.Rd
Modified:
   pkg/xtsExtra/NAMESPACE
   pkg/xtsExtra/R/arima.R
   pkg/xtsExtra/man/acf.xts.Rd
   pkg/xtsExtra/man/arima.xts.Rd
Log:
Added HW & StructTS; also cleaned up calls for arima[0] functions

Modified: pkg/xtsExtra/NAMESPACE
===================================================================
--- pkg/xtsExtra/NAMESPACE	2012-06-13 16:31:40 UTC (rev 629)
+++ pkg/xtsExtra/NAMESPACE	2012-06-13 17:55:01 UTC (rev 630)
@@ -28,4 +28,13 @@
 S3method(arima0, default)
 S3method(arima0, xts)
 
+export("StructTS")
+
+S3method(StructTS, default)
+S3method(StructTS, xts)
+
+export("HoltWinters")
+S3method(HoltWinters, default)
+S3method(HoltWinters, xts)
+
 ## Data frame capability
\ No newline at end of file

Added: pkg/xtsExtra/R/StructTS.R
===================================================================
--- pkg/xtsExtra/R/StructTS.R	                        (rev 0)
+++ pkg/xtsExtra/R/StructTS.R	2012-06-13 17:55:01 UTC (rev 630)
@@ -0,0 +1,41 @@
+StructTS <- function(x, ...){
+  UseMethod("StructTS")
+}
+
+StructTS.default <- function(x, ...){
+  stats::StructTS(x, ...)
+}
+
+StructTS.xts <- function(x, ...){
+  check.xts.stats(x)
+  
+  ans <- StructTS(coredata(x[, 1, drop = FALSE]), ...)
+  
+  ans$data <- xts(ans$data, time(x))
+  ans$residuals <- xts(ans$residuals, time(x))
+  
+  class(ans) <- c("xtsStructTS","StructTS")
+  
+  ans
+}
+
+HoltWinters <- function(x, ...){
+  UseMethod("HoltWinters")
+}
+
+HoltWinters.default <- function(x, ...){
+  stats::HoltWinters(x, ...)
+}
+
+HoltWinters.xts <- function(x, ...){
+  check.xts.stats(x)
+  
+  ans <- HoltWinters(coredata(x[, 1, drop = FALSE]), ...)
+  
+  ans$fitted <- as.xts(ans$fitted)
+  ans$x <- xts(ans$x, time(x))
+  
+  class(ans) <- c("xtsHoltWinters","HoltWinters")
+  
+  ans
+}
\ No newline at end of file

Modified: pkg/xtsExtra/R/arima.R
===================================================================
--- pkg/xtsExtra/R/arima.R	2012-06-13 16:31:40 UTC (rev 629)
+++ pkg/xtsExtra/R/arima.R	2012-06-13 17:55:01 UTC (rev 630)
@@ -3,15 +3,23 @@
 }
 
 arima.default <- function(x, ...){
-  stats::arima(x, ...)
+  series <- deparse(substitute(x))
+  ans <- stats::arima(x, ...)
+  ans$series <- series
+  ans$call <- match.call()
+  
+  ans
 }
 
 arima.xts <- function(x, ...){
+  series <- deparse(substitute(x))
   check.xts.stats(x)
   
   ans <- arima(coredata(x[, 1, drop = FALSE]), ...)
   
   ans$residuals <- xts(ans$residuals, time(x))
+  ans$call <- match.call()
+  ans$series <- series
   
   class(ans) <- c("xtsArima","Arima")
   
@@ -23,16 +31,24 @@
 }
 
 arima0.default <- function(x, ...){
-  stats::arima(x, ...)
+  series <- deparse(substitute(x))
+  
+  ans <- stats::arima0(x, ...)
+  ans$call <- match.call()
+  ans$series <- series
+  
+  ans
 }
 
 arima0.xts <- function(x, ...){
+  series <- deparse(substitute(x))
   check.xts.stats(x)
   
   ans <- arima0(coredata(x[, 1, drop = FALSE]), ...)
   
   ans$residuals <- xts(ans$residuals, time(x))
-  
+  ans$call <- match.call()
+  ans$series <- series
   class(ans) <- c("xtsarima0","arima0")
   
   ans

Added: pkg/xtsExtra/man/HoltWinters.xts.Rd
===================================================================
--- pkg/xtsExtra/man/HoltWinters.xts.Rd	                        (rev 0)
+++ pkg/xtsExtra/man/HoltWinters.xts.Rd	2012-06-13 17:55:01 UTC (rev 630)
@@ -0,0 +1,25 @@
+\name{HoltWinters.xts}
+
+\alias{HoltWinters}
+\alias{HoltWinters.default}
+\alias{HoltWinters.xts}
+
+\title{ HoltWinters for xts Objects }
+\description{Holt-Winters Filtering for xts objects}
+\usage{
+\method{HoltWinters}{xts}(x, ...)
+}
+\arguments{
+  \item{x}{ an \code{xts} object }
+  \item{...}{ additional arguments to be passed to the \code{stats} function which drives these methods.}
+}
+\details{
+  Currently little more than thin wrappers to \code{stats::HoltWinters} for xts objects. Will receive increased functionality going forward. See documentation of those functions for more information about the calculation mechanisms.
+}
+\value{A \code{HoltWinters} object with the residuals and fitted values coerced back to xts objects.}
+\author{ Michael Weylandt }
+
+\examples{
+# Hopefully we don't break this
+example("HoltWinters","stats")
+}
\ No newline at end of file

Added: pkg/xtsExtra/man/StructTS.xts.Rd
===================================================================
--- pkg/xtsExtra/man/StructTS.xts.Rd	                        (rev 0)
+++ pkg/xtsExtra/man/StructTS.xts.Rd	2012-06-13 17:55:01 UTC (rev 630)
@@ -0,0 +1,25 @@
+\name{StructTS.xts}
+
+\alias{StructTS}
+\alias{StructTS.default}
+\alias{StructTS.xts}
+
+\title{ StructTS for xts Objects }
+\description{Fitting structural time series models for xts objects}
+\usage{
+\method{StructTS}{xts}(x, ...)
+}
+\arguments{
+  \item{x}{ an \code{xts} object }
+  \item{...}{ additional arguments to be passed to the \code{stats} function which drives these methods.}
+}
+\details{
+  Currently little more than thin wrappers to \code{stats::StructTS} for xts objects. Will receive increased functionality going forward. See documentation of those functions for more information about the calculation mechanisms.
+}
+\value{A \code{StructTS} object with the residuals and fitted values coerced back to xts objects.}
+\author{ Michael Weylandt }
+
+\examples{
+# Hopefully we don't break this
+example("StructTS","stats")
+}
\ No newline at end of file

Modified: pkg/xtsExtra/man/acf.xts.Rd
===================================================================
--- pkg/xtsExtra/man/acf.xts.Rd	2012-06-13 16:31:40 UTC (rev 629)
+++ pkg/xtsExtra/man/acf.xts.Rd	2012-06-13 17:55:01 UTC (rev 630)
@@ -17,4 +17,10 @@
   Currently little more than thin wrappers to \code{stats::acf} and \code{stats::pacf.default} for xts objects. Will receive increased functionality going forward. See documentation of those functions for more information about the calculation mechanisms.
 }
 \value{An \code{acf} or \code{pacf} object as appropriate.}
-\author{ Michael Weylandt }
\ No newline at end of file
+\author{ Michael Weylandt }
+
+\examples{
+# Hopefully we don't break this
+example("acf", "stats")
+example("pacf", "stats")
+}
\ No newline at end of file

Modified: pkg/xtsExtra/man/arima.xts.Rd
===================================================================
--- pkg/xtsExtra/man/arima.xts.Rd	2012-06-13 16:31:40 UTC (rev 629)
+++ pkg/xtsExtra/man/arima.xts.Rd	2012-06-13 17:55:01 UTC (rev 630)
@@ -22,4 +22,10 @@
   Currently little more than thin wrappers to \code{stats::arima} and \code{stats::arima0} for xts objects. Will receive increased functionality going forward. See documentation of those functions for more information about the calculation mechanisms.
 }
 \value{An \code{Arima} or \code{arima0} object as appropriate with the residuals coerced back to xts objects.}
-\author{ Michael Weylandt }
\ No newline at end of file
+\author{ Michael Weylandt }
+
+\examples{
+# Hopefully we don't break this
+example("arima","stats")
+example("arima0","stats")
+}
\ No newline at end of file



More information about the Xts-commits mailing list