Science Score: 36.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
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
1 of 3 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.7%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
seasonal adjustment on the fly extension for ggplot2
Basic Info
- Host: GitHub
- Owner: ellisp
- License: gpl-3.0
- Language: R
- Default Branch: master
- Size: 1.36 MB
Statistics
- Stars: 75
- Watchers: 7
- Forks: 5
- Open Issues: 4
- Releases: 2
Created over 10 years ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
License
README.Rmd
# ggseas R package
seasonal adjustment on the fly extension for ggplot2
Convenience functions that let you easily do seasonal adjustment on the fly with ggplot.
Depends on the [`seasonal` package](https://cran.r-project.org/web/packages/seasonal/index.html) to give you access to X13-SEATS-ARIMA.
[](https://travis-ci.org/ellisp/ggseas)
[](http://www.r-pkg.org/pkg/ggseas)
[](http://www.r-pkg.org/pkg/ggseas)
## Installation
Install the stable version the usual way from CRAN:
```{r, eval = FALSE}
install.packages("ggseas")
```
or the latest version (bugs and all) from GitHub:
```{r, eval = FALSE}
devtools::install_github("ellisp/ggseas/pkg")
```
## Usage - seasonal adjustment on the fly
So far there are three types of seasonal adjustment possible to be incorporated
into a usual ggplot() command, substituting for where you'd normally have geom_line().
### X13-SEATS-ARIMA
```{r}
library(ggseas)
# make demo data with the convenience "time series to data.frame" function tsdf()
ap_df <- tsdf(AirPassengers)
# SEATS with defaults
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey80") +
stat_seas() +
ggtitle("SEATS seasonal adjustment - international airline passengers") +
ylab("International airline passengers per month")
# X11 with no outlier treatment
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey80") +
stat_seas(x13_params = list(x11 = "", outlier = NULL)) +
ggtitle("X11 seasonal adjustment - international airline passengers") +
ylab("International airline passengers per month")
ggplot(ldeaths_df, aes(x = YearMon, y = deaths, colour = sex)) +
geom_point(colour = "grey50") +
geom_line(colour = "grey50") +
facet_wrap(~sex) +
stat_seas(size = 2) +
ggtitle("Seasonally adjusted lung deaths in the UK 1974 - 1979") +
ylab("Deaths") +
xlab("(light grey shows original data;\ncoloured line is seasonally adjusted)") +
theme(legend.position = "none")
```
### STL (LOESS-based decomposition)
```{r}
# periodic if fixed seasonality; doesn't work well:
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey80") +
stat_stl(s.window = "periodic")
# seasonality varies a bit over time, works better:
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey80") +
stat_stl(s.window = 7)
```
### Classical decomposition
```{r}
# default additive decomposition (doesn't work well in this case!):
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey80") +
stat_decomp()
# multiplicative decomposition, more appropriate:
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey80") +
stat_decomp(type = "multiplicative")
```
## Usage - seasonal decomposition on the fly
From version 0.2.0 I introduce a summary graphic decomposition, similar to what
you'd get with plot(stats::decompose(x)), but in the ggplot2 environment. As well
as allowing ggplot2 look and feel of plots, you can also map a variable to the
colour (or color) aesthetic, to allow two difference decompositions on the same
graphic.
```{r}
ggsdc(ap_df, aes(x = x, y = y), method = "decompose") +
geom_line()
ggsdc(ap_df, aes(x = x, y = y), method = "stl", s.window = 7) +
labs(x = "", y = "Air passenger numbers") +
geom_point()
ggsdc(ldeaths_df, aes(x = YearMon, y = deaths, colour = sex), method = "seas") +
geom_line()
library(scales) # for label= comma
serv <- subset(nzbop, Account == "Current account" &
Category %in% c("Services; Exports total", "Services; Imports total"))
ggsdc(serv, aes(x = TimePeriod, y = Value, colour = Category),
method = "seas", start = c(1971, 2), frequency = 4) +
geom_line() +
scale_y_continuous("NZ$ millions\ndecomposition by X13-SEATS-ARIMA", label = comma) +
labs(x = "") +
ggtitle("New Zealand services balance of payments -\ngreater seasonality in exports than imports") +
theme_light()
```
Coming in 0.5.0 - control facet titles during seasonal decomposition on the fly
```{r}
ggsdc(serv, aes(x = TimePeriod, y = Value, colour = Category),
method = "stl", s.window = 7, frequency = 4,
facet.titles = c("The original series", "The underlying trend", "Regular seasonal patterns", "All the randomness left")) +
geom_line()
```
Owner
- Name: Peter Ellis
- Login: ellisp
- Kind: user
- Location: Nouméa, Nouvelle-Calédonie
- Company: Pacific Community | Communauté de Pacifique
- Website: http://freerangestats.info
- Twitter: ellis2013nz
- Repositories: 66
- Profile: https://github.com/ellisp
Director of the Statistics for Development Division at SPC. Statistician, data scientist, senior manager, consultant. Most of my stuff on GitHub is in R.
GitHub Events
Total
- Issues event: 1
- Watch event: 1
- Push event: 4
Last Year
- Issues event: 1
- Watch event: 1
- Push event: 4
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| ellisp | p****z@g****m | 89 |
| Peter Ellis | p****s@m****z | 6 |
| Christoph | c****h@i****l | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 24
- Total pull requests: 1
- Average time to close issues: 2 months
- Average time to close pull requests: 4 days
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 1.04
- Average comments per pull request: 1.0
- Merged pull requests: 1
- 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
- ellisp (18)
- Rmadillo (1)
- teunbrand (1)
- paulhendricks (1)
- sillasgonzaga (1)
Pull Request Authors
- christophsax (1)
Top Labels
Issue Labels
bug (5)
enhancement (5)
duplicate (1)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 491 last-month
- Total docker downloads: 76
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 1
(may contain duplicates) - Total versions: 9
- Total maintainers: 1
proxy.golang.org: github.com/ellisp/ggseas
- Documentation: https://pkg.go.dev/github.com/ellisp/ggseas#section-documentation
- License: gpl-3.0
-
Latest release: v0.5.1
published over 9 years ago
Rankings
Dependent packages count: 6.5%
Average: 6.7%
Dependent repos count: 6.9%
Last synced:
11 months ago
cran.r-project.org: ggseas
'stats' for Seasonal Adjustment on the Fly with 'ggplot2'
- Documentation: http://cran.r-project.org/web/packages/ggseas/ggseas.pdf
- License: GPL-3
- Status: removed
-
Latest release: 0.5.4
published about 8 years ago
Rankings
Stargazers count: 5.1%
Forks count: 9.6%
Average: 15.6%
Docker downloads count: 17.5%
Dependent packages count: 18.1%
Downloads: 19.3%
Dependent repos count: 23.9%
Maintainers (1)
Last synced:
12 months ago
Dependencies
pkg/DESCRIPTION
cran
- R >= 3.1.2 depends
- ggplot2 >= 2.0.0 depends
- rlang * imports
- seasonal * imports
- stats * imports
- zoo * imports
- knitr * suggests
- rmarkdown * suggests
- testthat * suggests