metaCDW | R Documentation |
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.
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="", ...)
dat |
a |
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 ( |
p0 |
initial parameters for optimization. In case of |
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 |
object |
a result from a call to |
file |
file name where the data are to be written to, defaults to screen, |
... |
other parameters of |
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.
A list with components:
metares |
data frame with cardinal dates and fitted parameters,
see |
weibullfits |
list of fit details for all fits,
see |
weibull4
,
weibull6
,
fitweibull
,
peakwindow
,
CDW
,
cardidates
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.