seitlDistanceOscillation: ABC distance with oscillations

View source: R/ABC.r

seitlDistanceOscillationR Documentation

ABC distance with oscillations

Description

This positive distance is the mean squared differences between the simulation and the observation, divided by the square of the number of times the simulation oscillates around the observation.

Usage

seitlDistanceOscillation(simuTrajObs, data)

Arguments

simuTrajObs

data.frame of simulated trajectory with observation, as returned by rTrajObs.

data

data.frame of times and observations. Must have two columns: time and Inc.

See Also

distanceOscillation

Examples

## Not run: 
# Suppose we observed a time series:
data <- data.frame(time = 1:7, Inc = c(1, 3, 5, 7, 5, 3, 1))
# and we have two simulated time series:
traj1 <- data.frame(time = 1:7, observation = c(3, 5, 7, 9, 7, 5, 3))
traj2 <- data.frame(time = 1:7, observation = c(3, 5, 3, 5, 7, 5, 3))
# traj1 is consistently above data and traj2 oscillates around data:
plot(data$time, data$Inc, t = "l", ylim = c(0, 10))
lines(traj1$time, traj1$observation, col = "red")
lines(traj2$time, traj2$observation, col = "blue")
# While the squared differences are the same, we obtain a smaller distance
# for traj2:
d1 <- seitlDistanceOscillation(traj1, data)
# d1 = 4
d2 <- seitlDistanceOscillation(traj2, data)
# d2 = 1.3

## End(Not run)

sbfnk/fitR documentation built on July 18, 2023, 3:28 p.m.