From 8de6ab6d025435400b6c4b89a6be679b29f68e73 Mon Sep 17 00:00:00 2001 From: Alexios Galanos Date: Fri, 23 Aug 2024 21:45:48 +0300 Subject: [PATCH] Added tsconvolve, tscoskew and tscokurt methods --- .Rbuildignore | 0 .github/.gitignore | 0 .github/workflows/R-CMD-check.yaml | 0 .gitignore | 0 DESCRIPTION | 4 +- NAMESPACE | 3 ++ NEWS.md | 2 + R/convert.R | 0 R/distributions.R | 0 R/methods.R | 58 +++++++++++++++++++++++++++ R/multivariate.R | 0 R/tsmethods-package.R | 0 README.Rmd | 0 README.md | 2 +- man/distribution_list.Rd | 0 man/ensemble_modelspec.Rd | 0 man/estimate.Rd | 0 man/estimate_ad.Rd | 0 man/halflife.Rd | 0 man/pit.Rd | 0 man/plot.Rd | 0 man/tsaggregate.Rd | 0 man/tsbacktest.Rd | 0 man/tsbenchmark.Rd | 0 man/tscalibrate.Rd | 0 man/tscokurt.Rd | 24 +++++++++++ man/tsconvert.Rd | 0 man/tsconvert.tsmodel.distribution.Rd | 0 man/tsconvolve.Rd | 24 +++++++++++ man/tscor.Rd | 0 man/tscoskew.Rd | 24 +++++++++++ man/tscov.Rd | 0 man/tsdecompose.Rd | 0 man/tsdiagnose.Rd | 0 man/tsensemble.Rd | 0 man/tsequation.Rd | 0 man/tsfilter.Rd | 0 man/tsgrowth.Rd | 0 man/tsmethods-package.Rd | 0 man/tsmetrics.Rd | 0 man/tsmoments.Rd | 0 man/tsprofile.Rd | 0 man/tsreport.Rd | 0 man/tsspec.Rd | 0 man/unconditional.Rd | 0 tests/testthat.R | 0 tests/testthat/test-ensemble.R | 0 47 files changed, 138 insertions(+), 3 deletions(-) mode change 100644 => 100755 .Rbuildignore mode change 100644 => 100755 .github/.gitignore mode change 100644 => 100755 .github/workflows/R-CMD-check.yaml mode change 100644 => 100755 .gitignore mode change 100644 => 100755 NAMESPACE mode change 100644 => 100755 NEWS.md mode change 100644 => 100755 R/convert.R mode change 100644 => 100755 R/distributions.R mode change 100644 => 100755 R/multivariate.R mode change 100644 => 100755 R/tsmethods-package.R mode change 100644 => 100755 README.Rmd mode change 100644 => 100755 README.md mode change 100644 => 100755 man/distribution_list.Rd mode change 100644 => 100755 man/ensemble_modelspec.Rd mode change 100644 => 100755 man/estimate.Rd mode change 100644 => 100755 man/estimate_ad.Rd mode change 100644 => 100755 man/halflife.Rd mode change 100644 => 100755 man/pit.Rd mode change 100644 => 100755 man/plot.Rd mode change 100644 => 100755 man/tsaggregate.Rd mode change 100644 => 100755 man/tsbacktest.Rd mode change 100644 => 100755 man/tsbenchmark.Rd mode change 100644 => 100755 man/tscalibrate.Rd create mode 100644 man/tscokurt.Rd mode change 100644 => 100755 man/tsconvert.Rd mode change 100644 => 100755 man/tsconvert.tsmodel.distribution.Rd create mode 100644 man/tsconvolve.Rd mode change 100644 => 100755 man/tscor.Rd create mode 100644 man/tscoskew.Rd mode change 100644 => 100755 man/tscov.Rd mode change 100644 => 100755 man/tsdecompose.Rd mode change 100644 => 100755 man/tsdiagnose.Rd mode change 100644 => 100755 man/tsensemble.Rd mode change 100644 => 100755 man/tsequation.Rd mode change 100644 => 100755 man/tsfilter.Rd mode change 100644 => 100755 man/tsgrowth.Rd mode change 100644 => 100755 man/tsmethods-package.Rd mode change 100644 => 100755 man/tsmetrics.Rd mode change 100644 => 100755 man/tsmoments.Rd mode change 100644 => 100755 man/tsprofile.Rd mode change 100644 => 100755 man/tsreport.Rd mode change 100644 => 100755 man/tsspec.Rd mode change 100644 => 100755 man/unconditional.Rd mode change 100644 => 100755 tests/testthat.R mode change 100644 => 100755 tests/testthat/test-ensemble.R diff --git a/.Rbuildignore b/.Rbuildignore old mode 100644 new mode 100755 diff --git a/.github/.gitignore b/.github/.gitignore old mode 100644 new mode 100755 diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/DESCRIPTION b/DESCRIPTION index e87776c..8bbc88d 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: tsmethods Type: Package Title: Time Series Methods Version: 1.0.2 -Date: 2024-04-01 +Date: 2024-08-23 Authors@R: c(person("Alexios", "Galanos", role = c("aut", "cre","cph"), email = "alexios@4dscape.com")) Maintainer: Alexios Galanos Description: Generic methods for use in a time series probabilistic framework, allowing for a common calling convention across packages. Additional methods for time series prediction ensembles and probabilistic plotting of predictions is included. A more detailed description is available at which shows the currently implemented methods in the 'tsmodels' framework. @@ -11,7 +11,7 @@ Imports: methods, zoo, xts, data.table Encoding: UTF-8 LazyData: true URL: https://www.nopredict.com/packages/tsmethods, https://github.com/tsmodels/tsmethods -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Suggests: testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE old mode 100644 new mode 100755 index cc58611..615c341 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,8 +16,11 @@ export(tsaggregate) export(tsbacktest) export(tsbenchmark) export(tscalibrate) +export(tscokurt) export(tsconvert) +export(tsconvolve) export(tscor) +export(tscoskew) export(tscov) export(tsdecompose) export(tsdiagnose) diff --git a/NEWS.md b/NEWS.md old mode 100644 new mode 100755 index dcdc68c..12e1d10 --- a/NEWS.md +++ b/NEWS.md @@ -6,6 +6,8 @@ validated list of `tsmodel.distribution` objects for use in multivariate models. * Added method to convert tsmodel.distribution and tsmodel.distribution_list objects to a long form data table for easier export to databases. +* Added methods for tsconvolve, tscoskew and tscokurt which are used +in the upcoming tsmarch package independent factor conditional density model. # tsmethods 1.0.1 diff --git a/R/convert.R b/R/convert.R old mode 100644 new mode 100755 diff --git a/R/distributions.R b/R/distributions.R old mode 100644 new mode 100755 diff --git a/R/methods.R b/R/methods.R index 24b72a1..c131676 100755 --- a/R/methods.R +++ b/R/methods.R @@ -394,3 +394,61 @@ halflife <- function(object, ...) { UseMethod("halflife") } + +#' Convolution of Distributions +#' +#' @description Generic method for convolution of conditional distribution. +#' @param object an object. +#' @param ... additional parameters passed to the method. +#' @returns The convolved density. +#' @details The method is meant to apply the Fast Fourier Transform +#' to the characteristic function of a distribution. Applications of this can +#' be found in the Independent Factor Conditional Density Models. +#' @aliases tsconvolve +#' @rdname tsconvolve +#' @export +#' +# +tsconvolve <- function(object, ...) +{ + UseMethod("tsconvolve") +} + +#' Co-Skewness +#' +#' @description Generic method for the co-skewness of a model. +#' @param object an object. +#' @param ... additional parameters passed to the method. +#' @returns The co-skewness tensor (folded or unfolded). +#' @details The method calculates the conditional co-skewness of a model. +#' Applications of this can be found in the Independent Factor Conditional +#' Density Models. +#' @aliases tscoskew +#' @rdname tscoskew +#' @export +#' +# +tscoskew <- function(object, ...) +{ + UseMethod("tscoskew") +} + + +#' Co-Kurtosis +#' +#' @description Generic method for the co-kurtosis of a model. +#' @param object an object. +#' @param ... additional parameters passed to the method. +#' @returns The co-kurtosis tensor (folded or unfolded). +#' @details The method calculates the conditional co-kurtosis of a model. +#' Applications of this can be found in the Independent Factor Conditional +#' Density Models. +#' @aliases tscokurt +#' @rdname tscokurt +#' @export +#' +# +tscokurt <- function(object, ...) +{ + UseMethod("tscokurt") +} \ No newline at end of file diff --git a/R/multivariate.R b/R/multivariate.R old mode 100644 new mode 100755 diff --git a/R/tsmethods-package.R b/R/tsmethods-package.R old mode 100644 new mode 100755 diff --git a/README.Rmd b/README.Rmd old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index b0be094..5845150 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![R-CMD-check](https://github.com/tsmodels/tsmethods/workflows/R-CMD-check/badge.svg)](https://github.com/tsmodels/tsmethods/actions) -[![Last-changedate](https://img.shields.io/badge/last%20change-2024--04--27-yellowgreen.svg)](/commits/master) +[![Last-changedate](https://img.shields.io/badge/last%20change-2024--08--23-yellowgreen.svg)](/commits/master) [![packageversion](https://img.shields.io/badge/Package%20version-1.0.2-orange.svg?style=flat-square)](commits/master) [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/tsmethods)](https://cran.r-project.org/package=tsmethods) diff --git a/man/distribution_list.Rd b/man/distribution_list.Rd old mode 100644 new mode 100755 diff --git a/man/ensemble_modelspec.Rd b/man/ensemble_modelspec.Rd old mode 100644 new mode 100755 diff --git a/man/estimate.Rd b/man/estimate.Rd old mode 100644 new mode 100755 diff --git a/man/estimate_ad.Rd b/man/estimate_ad.Rd old mode 100644 new mode 100755 diff --git a/man/halflife.Rd b/man/halflife.Rd old mode 100644 new mode 100755 diff --git a/man/pit.Rd b/man/pit.Rd old mode 100644 new mode 100755 diff --git a/man/plot.Rd b/man/plot.Rd old mode 100644 new mode 100755 diff --git a/man/tsaggregate.Rd b/man/tsaggregate.Rd old mode 100644 new mode 100755 diff --git a/man/tsbacktest.Rd b/man/tsbacktest.Rd old mode 100644 new mode 100755 diff --git a/man/tsbenchmark.Rd b/man/tsbenchmark.Rd old mode 100644 new mode 100755 diff --git a/man/tscalibrate.Rd b/man/tscalibrate.Rd old mode 100644 new mode 100755 diff --git a/man/tscokurt.Rd b/man/tscokurt.Rd new file mode 100644 index 0000000..943e024 --- /dev/null +++ b/man/tscokurt.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods.R +\name{tscokurt} +\alias{tscokurt} +\title{Co-Kurtosis} +\usage{ +tscokurt(object, ...) +} +\arguments{ +\item{object}{an object.} + +\item{...}{additional parameters passed to the method.} +} +\value{ +The co-kurtosis tensor (folded or unfolded). +} +\description{ +Generic method for the co-kurtosis of a model. +} +\details{ +The method calculates the conditional co-kurtosis of a model. +Applications of this can be found in the Independent Factor Conditional +Density Models. +} diff --git a/man/tsconvert.Rd b/man/tsconvert.Rd old mode 100644 new mode 100755 diff --git a/man/tsconvert.tsmodel.distribution.Rd b/man/tsconvert.tsmodel.distribution.Rd old mode 100644 new mode 100755 diff --git a/man/tsconvolve.Rd b/man/tsconvolve.Rd new file mode 100644 index 0000000..6e7b013 --- /dev/null +++ b/man/tsconvolve.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods.R +\name{tsconvolve} +\alias{tsconvolve} +\title{Convolution of Distributions} +\usage{ +tsconvolve(object, ...) +} +\arguments{ +\item{object}{an object.} + +\item{...}{additional parameters passed to the method.} +} +\value{ +The convolved density. +} +\description{ +Generic method for convolution of conditional distribution. +} +\details{ +The method is meant to apply the Fast Fourier Transform +to the characteristic function of a distribution. Applications of this can +be found in the Independent Factor Conditional Density Models. +} diff --git a/man/tscor.Rd b/man/tscor.Rd old mode 100644 new mode 100755 diff --git a/man/tscoskew.Rd b/man/tscoskew.Rd new file mode 100644 index 0000000..3df0cd6 --- /dev/null +++ b/man/tscoskew.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/methods.R +\name{tscoskew} +\alias{tscoskew} +\title{Co-Skewness} +\usage{ +tscoskew(object, ...) +} +\arguments{ +\item{object}{an object.} + +\item{...}{additional parameters passed to the method.} +} +\value{ +The co-skewness tensor (folded or unfolded). +} +\description{ +Generic method for the co-skewness of a model. +} +\details{ +The method calculates the conditional co-skewness of a model. +Applications of this can be found in the Independent Factor Conditional +Density Models. +} diff --git a/man/tscov.Rd b/man/tscov.Rd old mode 100644 new mode 100755 diff --git a/man/tsdecompose.Rd b/man/tsdecompose.Rd old mode 100644 new mode 100755 diff --git a/man/tsdiagnose.Rd b/man/tsdiagnose.Rd old mode 100644 new mode 100755 diff --git a/man/tsensemble.Rd b/man/tsensemble.Rd old mode 100644 new mode 100755 diff --git a/man/tsequation.Rd b/man/tsequation.Rd old mode 100644 new mode 100755 diff --git a/man/tsfilter.Rd b/man/tsfilter.Rd old mode 100644 new mode 100755 diff --git a/man/tsgrowth.Rd b/man/tsgrowth.Rd old mode 100644 new mode 100755 diff --git a/man/tsmethods-package.Rd b/man/tsmethods-package.Rd old mode 100644 new mode 100755 diff --git a/man/tsmetrics.Rd b/man/tsmetrics.Rd old mode 100644 new mode 100755 diff --git a/man/tsmoments.Rd b/man/tsmoments.Rd old mode 100644 new mode 100755 diff --git a/man/tsprofile.Rd b/man/tsprofile.Rd old mode 100644 new mode 100755 diff --git a/man/tsreport.Rd b/man/tsreport.Rd old mode 100644 new mode 100755 diff --git a/man/tsspec.Rd b/man/tsspec.Rd old mode 100644 new mode 100755 diff --git a/man/unconditional.Rd b/man/unconditional.Rd old mode 100644 new mode 100755 diff --git a/tests/testthat.R b/tests/testthat.R old mode 100644 new mode 100755 diff --git a/tests/testthat/test-ensemble.R b/tests/testthat/test-ensemble.R old mode 100644 new mode 100755