flap

Forecast Linear Augmented Projection

https://github.com/finyang/flap

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Forecast Linear Augmented Projection

Basic Info
  • Host: GitHub
  • Owner: FinYang
  • License: gpl-3.0
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 43.9 KB
Statistics
  • Stars: 2
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created over 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# flap


[![CRAN status](https://www.r-pkg.org/badges/version/flap)](https://CRAN.R-project.org/package=flap)
[![R-CMD-check](https://github.com/FinYang/flap/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/FinYang/flap/actions/workflows/R-CMD-check.yaml)
[![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)


The goal of `flap` is to provide the Forecast Linear Augmented Projection method that can reduce forecast error variance by adjusting the forecasts of multivariate time series to be consistent with the forecasts of linear combinations (components) of the series by projecting all forecasts onto the space where the linear constraints are satisfied.

## Installation

You can install the **stable** version from
[CRAN](https://cran.r-project.org/package=flap).

``` r
install.packages("flap")
```

You can install the **development** version from
[Github](https://github.com/FinYang/flap)

``` r
# install.packages("remotes")
remotes::install_github("FinYang/flap")
```

## Example

This is a basic workflow to flap:

```{r example}
## The following pacakges are required to run this example
# install.packages("tidyr")
# install.packages("ggplot2")
# install.packages("forecast")
# install.packages("fpp2")

library(flap)
library(tidyr)
library(ggplot2)

# Obtain the forecast and the residual of the original series
mdl <- apply(fpp2::visnights, 2, forecast::ets)
fc <- vapply(mdl, function(mdl) forecast::forecast(mdl, h=12)$mean, 
             FUN.VALUE = numeric(12))
res <- vapply(mdl, residuals, 
              FUN.VALUE = numeric(nrow(fpp2::visnights)))

# Obtain components and their forecasts and residuals
pca <- stats::prcomp(fpp2::visnights, center = FALSE, scale. = FALSE)
mdl_comp <- apply(pca$x, 2, forecast::ets)
fc_comp <- vapply(mdl_comp, function(mdl) forecast::forecast(mdl, h=12)$mean, 
                  FUN.VALUE = numeric(12))
res_comp <- vapply(mdl_comp, residuals, 
                   FUN.VALUE = numeric(nrow(pca$x)))
Phi <- t(pca$rotation)

# flap!
proj_fc <- flap(fc, fc_comp, Phi, res, res_comp)
proj_fc

# Plot
if(interactive()) {
  proj_fc %>% 
    as.data.frame() %>% 
    pivot_longer(!c(h, p)) %>% 
    ggplot(aes(x = h, y = value, colour = p, group = p)) +
    geom_line() +
    facet_wrap("name", scales = "free_y")
}

```

Owner

  • Name: Fin
  • Login: FinYang
  • Kind: user
  • Location: Melbourne, Australia
  • Company: Monash University

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 219 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: flap

Forecast Linear Augmented Projection

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 219 Last month
Rankings
Dependent packages count: 28.1%
Forks count: 28.3%
Stargazers count: 35.2%
Dependent repos count: 36.1%
Average: 42.5%
Downloads: 85.0%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • corpcor * imports
  • utils * imports
  • forecast * suggests
  • stats * suggests