defineSeasons: Define seasonality of time-series

Description Usage Arguments Details Value Author(s) Examples

View source: R/FourSeasons.R

Description

Function that helps to define the seasonality (periodicity) of the time-series.

Usage

1
defineSeasons(tm, y, frequency = "daily", plot = TRUE)

Arguments

tm

the time (date; as a POSIXlt or POSIXct class object) of the observation

y

the observations

frequency

the frequency of the observations; so far either 'daily', 'weekly' or 'monthly'.

plot

logical, if TRUE a plot will be produced.

Details

Based on time-series analysis, this function first decomposes the data into the following components; seasonal, trend and remainder. Next, the periodicity of the time-series will be defined by using a cosine function fitted to the seasonal component (using least-square). The minima of the cosine curve can then be used to separate the periods (nessesary in other functions of the DOSeasons package).

Value

A data frame with 7 variables:

date

teh date of the time-series observations

y

the data

period

the number of the period

seasonal

the seasonal component

trend

the trend component

remainder

the remainder component

cos.fit

the best fit of the cosine function

Author(s)

Simeon Lisovski

Examples

1
2
data(tempYNP)
sTab <- defineSeasons(tempYNP$Date, tempYNP$Tmin, frequency = "daily")

slisovski/FourSeasons documentation built on July 30, 2019, 11:08 p.m.