fit_seasonal_trend: Fit Fourier Seasonal Baseline Trend

View source: R/01_seasonal_fit.R

fit_seasonal_trendR Documentation

Fit Fourier Seasonal Baseline Trend

Description

Fits a truncated Fourier series to daily atmospheric temperature observations.

Usage

fit_seasonal_trend(temp, day_of_year)

Arguments

temp

Numeric vector of observed daily average temperatures.

day_of_year

Numeric vector of day-of-year indices (1 to 365/366).

Value

A list containing the fitted OLS model, fitted values, and isolated residuals.

Examples

doy <- rep(1:365, times = 2)
temp <- 15 + 10 * sin(2 * pi * doy / 365) + stats::rnorm(730, sd = 2)
fit <- fit_seasonal_trend(temp, doy)
print(fit$rmse)

weatherMRJD documentation built on Aug. 20, 2026, 5:10 p.m.