CDW | R Documentation |
CDW (cardinal dates using Weibull curves) extracts “cardinal dates” from fitted four- and six-parametric Weibull curves.
CDW(p, xmin = 0, xmax = 365, quantile = 0.05, symmetric = FALSE)
CDWa(p, xmin = 0, xmax = 365, quantile = 0.05, symmetric = FALSE)
p |
object of class |
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, |
symmetric |
if ( |
CDW
is a numerically improved version of the algorithm
described in Rolinski et al. (2007). Version CDWa
is an alternative,
simplified version which sets the baseline before and after the peak to zero
using appropriate offset parameters p[1]
and p[4]
.
The original method described by Rolinski et al. 2007 (here called CDW
)
shifts the function for the left and right branch separately
in the asymmetric case.
A list with components:
x |
x values of cardinal dates |
y |
the corresponding y values (divided by ymax), |
p |
parameters of the fitted Weibull function |
weibull4
,
weibull6
,
fitweibull
,
peakwindow
,
metaCDW
,
cardidates
## create some test data
set.seed(123)
x <- seq(0, 360, length = 20)
y <- abs(rnorm(20, mean = 1, sd = 0.1))
y[5:10] <- c(2, 4, 7, 3, 4, 2)
## fit Weibull function with 6 free parameters
res <- fitweibull6(x, y)
## show some properties
res$r2
p <- res$p
o <- res$fit
f <- res$ymax
## identify cardinal dates from fitted curves
(smd <- CDW(p))
(smda <- CDW(p, symmetric = FALSE))
## plot data, curve and cardinal dates
plot(x, y, ylim=c(0, 10), xlim = c(0, 365))
lines(o$x, o$f * f)
points(x, fweibull6(x, p) * f, col = "green")
points(smd$x, fweibull6(smd$x, p) * f, col = "orange", pch = 16)
points(smda$x, fweibull6(smda$x, p) * f, col = "red", pch = 1, cex = 1.2)
## for comparison: additional fit of a 4 parameter Weibull
res4 <- fitweibull4(x, y)
res4$r2
p <- res4$p
o <- res4$fit
f <- res4$ymax
smd <- CDW(p)
lines(o$x, o$f * f, col = "blue")
points(smd$x, fweibull4(smd$x, p) * f, col = "blue", pch = 16)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.