Learn R Programming

qualV (version 0.3-5)

compareME: Compute Several Deviance Measures for Comparison

Description

Various deviance measures are computed allowing the user to find the aspects in which two time series differ.

Usage

compareME(o, p,
          o.t      = seq(0, 1, length.out = length(o)),
          p.t      = seq(0, 1, length.out = length(p)),
          ignore   = c("raw", "centered", "scaled", "ordered"),
          geometry = c("real", "logarithmic", "geometric", "ordinal"),
          measure  = c("mad", "var", "sd"),
          type     = "normalized",
          time     = "fixed", ..., col.vars=c("time", "ignore")
         )
# S3 method for compareME
print(x, ..., digits = 3)
# S3 method for compareME
summary(object, ...)

Value

The result is a list of ftables containing the deviance measures of all requested combinations of parameters. The list is done over the different types of measures requested.

Arguments

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

a subset of c("raw", "centered", "scaled", "ordered") as defined in generalME to specify the aspects of the data to be ignored,

geometry

a subset of c("real", "logarithmic", "geometric", "ordinal") as defined in generalME to specify the geometry of the observed data,

measure

a subset of c("mad", "var", "sd") to specify the type of error to be measured,

type

a subset of c("dissimilarity", "normalized", "similarity", "reference") as defined in generalME to specify the type of deviance measure to be used,

time

a subset of c("fixed", "transform"), indicates wether the time should actually be transformed. If this argument and the time arguments are missing the comparison is based on values only without time matching.

...

further arguments passed to timeTransME,

col.vars

a subset of c("ignore", "geometry", "measure", "time") to be displayed in the columns of the resulting ftable,

digits

number of significant digits displayed,

x, object

objects of class compareME.

Details

The function provides a simple standard interface to get a first idea on the similarities and dissimilarities of two time series spanning the same time interval. The print and summary methods extract the relevant information, rounded to an optional number of significant digits.

See Also

timeTransME, generalME

Examples

Run this code
# a constructed example
x <- seq(0, 2*pi, 0.1)
y <- 5 + sin(x)             # a process
o <- y + rnorm(x, sd = 0.2) # observation with random error
p <- y + 0.1                # simulation with systematic bias

os <- ksmooth(x, o, kernel = "normal",
  bandwidth = dpill(x, o), x.points = x)$y
plot(x, o); lines(x, p); lines(x, os, col = "red")

compareME(o, p)
compareME(os, p)

# observed and measured data with non-matching time intervals
data(phyto)
compareME(obs$y, sim$y, obs$t, sim$t, time = "fixed")
tt <- timeTransME(obs$y, sim$y, obs$t, sim$t, ME = SMSLE, trials = 5)
compareME(tt$yo, tt$yp)

# show names of deviance measures
compareME(type = "name")

Run the code above in your browser using DataLab