Learn R Programming

pastecs (version 1.4.2)

regarea: Regulate a series using the area method

Description

Transform an irregular time series in a regular time series, or fill gaps in regular time series using the area method

Usage

regarea(x, y=NULL, xmin=min(x), n=length(x),
        deltat=(max(x) - min(x))/(n - 1), rule=1,
        window=deltat, interp=FALSE, split=100)

Value

An object of type 'regul' is returned. It has methods print(), summary(), plot(), lines(), identify(), hist(), extract() and specs().

Arguments

x

a vector with time in the irregular series. Missing values are allowed

y

a vector of same length as x and holding observations at corresponding times

xmin

allows to respecify the origin of time in the calculated regular time series. By default, the origin is not redefined and it is equivalent to the smallest value in x

n

the number of observations in the regular time series. By default, it is the same number than in the original irregular time series (i.e., length(x)

deltat

the time interval between two observations in the regulated time series

rule

the rule to use for extrapolated values (outside of the range in the initial irregular time series) in the regular time series. With rule=1 (by default), these entries are not calculated and get NA; with rule=2, these entries are extrapolated

window

size of the window to use for interpolation. By default, adjacent windows are used (window=deltat)

interp

indicates if matching observations in both series must be calculated (interp=TRUE), or if initial observations are used "as is" in the final regular series (interp=FALSE, by default)

split

a parameter to optimise calculation time and to avoid saturation of the memory. Very long time series are splitted into smaller subunits. This is transparent for the user. The default value of split=100 should be rarely changed. Give a lower value if the program fails and reports a memory problem during calculation

Author

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

Details

This is a linear interpolation method described by Fox (1972). It takes into account all observations located in a given time window around the missing observation. On the contrary to many other interpolations (constant, linear, spline), the interpolated curve does not pass by the initial observations. Indeed, a smoothing is also operated simultaneously by this method. The importance of the smoothing is dependent on the size of the window (the largest it is, the smoothest will be the calculated regular time series)

References

Fox, W.T. & J.A. Brown, 1965. The use of time-trend analysis for environmental interpretation of limestones. J. Geol., 73:510-518.

Ibanez, F., 1991. Treatment of the data deriving from the COST 647 project on coastal benthic ecology: The within-site analysis. In: B. Keegan (ed). Space and Time Series Data Analysis in Coastal Benthic Ecology. Pp 5-43.

Ibanez, F. & J.C. Dauvin, 1988. Long-term changes (1977-1987) on a muddy fine sand Abra alba - Melinna palmata population community from the Western English Channel. J. Mar. Ecol. Prog. Ser., 49:65-81.

See Also

regul, regconst, reglin, regspline, regul.screen, regul.adj, tseries, is.tseries

Examples

Run this code
data(releve)
# The 'Melosul' series is regulated with a 25-days window
reg <- regarea(releve$Day, releve$Melosul, window=25)
# Then with a 50-days window
reg2 <- regarea(releve$Day, releve$Melosul, window=50)
# The initial and both regulated series are shown on the graph for comparison
plot(releve$Day, releve$Melosul, type="l")
lines(reg$x, reg$y, col=2)
lines(reg2$x, reg2$y, col=4)

Run the code above in your browser using DataLab