timeTransME: Transformation of Time to Match Two Time Series In qualV: Qualitative Validation Methods

Description

Transforming the time of predicted values by means of a monotonic mapping.

Usage

 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)))

Arguments

 x a result from a call to timeTransME object a result from a call to timeTransME 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 "raw", "centered", "scaled" or "ordered" as defined in generalME to specify the aspects of the data to be ignored. geometry one of "real", "logarithmic", "geometric", "ordinal" as defined in generalME to specify the geometry of the observed data. measure one of "mad", "sd", "var" to specify the type of error to be measured. type one of "dissimilarity", "normalized", "similarity" or "reference" as defined in generalME to specify the type of deviance measure to be used. 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 transBezier for possible alternatives. p0 the identity parameters for the time-transformation. A non identity value can be given to force specific parameters for the transformation with time = "fixed". 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 timeTransME minimizes a weighted sum of the deformation of the time scale and of the data values according to totalME = minimum of ME(o(x), p(trans(x, timep)), MEtype) + timeMEFactor * timeME(x * timeScale, trans(x, timep) * timeScale, timeMEtype) over p for x = c(ot, trans(pt, timep, inv = TRUE)). timeME specifies the function to be used to quantify the temporal deformation. timeMEtype the type of deviance measure (“dissimilarity” or “normalized”) to be used for timeME. 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 timeME is applied. This can be used to change the units of measurement for the time. ME the deviance function to be used for the data. See MSE for alternatives. 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 plot col.obs color to plot the observations col.pred color to plot the predictions col.map color to plot the mapped predictions sub the sub-headline of the plot xlab the label of the x-axis of the plot xlim the size of the plot in x-direction ylim the size of the plot in y-direction y y unused digits number of significant digits displayed

Details

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

plot.timeTransME

shows a picture visualising the fit of the transformed dataset. This can be used as a diagnostic.

Value

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 x. yp the interpolated values of the time transformed predictions at times x. timeME the deviance of the time transformation: timeME(x, trans(x, ME), timeMEtype)). timeMEref the reference value of timeME timeMEFactor the factor to be used for timeME in the weighting with respect to ME. 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.

Note

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.