probe applies one or more probes to time series data and model simulations and compares the results.
It can be used to diagnose goodness of fit and/or as the basis for probe-matching, a generalized method-of-moments approach to parameter estimation.
probe.match calls an optimizer to adjust model parameters to do probe-matching, i.e., to minimize the discrepancy between simulated and actual data.
This discrepancy is measured using the synthetic likelihood as defined by Wood (2010).
probe.match.objfun constructs an objective function for probe-matching suitable for use in optim-like optimizers.
"probe"(object, probes, params, nsim, seed = NULL, ...)
"probe"(object, probes, params, nsim, seed, ...)
"probe.match.objfun"(object, params, est, probes, nsim, seed = NULL, fail.value = NA, transform = FALSE, ...)
"probe.match.objfun"(object, probes, nsim, seed, ...)
"probe.match"(object, start, est = character(0), probes, nsim, seed = NULL, method = c("subplex","Nelder-Mead","SANN","BFGS", "sannbox","nloptr"), verbose = getOption("verbose"), fail.value = NA, transform = FALSE, ...)
"probe.match"(object, probes, nsim, seed, ..., verbose = getOption("verbose"))
"probe.match"(object, est, probes, nsim, seed, transform, fail.value, ..., verbose = getOption("verbose"))
"logLik"(object, ...)
"values"(object, ...)pomp.
pomp.
A vector-valued probe must always return a vector of the same size.
A number of useful examples are provided with the package: see probe functions).
params=coef(object).
NULL, the random number generator will be initialized with this seed for simulations.
See simulate-pomp.
NA, this value is substituted for non-finite values of the objective function.
It should be a large number (i.e., bigger than any legitimate values the objective function is likely to take).
TRUE, optimization is performed on the transformed scale.
probe, these are currently ignored.
In the case of probe.match, these are passed to the optimizer (one of optim, subplex, nloptr, or sannbox).
These are passed via the optimizer's control list (in the case of optim, subplex, and sannbox) or the opts list (in the case of nloptr).
probe returns an object of class probed.pomp.
probed.pomp is derived from the pomp class and therefore have all the slots of pomp.
In addition, a probed.pomp class has the following slots:
simvals that deviate more extremely from the mean of the simvals than does datavals.
probe.match returns an object of class probe.matched.pomp, which is derived from class probed.pomp.
probe.matched.pomp objects therefore have all the slots above plus the following:
probe.match.optim.
optim and nloptr.
probe.match.objfun returns a function suitable for use as an objective function in an optim-like optimizer.
.id indicates whether the probes are from the data or simulations.
$ operator.probe results in the evaluation of the probe(s) in probes on the data.
Additionally, nsim simulated data sets are generated (via a call to simulate) and the probe(s) are applied to each of these.
The results of the probe computations on real and simulated data are stored in an object of class probed.pomp. A call to probe.match results in an attempt to optimize the agreement between model and data, as measured by the specified probes, over the parameters named in est.
The results, including coefficients of the fitted model and values of the probes for data and fitted-model simulations, are stored in an object of class probe.matched.pomp.
The objective function minimized by probe.match --- in a form suitable for use with optim-like optimizers --- is created by a call to probe.match.objfun.
Specifically, probe.match.objfun will return a function that takes a single numeric-vector argument that is assumed to cotain the parameters named in est, in that order.
This function will return the negative synthetic log likelihood for the probes specified.
S. N. Wood Statistical inference for noisy nonlinear ecological dynamic systems, Nature, 466: 1102--1104, 2010.
pompExample(ou2)
good <- probe(
ou2,
probes=list(
y1.mean=probe.mean(var="y1"),
y2.mean=probe.mean(var="y2"),
y1.sd=probe.sd(var="y1"),
y2.sd=probe.sd(var="y2"),
extra=function(x)max(x["y1",])
),
nsim=500
)
summary(good)
plot(good)
bad <- probe(
ou2,
params=c(alpha.1=0.1,alpha.4=0.2,x1.0=0,x2.0=0,
alpha.2=-0.5,alpha.3=0.3,
sigma.1=3,sigma.2=-0.5,sigma.3=2,
tau=1),
probes=list(
y1.mean=probe.mean(var="y1"),
y2.mean=probe.mean(var="y2"),
y1.sd=probe.sd(var="y1"),
y2.sd=probe.sd(var="y2"),
extra=function(x)range(x["y1",])
),
nsim=500
)
summary(bad)
plot(bad)
Run the code above in your browser using DataLab