This function attempts to match trajectories of a model's deterministic skeleton to data.
Trajectory matching is equivalent to maximum likelihood estimation under the assumption that process noise is entirely absent,
i.e., that all stochasticity is measurement error.
Accordingly, this method uses only the skeleton
and dmeasure
components of a POMP model.
1 2 3 4 5 6 7 8 9  ## S4 method for signature 'pomp'
traj.match(object, start, est = character(0),
method = c("NelderMead","subplex","SANN","BFGS",
"sannbox","nloptr"),
transform = FALSE, ...)
## S4 method for signature 'traj.matched.pomp'
traj.match(object, est, transform, ...)
## S4 method for signature 'pomp'
traj.match.objfun(object, params, est, transform = FALSE, ...)

object 
A 
start 
named numeric vector containing an initial guess for parameters.
By default 
params 
optional named numeric vector of parameters.
This should contain all parameters needed by the 
est 
character vector containing the names of parameters to be estimated.
In the case of 
method 
Optimization method.
Choices are 
transform 
logical;
if 
... 
Extra arguments that will be passed either to the optimizer ( 
In pomp, trajectory matching is the term used for maximizing the likelihood of the data under the assumption that there is no process noise.
Specifically, traj.match
calls an optimizer (optim
, subplex
, and sannbox
are the currently supported options) to minimize an objective function.
For any value of the model parameters, this objective function is calculated by
computing the deterministic trajectory of the model given the parameters.
This is the trajectory returned by trajectory
, which relies on the model's deterministic skeleton as specified in the construction of the pomp
object object
.
evaluating the negative log likelihood of the data under the measurement model given the deterministic trajectory and the model parameters.
This is accomplished via the model's dmeasure
slot.
The negative log likelihood is the objective function's value.
The objective function itself — in a form suitable for use with optim
like optimizers — is created by a call to traj.match.objfun
.
Specifically, traj.match.objfun
will return a function that takes a single numericvector argument that is assumed to cotain the parameters named in est
, in that order.
traj.match
returns an object of class traj.matched.pomp
.
This class inherits from class pomp
and contains the following additional slots:
the values of these arguments on the call to traj.match
.
number of function and gradient evaluations by the optimizer.
See optim
.
value of the objective function.
Larger values indicate better fit (i.e., traj.match
attempts to maximize this quantity.
convergence code and message from the optimizer.
See optim
.
Available methods for objects of this type include summary
and logLik
.
The other slots of this object can be accessed via the $
operator.
traj.match.objfun
returns a function suitable for use as an objective function in an optim
like optimizer.
trajectory
,
pomp
,
optim
,
subplex
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  pompExample(ou2)
true.p < c(
alpha.1=0.9,alpha.2=0,alpha.3=0.4,alpha.4=0.99,
sigma.1=2,sigma.2=0.1,sigma.3=2,
tau=1,
x1.0=50,x2.0=50
)
simdata < simulate(ou2,nsim=1,params=true.p,seed=43553)
guess.p < true.p
res < traj.match(
simdata,
start=guess.p,
est=c('alpha.1','alpha.3','alpha.4','x1.0','x2.0','tau'),
maxit=2000,
method="NelderMead",
reltol=1e8
)
summary(res)
plot(range(time(res)),range(c(obs(res),states(res))),type='n',xlab="time",ylab="x,y")
points(y1~time,data=as(res,"data.frame"),col='blue')
points(y2~time,data=as(res,"data.frame"),col='red')
lines(x1~time,data=as(res,"data.frame"),col='blue')
lines(x2~time,data=as(res,"data.frame"),col='red')
pompExample(ricker)
ofun < traj.match.objfun(ricker,est=c("r","phi"),transform=TRUE)
optim(fn=ofun,par=c(2,0),method="BFGS")
pompExample(bbs)
## some options are passed to the ODE integrator
ofun < traj.match.objfun(bbs,est=c("beta","gamma"),transform=TRUE,hmax=0.001,rtol=1e6)
optim(fn=ofun,par=c(0,1),method="NelderMead",control=list(reltol=1e10))

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.