Description Usage Arguments Details Value Note See Also Examples
Transforming the time of predicted values by means of a monotonic mapping.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  timeTransME(o, p,
o.t = seq(0, 1, length.out = length(o)),
p.t = seq(0, 1, length.out = length(p)),
ignore = "scaled",
geometry = "real",
measure = "mad",
type = c("dissimilarity", "normalized",
"similarity", "reference"),
interval = range(c(o.t, p.t)),
time = c("transformed", "fixed"),
trans = transBeta,
p0 = eval(formals(trans)$p0),
pmin = eval(formals(trans)$pmin, list(p = p0)),
pmax = eval(formals(trans)$pmax, list(p = p0)),
timeMEFactor = 0,
timeME = MAE,
timeMEtype = "normalized",
timeScale = 1,
ME = generalME(o, p, ignore, geometry, measure,
type = "function"),
MEtype = c("dissimilarity", "normalized"),
trials = 100,
debug = FALSE)
## S3 method for class 'timeTransME'
print(x, ..., digits = 3)
## S3 method for class 'timeTransME'
summary(object, ...)
## S3 method for class 'timeTransME'
plot(x, y = NULL, ..., col.obs = "black", col.pred = "green",
col.map = "red", sub = x$call, xlab = "t",
xlim = range(x$x), ylim = range(c(0, x$yo, x$yp)))

x 
a result from a call to 
object 
a result from a call to 
o 
vector of observed values 
p 
vector of predicted values 
o.t 
vector of observation times 
p.t 
vector of times for predicted values 
ignore 
one of 
geometry 
one of 
measure 
one of 
type 
one of

interval 
a vector with two entries giving start and end time of the experiment. 
time 
indicates wether the time should actually be transformed. LCS is currently not implemented. Use the LCS method directly. 
trans 
the model function for the time transformation. See

p0 
the identity parameters for the timetransformation. A non
identity value can be given to force specific parameters for the
transformation with 
pmin 
number or vector providing the minimal allowed values for the parameters of the transformation. 
pmax 
number or vector providing the minimal allowed values for the parameters of the transformation. 
timeME 
The ME(o(x), p(trans(x, timep)), MEtype) + timeMEFactor * timeME(x * timeScale, trans(x, timep) * timeScale, timeMEtype) over 
timeMEtype 
the type of deviance measure (“dissimilarity” or
“normalized”) to be used for 
timeMEFactor 
a real value specifying the weighting of the time deformation against the value deformation. A value of 0 avoids penalty for time deformation. 
timeScale 
a scaling applied to the time values before

ME 
the deviance function to be used for the data. See 
MEtype 
the type of Mean Error to be used in the calculations. This is not the type of Measure to be reported. 
trials 
The number of random starting values that should be used during the optimization of the time transformation. The optimization of the time transformation is a very critical task of this procedure and it had been shown by practical tests that a single local optimization typically fails to find the globally best fit. Depending on the number of parameters a value between 100 and 10000 seems reasonable for this parameter. 
debug 
a logical. If true some diagnostic information for the optimization step is printed. 
... 
further parameters to be passed to

col.obs 
color to plot the observations 
col.pred 
color to plot the predictions 
col.map 
color to plot the mapped predictions 
sub 
the subheadline of the plot 
xlab 
the label of the xaxis of the plot 
xlim 
the size of the plot in xdirection 
ylim 
the size of the plot in ydirection 
y 
y unused 
digits 
number of significant digits displayed 
Common quantitative deviance measures underestimate the
similarity of patterns if there are shifts in time between measurement
and simulation. An alternative to measure model performance
independent of shifts in time is to transform the time of the
simulation, i.e. to run the time faster or slower, and to compare the
performance before and after the transformation. The applied
transformation function must be monotonic. timeTransME
minimizes the joint criterium
ME(o(x), p(trans(x, timep)), MEtype) +
timeMEFactor * timeME(x * timeScale, trans(x, timep) * timeScale, timeMEtype)
to find a best fitting time transformation.
print.timeTransME
prints only the requested value, without additional information.
summary.timeTransME
prints all the additional information.
plot.timeTransME
shows a picture visualising the fit of the transformed dataset. This can be used as a diagnostic.
The result is an object of type timeTransME
with the following entries:
totalME 
the requested measure with specified type, 
criterium 
the "dissimilarity" measure, which was calculated as a minimum of ME(o(x), p(trans(x, timep)), MEtype) + timeMEFactor * timeME(x * timeScale, trans(x, timep) * timeScale, timeMEtype) . 
reference 
the reference value of this criterium achieved without time deformation and full dissimilarity. 
call 
the call used to generate this deviance. 
x 
the times at which the series were compared from the perspective of the observations. 
xp 
the transformed times at which the series were compared from the perspective of the prediction. 
yo 
the interpolated values of the observations at times 
yp 
the interpolated values of the time transformed predictions
at times 
timeME 
the deviance of the time transformation:

timeMEref 
the reference value of timeME 
timeMEFactor 
the factor to be used for timeME in the weighting
with respect to 
timeScale 
the scaling to time to account for an other unit. 
p 
the parameter of trans minimizing the criterium. 
interval 
the interval of time under consideration 
trans 
the transformation function used for the time. 
optim 
contains informations about the convergence of the optimization procedure and a list of secondary minima found. This additional list element occurs only if there is actually a minimisation performed. 
The deviance calculated by timeTransME(..., time = "fixed")
and the
corresponding deviance measure are different because the timeTransME
does an interpolation and compares time sequences at different spacing,
while a simple deviance measure compares values only.
The CPU usage of the calculation of the
minimum, when trans = "transform"
is very high, because the
optimization is done a hundred times with random starting values for
the parameters. This is necessary since with the given objective the
general purpose optimizers often run into local minima and/or do not
converge. The number of iterations can be controlled with the
parameter trials
. Setting debug = TRUE
gives an impression
how long it takes to find an improved optimum.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68  set.seed(123)
## a constructed example
x < seq(0, 2*pi, length=10)
o < 5 + sin(x) + rnorm(x, sd=0.2) # observation with random error
p < 5 + sin(x1) # simulation with time shift
# timeTransME(o, p) # reasonably accurate but takes very long!
# timeTransME(o, p, trials=5, debug=TRUE)
ttbeta < timeTransME(o, p, trials=5)
plot(ttbeta)
## Not run:
ttsimplex < timeTransME(o, p, trans = transSimplex, trials=5)
plot(ttsimplex)
ttbezier < timeTransME(o, p, trans = transBezier, trials=5)
plot(ttbezier)
## End(Not run)
## observed and measured data with nonmatching time intervals
data(phyto)
bbobs < dpill(obs$t, obs$y)
n < diff(range(obs$t)) + 1
obss < ksmooth(obs$t, obs$y, kernel = "normal", bandwidth = bbobs,
n.points = n)
names(obss) < c("t", "y")
obss < as.data.frame(obss)[match(sim$t, obss$t), ]
tt < timeTransME(obss$y, sim$y, obss$t, sim$t, ME = SMSE,
timeMEFactor = 0, time = "transform", type = "n", trials = 5)
round(tt$totalME, digits = 3)
basedate < as.Date("1960/1/1")
plot(basedate + sim$t, sim$y, type="l", ylim = c(min(obs$y, sim$y),
max(obs$y, sim$y)), xlab = "time", ylab = "Phytoplankton (mg/L)",
col = 2, font = 2, lwd = 2, cex.lab = 1.2, las = 1)
lines(basedate + obss$t, obss$y, lwd = 2)
points(basedate + obs$t, obs$y, lwd = 2)
lines(basedate + tt$x, tt$yp, lwd = 2, col = 2, lty = 2)
legend(basedate + 12600, 50, c("measurement", "smoothed measurement",
"simulation", "transformed simulation"), lty = c(0, 1, 1, 2),
pch = c(1, NA, NA, NA), lwd = 2, col = c(1, 1, 2, 2))
tt1 < timeTransME(obs$y, sim$y, obs$t, sim$t, ME = SMSLE, type = "n",
time = "fixed")
tt1
plot(tt1)
summary(tt1)
## Not run:
tt2 < timeTransME(obss$y, sim$y, obss$t, sim$t, ME = SMSLE, type = "n",
time = "trans", debug = TRUE)
tt2
plot(tt2) # logarithm (SMSLE) is not appropriate for the example
summary(tt2)
tt3 < timeTransME(obss$y, sim$y, obss$t, sim$t, ME = SMSE, type = "n",
time = "trans", trans = transBezier, debug = TRUE)
tt3
plot(tt3)
summary(tt3)
tt4 < timeTransME(obss$y, sim$y, obss$t, sim$t, ME = MSOE, type = "n",
time = "trans", trans = transBezier, debug = TRUE)
tt4
plot(tt4)
summary(tt4)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.