Skip to content

Commit

Permalink
CRAN build for 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisp committed Oct 10, 2016
1 parent 1c00ce8 commit 98cf464
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 14 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,32 @@ into a usual ggplot() command, substituting for where you'd normally have geom_l

```r
library(ggseas)
```

```
## Loading required package: seasonal
```

```
## Loading required package: ggplot2
```

```
## Loading required package: zoo
```

```
##
## Attaching package: 'zoo'
```

```
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
```

```r
# make demo data with the convenience "time series to data.frame" function tsdf()
ap_df <- tsdf(AirPassengers)

Expand Down
2 changes: 1 addition & 1 deletion pkg/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: ggseas
Title: 'stats' for Seasonal Adjustment on the Fly with 'ggplot2'
Version: 0.4.4.9000
Version: 0.5.0
Authors@R: c(
person("Peter", "Ellis", , "peter.ellis2013nz@gmail.com", c("aut", "cre")),
person("Christophe", "Sax", role = "ctb")
Expand Down
6 changes: 3 additions & 3 deletions pkg/vignettes/ggsdc.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ opts_chunk$set(comment=NA, fig.width=7.2)
The `ggsdc` R package aims to help exploratory analysis of time series by making it easy to do seasonal adjustment and decomposition on the fly in the `ggplot2` universe. It provides two main sets of functionality:

* a collection of `ggplot2` `stats` oriented to time-series, allowing indexing, rolling averages and seasonal decomposition to be added as straight-forward statistical transforms with familiar `geoms` like `geom_line` and `geom_point`.
* the `ggsdc()` function which provides decomposition similar to that from `decompose`, `stl` or the X13-SEATS-ARIMA world via the `seasonal` package, except in `ggplot2` terms so you can use familiar styles, titles, control your `geoms` and `scales`, etc. - and have multiple time series decomposed on a single graphic.
* the `ggsdc()` function which provides decomposition similar to that from `decompose`, `stl` or the X13-SEATS-ARIMA world via the `seasonal` package, except in `ggplot2` terms so you can use familiar themes, titles, control your `geoms` and `scales`, etc. - and have multiple time series decomposed on a single graphic.

## Using stats for simple time series graphic composition

Expand Down Expand Up @@ -74,7 +74,7 @@ ggplot(ap_df, aes(x = x, y = y)) +
labs(x = "", y = "Number of US Air Passengers\n(rolling average and original)")
```

It's not very likely you'll want anything but a line for a graphic like this, but in case you do, you can over-write the default geom. And of course all the usual ggplot2 polishing facilities are available:
It's not very likely you'll want anything but a line for a graphic like this, but in case you do, you can over-write the default geom. And of course all the usual `ggplot2` polishing facilities are available:
```{r}
ggplot(ap_df, aes(x = x, y = y)) +
geom_line(colour = "grey75") +
Expand All @@ -85,7 +85,7 @@ ggplot(ap_df, aes(x = x, y = y)) +

### Seasonal adjustment

Three stats will do seasonal adjustment for you, but I recommend only two of them: `stat_stl()` and `stat_seas()`. In fact, if `stat_seas works` it will generally be better. Amongst other things it does automatic detection of outliers and level shifts, best transformation to make, and adjustments for Easter and number of trading days. It's driven by Christopher Sax's `seasonal` R package, which is the best interface on the planet to the `X13-SEATS-ARIMA` time series analysis application from the US Census Department, which is the industry standard particularly for official statistics agencies doing seasonal adjustment.
Three stats will do seasonal adjustment for you, but I recommend only two of them: `stat_stl()` and `stat_seas()`. In fact, if `stat_seas works` it will generally be better. Amongst other things it does automatic detection of outliers and level shifts, best transformation to make, and adjustments for Easter and number of trading days. It's driven by Christopher Sax's [`seasonal` R package](https://CRAN.R-project.org/package=seasonal), which is the best interface on the planet to the [`X13-SEATS-ARIMA` time series analysis application from the US Census Department](https://www.census.gov/srd/www/x13as/), which is the industry standard particularly for official statistics agencies doing seasonal adjustment.

X13 (via `stat_seas`) has limitations, such as a maximum number of observations, and only working with socio-economic style data (eg things measured in months, quarters and year rather than in milliseconds or eons). For these cases, `stat_stl()` provides a robust workhorse, a wrapper around `stl()` that ships with R in the `stats` package and implements the Clevelands' seasonal-trend decomposition procedure based on a loess scatterplot smoother.

Expand Down
Loading

0 comments on commit 98cf464

Please sign in to comment.