metaCDW {cardidates}R Documentation

Extract Cardinal Dates of Multiple Time Series at Once Using Fitted Weibull Curves

Description

metaCDW determines the relevant peak of several time series and fits four- resp. six-parametric Weibull curves to these peaks of all series at once and extracts “cardinal dates” from the fitted curves.

Usage

metaCDW(dat, method = "weibull6", xstart = 55, xmin = 0, xmax = 365, 
        minpeak = 0.1, mincut = 0.382,
        quantile = 0.05, symmetric = FALSE, p0 = NULL, linint = -1, 
        findpeak = TRUE, maxit = 2000)
## S3 method for class 'cardiMetacdw'
summary(object, file="", ...)

Arguments

dat

a data.frame containig the columns: sample (description of the timeseries such as year, water body, or any other code (should be numeric or factor), x (the independend variable, e.g. Julian day of the year), y (the dependend variable, e.g. phytoplankton biovolume) and an optional column flag (of type boolean indicating whether a data point should be included in analysis),

method

either "weibull6" or "weibull4",

xstart

offset (day of year) for the "spring" peak; either a single numeric value for all years or a vector of the same length as number of samples,

xmin

left boundary (in day of year) of the integral under the curve,

xmax

right boundary (in day of year) of the integral under the curve,

quantile

two-sided quantile (percentage of integral) which defines beginning and end of the peak,

minpeak

minimum value of the total maximum which is regarded as peak (default value is derived from golden section),

mincut

minimum relative height of a pit compared to the lower of the two neighbouring maxima at which these maxima are regarded as separate peaks.

symmetric

if (TRUE), quantiles are calculated for the whole area under the curve, otherwise for each of the branches separately.

p0

initial parameters for optimization. In case of p0 = NULL a heuristic algorithm to derive initial values is used for fitweibull6,

linint

control parameter to select interpolation behavior. Negative values (default) specify automatic selection heuristic, zero disables interpolation. A positive value is interpreted as mandatory interpolation time step.

maxit

maximum number of iterations passed to the optimisation functions,

findpeak

a logical value indicating whether the relevant peaks of the time series should be identified automatically with peakwindow before the computation proceeds,

object

a result from a call to metaCDW,

file

file name where the data are to be written to, defaults to screen,

...

other parameters of summary passed to write.

Details

This is a top-level function which calls peakwindow, fitweibull and CDW for a series of data sets and returns a table (data frame) of all results.

Value

A list with components:

metares

data frame with cardinal dates and fitted parameters, see CDW for details,

weibullfits

list of fit details for all fits, see fitweibull for details.

See Also

weibull4, weibull6, fitweibull, peakwindow, CDW, cardidates

Examples


## open test data set (3 years) with 4 columns
## sample, x, y, flag
data(carditest)
dat <- carditest

## alternatively: import data from spreadsheet via the clipboard
# dat <- read.table("clipboard", sep = "\t", header = TRUE)

## or, for languages with comma as decimal separator:
# dat <- read.table("clipboard", sep = "\t", header = TRUE, dec = ",")

## Note: as.numeric recodes factor year to numeric value
plot(as.numeric(dat$sample)*365 + dat$x, dat$y, type = "b")

## do the analysis
tt <- metaCDW(dat, xstart = 55)

## plot results
par(mfrow=c(1, 3))
lapply(tt$weibullfits, plot)

## return table of results
summary(tt)

## Not run: 
## copy to clipboard in spreadsheet compatible format
summary(tt, file = "clipboard", sep = "\t", quote = FALSE, row.names = FALSE)

## or, for languages with comma as decimal separator:
#summary(tt, file = "clipboard", sep = "\t", dec = ",",
#  quote = FALSE, row.names = FALSE)

## End(Not run)

[Package cardidates version 0.4.9 Index]