Learn R Programming

pastecs (version 1.4.2)

regul.screen: Test various regulation parameters

Description

Seek for the best combination of the number of observation, the interval between two successive observation and the position of the first observation in the regulated time series to match as much observations of the initial series as possible

Usage

regul.screen(x, weight=NULL, xmin=min(x), frequency=NULL,
    deltat=(max(x, na.rm = TRUE) - min(x, na.rm = TRUE))/(length(x) - 1),
    tol=deltat/5, tol.type="both")

Value

A list containing:

tol

a vector with the adjusted values of tol for the various values of deltat

n

a table indicating the maximum value of n for all combinations of deltat and xmin to avoid any extrapolation

nbr.match

a table indicating the number of matching observations (in the tolerance window) for all combinations of deltat and xmin

nbr.exact.match

a table indicating the number of exactly matching observations (with a tolerance window equal to zero) for all combinations of deltat and xmin

Arguments

x

a vector with times corresponding to the observations in the irregular initial time series

weight

a vector of the same length as x, with the weight to give to each observation. A value of 0 indicates to ignore an observation. A value of 1 gives a normal weight to an observation. A higher value gives more importance to the corresponding observation. You can increase weight of observations around major peaks and pits, to make sure they are not lost in the regulated time series. If weight=NULL (by default), then a weight of 1 is used for all observations

xmin

a vector with all time values for the first observation in the regulated time series to be tested

frequency

a vector with all the frequencies to be screened

deltat

a vector with all time intervals to screen. deltat is the inverse of frequency. Only one of these two arguments is required. If both are provided, frequency supersedes deltat

tol

it is possible to tolerate some differences in the time between two matching observations (in the original irregular series and in the regulated series). If tol=0 both values must be strictly identical; a higher value allows some fuzzy matching. tol must be a round fraction of deltat and cannot be higher than it, otherwise, it is adjusted to the closest acceptable value. By default, tol=deltat/5

tol.type

the type of window to use for the time-tolerance: "left", "right", "both" (by default) or "none". If tol.type="left", corresponding x values are seeked in a window ]xregul-tol, xregul]. If tol.type="right", they are seeked in the window [xregul, xregul+tol[. If tol.type="both", then they are seeked in the window ]xregul-tol, xregul+tol]. If several observations are in this window, the closest one is used. Finally, if tol.type="none", then all observations in the regulated time series are interpolated (even if exactly matching observations exist!)

Author

Philippe Grosjean (phgrosjean@sciviews.org), Frédéric Ibanez (ibanez@obs-vlfr.fr)

Details

Whatever the efficiency of the interpolation procedure used to regulate an irregular time series, a matching, non-interpolated observation is always better than an interpolated one! With very irregular time series, it is often difficult to decide which is the better regular time-scale in order to interpolate as less observations as possible. regul.screen() tests various combinations of number of observation, interval between two observations and position of the first observation and allows to choose the combination that best matches the original irregular time series. To choose also an optimal value for tol, use regul.adj() concurrently.

See Also

regul.adj, regul

Examples

Run this code
data(releve)
# This series is very irregular, and it is difficult
# to choose the best regular time-scale
releve$Day
length(releve$Day)
intervals <- releve$Day[2:61]-releve$Day[1:60]
intervals
range(intervals)
mean(intervals)
# A combination of xmin=1, deltat=22 and n=61 seems correct
# But is it the best one?
regul.screen(releve$Day, xmin=0:11, deltat=16:27, tol=1.05)
# Now we can tell that xmin=9, deltat=21, n=63, with tol=1.05
# is a much better choice! 

Run the code above in your browser using DataLab