Learn R Programming

pomp (version 0.53-5)

trajectory: Compute trajectories of the deterministic skeleton.

Description

The method trajectory computes a trajectory of the deterministic skeleton of a Markov process. In the case of a discrete-time system, the deterministic skeleton is a map and a trajectory is obtained by iterating the map. In the case of a continuous-time system, the deterministic skeleton is a vector-field; trajectory integrates the vectorfield to obtain a trajectory.

Usage

## S3 method for class 'pomp':
trajectory(object, params, times, t0, as.data.frame = FALSE, \dots)

Arguments

object
an object of class pomp.
params
a rank-2 array of parameters. Each column of params is a distinct parameter vector.
times, t0
times is a numeric vector specifying the times at which a trajectory is desired. t0 specifies the start time (the time at which the initial conditions hold). The default for times is times=time(object,t
as.data.frame
logical; if TRUE, return the result as a data-frame.
...
additional arguments are passed to the ODE integrator if the skeleton is a vectorfield and ignored if it is a map. See ode for a description of the additional arguments accepted.

Value

  • Returns an array of dimensions nvar x nreps x ntimes. If x is the returned matrix, x[i,j,k] is the i-th component of the state vector at time times[k] given parameters params[,j].

Details

This function makes repeated calls to the user-supplied skeleton of the pomp object. For specifications on supplying this, see pomp.

When the skeleton is a vectorfield, trajectory integrates it using ode.

When the skeleton is a map, trajectory iterates it. By default, time is advanced 1 unit per iteration. The user can change this behavior by specifying the desired timestep using the argument skelmap.delta.t in the construction of the pomp object.

See Also

pomp, traj.match, ode

Examples

Run this code
pompExample(euler.sir)
x <- trajectory(euler.sir)
plot(time(euler.sir),x["I",1,],type='l',xlab='time',ylab='I')
lines(time(euler.sir),x["cases",1,],col='red')

coef(euler.sir,c("gamma")) <- log(12)
x <- trajectory(euler.sir)
plot(time(euler.sir),x["I",1,],type='l',xlab='time',ylab='I')
lines(time(euler.sir),x["cases",1,],col='red')

x <- trajectory(euler.sir,as.data.frame=TRUE)

Run the code above in your browser using DataLab