Skip to contents

Applies Seasonal-Trend decomposition using Loess (STL) to a time series. This separates the signal into seasonal, trend, and remainder components.

Usage

decompose_stl(
  data,
  variable = "wave_height",
  time_col = "time",
  frequency = "daily"
)

Arguments

data

Data frame with time and value columns

variable

Name of the variable to decompose (default: "wave_height")

time_col

Name of the time column (default: "time")

frequency

Seasonal frequency (default: "daily" = 24 hours)

Value

List with:

  • decomposition: stl object

  • components: data frame with time, seasonal, trend, remainder

  • summary: summary statistics of each component

Examples

if (FALSE) { # \dontrun{
con <- connect_duckdb()
data <- query_buoy_data(con, stations = "M3")
stl_result <- decompose_stl(data)
DBI::dbDisconnect(con)
} # }