Performs a diurnal adjustment of the durations, i.e. removes a daily seasonal component. Four different methods of diurnal adjustment are available, namely "cubicSpline", "supsmu" (Friedman's SuperSmoother), "smoothSpline" (smoothed version of the cubic spline), or "FFF" (Flexible Fourier Form).
a data.frame containing the columns durations, containing durations, and time, containing the time stamps.
method
the method used. One of "cubicSpline", "supsmu", "smoothSpline", or "FFF".
nodes
only for method = "cubicSpline" or method = "smoothSpline". A vector of nodes to use for the spline function, in the unit minutes after midnight. The first and last element of the vector must be the start and end of the trading day. The nodes given are actually the limits of intervalls, of wich the midpoints will be set as the nodes using the means of the intervals.
aggregation
what type of aggregation to use. Either "weekdays", "all", or "none". If for example "weekdays" is chosen, all Mondays will have the same daily seasonal component, and so on.
span
argument passed to supsmu if method = "supsmu" were chosen. Affects the smoothness of the curve, see supsmu.
spar
argument passed to smooth.spline if method = "smooth.spline" were chosen. Affects the smoothness of the curve, see smooth.spline.
Q
number of trigonometric function pairs for method = "FFF".
returnSplineFnc
if TRUE instead or returning the adjusted durations a list of spline objects will be returned, containing the coefficents of the spline function. Only available for method = "cubicSpline".
Value
if returnSplineFnc = FALSE (default)
the input data.frame 'dur' with an added column of the diurnally adjusted durations called 'adjDur'.
if returnSplineFnc = TRUE
a list of spline objects containing the coefficents of the spline function.
Author(s)
Markus Belfrage
Examples
diurnalAdj(durData, aggregation = "none", method = "supsmu")
## Not run:
head(durData)
f <- diurnalAdj(durData, aggregation = "weekdays", method = "FFF", Q = 3)
head(f)
f <- diurnalAdj(durData, aggregation = "all", returnSplineFnc = TRUE)
f
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ACDm)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ACDm/diurnalAdj.Rd_%03d_medium.png", width=480, height=480)
> ### Name: diurnalAdj
> ### Title: Dirunal adjustment for durations
> ### Aliases: diurnalAdj
>
> ### ** Examples
>
> diurnalAdj(durData, aggregation = "none", method = "supsmu")
>
> ## Not run:
> ##D
> ##D head(durData)
> ##D f <- diurnalAdj(durData, aggregation = "weekdays", method = "FFF", Q = 3)
> ##D head(f)
> ##D
> ##D f <- diurnalAdj(durData, aggregation = "all", returnSplineFnc = TRUE)
> ##D f
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>