Skip to content

Commit

Permalink
tweak seasonal extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcarslaw committed Jul 11, 2023
1 parent fd6b0aa commit 2415c53
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

- new function `runRegression()` for extracting 'dilution lines' from air quality and other data. Online manual will be updated with principles and examples.

- Tweak seasonal trend decomposition using STL to allow the seasonal amplitude to vary more. Affects `smoothTrend` and `TheilSen`.

## Bug Fixes

- The order of columns in `importUKAQ()` will remain consistent (metadata, date, pollutants, meteo) regardless of whether `hc` is `TRUE` or `FALSE`.
Expand Down
2 changes: 1 addition & 1 deletion R/TheilSen.R
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ TheilSen <- function(mydata, pollutant = "nox", deseason = FALSE,
## s.window should not be "periodic"; set quite high to avoid
## overly fitted seasonal cycle
## robustness also makes sense for sometimes noisy data
ssd <- stl(myts, s.window = 35, robust = TRUE, s.degree = 0)
ssd <- stl(myts, s.window = 11, robust = TRUE, s.degree = 1)

deseas <- ssd$time.series[, "trend"] + ssd$time.series[, "remainder"]

Expand Down
2 changes: 1 addition & 1 deletion R/smoothTrend.R
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ smoothTrend <- function(mydata, pollutant = "nox", deseason = FALSE,

}

ssd <- stl(myts, s.window = 35, robust = TRUE, s.degree = 0)
ssd <- stl(myts, s.window = 11, robust = TRUE, s.degree = 1)

deseas <- ssd$time.series[, "trend"] + ssd$time.series[, "remainder"]
deseas <- as.vector(deseas)
Expand Down

0 comments on commit 2415c53

Please sign in to comment.