Designs For Time Series Regression
tsDesign.RdCreate designs for time series regression (linear regression or quantile regression) for meteorological time series.
Usage
tsDesign(
dt,
type = c("polynom", "trigo", "sinwave"),
df = 3,
period = "year",
phi = NULL,
keepTrig = FALSE,
origin = NULL
)Arguments
- dt
A
POSIXctorDateobject.- type
Type of design.
- df
Number of basis functions, or "degree of freedom".
- period
Not used. Can only be one year and is used only in the trigonometric case.
- phi
Numeric vector of phases used only when
typeis"sinwave".- keepTrig
Logical. Used only when
typeis"sinwave". IfTRUEthe base trigonometric functionssinj1,sinj2, ...,cosj1,cosj2, ... are kept in the result, along with the functionssinjPhi1,sinjPhi2, ...- origin
An origin for the time. Used only in the polynomial case. The same value must be used in fits and predictions.
Details
The choice is for now between polynomial functions that can be used to describe a trend) and trigonometric functions with period one year (365.25 days) that can be used for the seasonality.
"polynom" Can be used to describe a polynomial with degree
<= df - 1. Thedfbasis functions are named"Cst", then:"t1","t2", ..."trigo" The basis contains
df = 2 * K + 1trigonometric functions given in the order of increasing harmonics. These are: the constant function"Cst"and then theKcouples of one cosine function and one sine function, with names"cosj1","sinj1","cosj2","sinj2", ..."sinwave" With
K = df %/% 2, theK + 1basis functions are the constant"Cst", thenKsine wave functions in the order of increasing harmonics with names"sinjPhi1","sinjPhi2", ...