[Robust-ts-commits] r18 - in pkg/robust-ts: . inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 18 19:07:33 CET 2009
Author: ruckdeschel
Date: 2009-03-18 19:07:33 +0100 (Wed, 18 Mar 2009)
New Revision: 18
Added:
pkg/robust-ts/DESCRIPTION
pkg/robust-ts/NAMESPACE
pkg/robust-ts/inst/
pkg/robust-ts/inst/NEWS
pkg/robust-ts/man/ACF.Rd
pkg/robust-ts/man/AcfPacf.Rd
pkg/robust-ts/man/CovQn.Rd
pkg/robust-ts/man/PSD3.Rd
pkg/robust-ts/man/Spearman.Rd
pkg/robust-ts/man/Trans.Rd
pkg/robust-ts/man/robust-ts-package.Rd
Log:
by means of package.skeleton have written a template
(which still has to be filled, though; --- R CMD check still fails!)
for the package
Added: pkg/robust-ts/DESCRIPTION
===================================================================
--- pkg/robust-ts/DESCRIPTION (rev 0)
+++ pkg/robust-ts/DESCRIPTION 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,12 @@
+Package: robust.ts
+Version: 0.1
+Date: 2009-03-18
+Title: Basic Robust Time Series Infrastructure
+Description: Routines for robust autocovariances
+Author: Bernhard Spangl, Roland Fried
+Maintainer: Peter Ruckdeschel <Peter.Ruckdeschel at itwm.fraunhofer.de>
+Depends: R(>= 2.3.0), methods, startupmsg, robustbase
+Imports: stats, MASS
+LazyLoad: yes
+License: LGPL-3
+URL: http://robust-ts.r-forge.r-project.org/
Added: pkg/robust-ts/NAMESPACE
===================================================================
--- pkg/robust-ts/NAMESPACE (rev 0)
+++ pkg/robust-ts/NAMESPACE 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,6 @@
+import("methods")
+import("stats")
+import("startupmsg")
+
+export("PSD3", "Trans", "AcfPacf", "CovQn",
+ "ACF", "Spearman")
\ No newline at end of file
Added: pkg/robust-ts/inst/NEWS
===================================================================
--- pkg/robust-ts/inst/NEWS (rev 0)
+++ pkg/robust-ts/inst/NEWS 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,11 @@
+######################################################################
+# News: to package robust-ts
+######################################################################
+
+##############
+v 0.1 18-03-09
+##############
+
+* gathering of implementations to robust variants of ACF by Bernhard Spangl
+* packaged by P.R.
+
Added: pkg/robust-ts/man/ACF.Rd
===================================================================
--- pkg/robust-ts/man/ACF.Rd (rev 0)
+++ pkg/robust-ts/man/ACF.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,95 @@
+\name{ACF}
+\Rdversion{1.1}
+\alias{ACF}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%% ~~function to do ... ~~
+}
+\description{
+%% ~~ A concise (1-5 lines) description of what the function does. ~~
+}
+\usage{
+ACF(x, type = "spearman", cov = FALSE, modified = TRUE)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{x}{
+%% ~~Describe \code{x} here~~
+}
+ \item{type}{
+%% ~~Describe \code{type} here~~
+}
+ \item{cov}{
+%% ~~Describe \code{cov} here~~
+}
+ \item{modified}{
+%% ~~Describe \code{modified} here~~
+}
+}
+\details{
+%% ~~ If necessary, more details than the description above ~~
+}
+\value{
+%% ~Describe the value returned
+%% If it is a LIST, use
+%% \item{comp1 }{Description of 'comp1'}
+%% \item{comp2 }{Description of 'comp2'}
+%% ...
+}
+\references{
+%% ~put references to the literature/web site here ~
+}
+\author{
+%% ~~who you are~~
+}
+\note{
+%% ~~further notes~~
+}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+\seealso{
+%% ~~objects to See Also as \code{\link{help}}, ~~~
+}
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==> Define data, use random,
+##-- or do help(data=index) for the standard data sets.
+
+## The function is currently defined as
+function (x, type = "spearman", cov = FALSE, modified = TRUE)
+{
+ n <- length(x)
+ mlag <- n - 2
+ acovf <- rep(NA, mlag + 1)
+ acf <- rep(NA, mlag + 1)
+ for (i in 0:mlag) {
+ x1 <- x[(1 + i):n]
+ x2 <- x[1:(n - i)]
+ if (type == "spearman") {
+ acf[i + 1] <- Spearman(x1, x2, n)
+ }
+ if (type == "Qn") {
+ if (modified) {
+ res <- CovQn(x1, x2, cov, n)
+ acf[i + 1] <- res$acf.m
+ if (cov) {
+ acovf[i + 1] <- res$acovf.m
+ }
+ }
+ else {
+ res <- CovQn(x1, x2, cov)
+ acf[i + 1] <- res$acf
+ if (cov) {
+ acovf[i + 1] <- res$acovf
+ }
+ }
+ }
+ }
+ return(list(ACF = c(acf, 0), ACovF = c(acovf, 0)))
+ }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
Added: pkg/robust-ts/man/AcfPacf.Rd
===================================================================
--- pkg/robust-ts/man/AcfPacf.Rd (rev 0)
+++ pkg/robust-ts/man/AcfPacf.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,91 @@
+\name{AcfPacf}
+\Rdversion{1.1}
+\alias{AcfPacf}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%% ~~function to do ... ~~
+}
+\description{
+%% ~~ A concise (1-5 lines) description of what the function does. ~~
+}
+\usage{
+AcfPacf(x, mx, type = "spearman")
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{x}{
+%% ~~Describe \code{x} here~~
+}
+ \item{mx}{
+%% ~~Describe \code{mx} here~~
+}
+ \item{type}{
+%% ~~Describe \code{type} here~~
+}
+}
+\details{
+%% ~~ If necessary, more details than the description above ~~
+}
+\value{
+%% ~Describe the value returned
+%% If it is a LIST, use
+%% \item{comp1 }{Description of 'comp1'}
+%% \item{comp2 }{Description of 'comp2'}
+%% ...
+}
+\references{
+%% ~put references to the literature/web site here ~
+}
+\author{
+%% ~~who you are~~
+}
+\note{
+%% ~~further notes~~
+}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+\seealso{
+%% ~~objects to See Also as \code{\link{help}}, ~~~
+}
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==> Define data, use random,
+##-- or do help(data=index) for the standard data sets.
+
+## The function is currently defined as
+function (x, mx, type = "spearman")
+{
+ if (missing(mx)) {
+ mx <- mean(x)
+ }
+ x <- x - mx
+ n <- length(x)
+ mlag <- n - 2
+ rho <- rep(NA, n)
+ A <- matrix(NA, n - 2, n - 2)
+ cor <- switch(type, pearson = get("cor", mode = "function"),
+ spearman = get("Spearman", mode = "function"))
+ rho[1] <- 1
+ A[1, 1] <- cor(x[1:(n - 1)], x[2:n], n)
+ rho[2] <- A[1, 1]
+ for (h in 2:mlag) {
+ X <- embed(x, h + 1)
+ u <- X[, 1] - X[, 2:h] \%*\% t(A[h - 1, 1:(h - 1), drop = F])
+ v <- X[, h + 1] - X[, h:2] \%*\% t(A[h - 1, 1:(h - 1),
+ drop = F])
+ A[h, h] <- cor(u, v, n)
+ for (i in 1:(h - 1)) {
+ A[h, i] <- A[h - 1, i] - A[h, h] * A[h - 1, h - i]
+ }
+ rho[h + 1] <- A[h - 1, 1:(h - 1)] \%*\% rev(rho[2:h]) +
+ A[h, h] * (1 - A[h - 1, 1:(h - 1)] \%*\% rho[2:h])
+ }
+ rho[n] <- 0
+ return(list(ACF = rho, A = A))
+ }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
Added: pkg/robust-ts/man/CovQn.Rd
===================================================================
--- pkg/robust-ts/man/CovQn.Rd (rev 0)
+++ pkg/robust-ts/man/CovQn.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,83 @@
+\name{CovQn}
+\Rdversion{1.1}
+\alias{CovQn}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%% ~~function to do ... ~~
+}
+\description{
+%% ~~ A concise (1-5 lines) description of what the function does. ~~
+}
+\usage{
+CovQn(u, v, cov = FALSE, N)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{u}{
+%% ~~Describe \code{u} here~~
+}
+ \item{v}{
+%% ~~Describe \code{v} here~~
+}
+ \item{cov}{
+%% ~~Describe \code{cov} here~~
+}
+ \item{N}{
+%% ~~Describe \code{N} here~~
+}
+}
+\details{
+%% ~~ If necessary, more details than the description above ~~
+}
+\value{
+%% ~Describe the value returned
+%% If it is a LIST, use
+%% \item{comp1 }{Description of 'comp1'}
+%% \item{comp2 }{Description of 'comp2'}
+%% ...
+}
+\references{
+%% ~put references to the literature/web site here ~
+}
+\author{
+%% ~~who you are~~
+}
+\note{
+%% ~~further notes~~
+}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+\seealso{
+%% ~~objects to See Also as \code{\link{help}}, ~~~
+}
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==> Define data, use random,
+##-- or do help(data=index) for the standard data sets.
+
+## The function is currently defined as
+function (u, v, cov = FALSE, N)
+{
+ acf <- acovf <- NA
+ acf.m <- acovf.m <- NA
+ n <- length(u)
+ if (missing(N)) {
+ N <- n
+ }
+ mod.fact <- n/N
+ Q1 <- Qn(u + v)^2
+ Q2 <- Qn(u - v)^2
+ acf <- (Q1 - Q2)/(Q1 + Q2)
+ acf.m <- mod.fact * acf
+ if (cov) {
+ acovf <- (Q1 - Q2)/4
+ acovf.m <- mod.fact * acovf
+ }
+ return(list(acf = acf, acf.m = acf.m, acovf = acovf, acovf.m = acovf.m))
+ }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
Added: pkg/robust-ts/man/PSD3.Rd
===================================================================
--- pkg/robust-ts/man/PSD3.Rd (rev 0)
+++ pkg/robust-ts/man/PSD3.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,92 @@
+\name{PSD3}
+\Rdversion{1.1}
+\alias{PSD3}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%% ~~function to do ... ~~
+}
+\description{
+%% ~~ A concise (1-5 lines) description of what the function does. ~~
+}
+\usage{
+PSD3(r, f, finv, delta = 0.05, ...)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{r}{
+%% ~~Describe \code{r} here~~
+}
+ \item{f}{
+%% ~~Describe \code{f} here~~
+}
+ \item{finv}{
+%% ~~Describe \code{finv} here~~
+}
+ \item{delta}{
+%% ~~Describe \code{delta} here~~
+}
+ \item{\dots}{
+%% ~~Describe \code{\dots} here~~
+}
+}
+\details{
+%% ~~ If necessary, more details than the description above ~~
+}
+\value{
+%% ~Describe the value returned
+%% If it is a LIST, use
+%% \item{comp1 }{Description of 'comp1'}
+%% \item{comp2 }{Description of 'comp2'}
+%% ...
+}
+\references{
+%% ~put references to the literature/web site here ~
+}
+\author{
+%% ~~who you are~~
+}
+\note{
+%% ~~further notes~~
+}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+\seealso{
+%% ~~objects to See Also as \code{\link{help}}, ~~~
+}
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==> Define data, use random,
+##-- or do help(data=index) for the standard data sets.
+
+## The function is currently defined as
+function (r, f, finv, delta = 0.05, ...)
+{
+ r <- as.vector(r)
+ R <- toeplitz(r)
+ was.psd <- is.positive.definite(R, method = "eigen", ...)
+ is.psd <- was.psd
+ if (!was.psd) {
+ limit <- finv(delta)
+ while (!is.psd) {
+ r <- sapply(r[-1], Trans, f = f, finv = finv, delta = delta,
+ limit = limit)
+ r <- c(1, r)
+ R.psd <- toeplitz(r)
+ is.psd <- is.positive.definite(R.psd, method = "eigen",
+ ...)
+ }
+ res <- list(r.psd = R.psd[1, ], R.psd = R.psd, R = R,
+ was.psd = was.psd, is.psd = is.psd)
+ }
+ else {
+ res <- list(r.psd = r, R.psd = R, R = R, was.psd = was.psd,
+ is.psd = is.psd)
+ }
+ return(res)
+ }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
Added: pkg/robust-ts/man/Spearman.Rd
===================================================================
--- pkg/robust-ts/man/Spearman.Rd (rev 0)
+++ pkg/robust-ts/man/Spearman.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,73 @@
+\name{Spearman}
+\Rdversion{1.1}
+\alias{Spearman}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%% ~~function to do ... ~~
+}
+\description{
+%% ~~ A concise (1-5 lines) description of what the function does. ~~
+}
+\usage{
+Spearman(x, y, N)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{x}{
+%% ~~Describe \code{x} here~~
+}
+ \item{y}{
+%% ~~Describe \code{y} here~~
+}
+ \item{N}{
+%% ~~Describe \code{N} here~~
+}
+}
+\details{
+%% ~~ If necessary, more details than the description above ~~
+}
+\value{
+%% ~Describe the value returned
+%% If it is a LIST, use
+%% \item{comp1 }{Description of 'comp1'}
+%% \item{comp2 }{Description of 'comp2'}
+%% ...
+}
+\references{
+%% ~put references to the literature/web site here ~
+}
+\author{
+%% ~~who you are~~
+}
+\note{
+%% ~~further notes~~
+}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+\seealso{
+%% ~~objects to See Also as \code{\link{help}}, ~~~
+}
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==> Define data, use random,
+##-- or do help(data=index) for the standard data sets.
+
+## The function is currently defined as
+function (x, y, N)
+{
+ if (missing(N)) {
+ N <- length(x)
+ }
+ n <- length(x)
+ rx <- rank(x)
+ ry <- rank(y)
+ rho <- 12/(N * (n^2 - 1)) * ((rx - (n + 1)/2) \%*\% (ry - (n +
+ 1)/2))
+ return(drop(rho))
+ }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
Added: pkg/robust-ts/man/Trans.Rd
===================================================================
--- pkg/robust-ts/man/Trans.Rd (rev 0)
+++ pkg/robust-ts/man/Trans.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,81 @@
+\name{Trans}
+\Rdversion{1.1}
+\alias{Trans}
+%- Also NEED an '\alias' for EACH other topic documented here.
+\title{
+%% ~~function to do ... ~~
+}
+\description{
+%% ~~ A concise (1-5 lines) description of what the function does. ~~
+}
+\usage{
+Trans(r, f, finv, delta, limit)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{r}{
+%% ~~Describe \code{r} here~~
+}
+ \item{f}{
+%% ~~Describe \code{f} here~~
+}
+ \item{finv}{
+%% ~~Describe \code{finv} here~~
+}
+ \item{delta}{
+%% ~~Describe \code{delta} here~~
+}
+ \item{limit}{
+%% ~~Describe \code{limit} here~~
+}
+}
+\details{
+%% ~~ If necessary, more details than the description above ~~
+}
+\value{
+%% ~Describe the value returned
+%% If it is a LIST, use
+%% \item{comp1 }{Description of 'comp1'}
+%% \item{comp2 }{Description of 'comp2'}
+%% ...
+}
+\references{
+%% ~put references to the literature/web site here ~
+}
+\author{
+%% ~~who you are~~
+}
+\note{
+%% ~~further notes~~
+}
+
+%% ~Make other sections like Warning with \section{Warning }{....} ~
+
+\seealso{
+%% ~~objects to See Also as \code{\link{help}}, ~~~
+}
+\examples{
+##---- Should be DIRECTLY executable !! ----
+##-- ==> Define data, use random,
+##-- or do help(data=index) for the standard data sets.
+
+## The function is currently defined as
+function (r, f, finv, delta, limit)
+{
+ if (r < -limit) {
+ finv(f(r) + delta)
+ }
+ else {
+ if (r <= limit) {
+ 0
+ }
+ else {
+ finv(f(r) - delta)
+ }
+ }
+ }
+}
+% Add one or more standard keywords, see file 'KEYWORDS' in the
+% R documentation directory.
+\keyword{ ~kwd1 }
+\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
Added: pkg/robust-ts/man/robust-ts-package.Rd
===================================================================
--- pkg/robust-ts/man/robust-ts-package.Rd (rev 0)
+++ pkg/robust-ts/man/robust-ts-package.Rd 2009-03-18 18:07:33 UTC (rev 18)
@@ -0,0 +1,45 @@
+\name{robust-ts-package}
+\Rdversion{1.1}
+\alias{robust-ts-package}
+\alias{robust.ts-package}
+\alias{robust-ts}
+\alias{robust.ts}
+\docType{package}
+\title{
+What the package does (short line)
+~~ package title ~~
+}
+\description{
+More about what it does (maybe more than one line)
+~~ A concise (1-5 lines) description of the package ~~
+}
+\details{
+\tabular{ll}{
+Package: \tab robust.ts\cr
+Version: \tab 0.1\cr
+Date: \tab 2009-03-18\cr
+License: \tab LGPL-3\cr
+LazyLoad: \tab yes\cr
+}
+~~ An overview of how to use the package, including the most important ~~
+~~ functions ~~
+}
+\author{
+Who wrote it
+
+Maintainer: Who to complain to <yourfault at somewhere.net>
+~~ The author and/or maintainer of the package ~~
+}
+\references{
+~~ Literature or other references for background information ~~
+}
+~~ Optionally other standard keywords, one per line, from file KEYWORDS in ~~
+~~ the R documentation directory ~~
+\keyword{ package }
+\seealso{
+~~ Optional links to other man pages, e.g. ~~
+~~ \code{\link[<pkg>:<pkg>-package]{<pkg>}} ~~
+}
+\examples{
+~~ simple examples of the most important functions ~~
+}
More information about the Robust-ts-commits
mailing list