mif2 {pomp} | R Documentation

## Iterated filtering: maximum likelihood by iterated, perturbed Bayes maps

### Description

An iterated filtering algorithm for estimating the parameters of a partially-observed Markov process. Running `mif2` causes the algorithm to perform a specified number of particle-filter iterations. At each iteration, the particle filter is performed on a perturbed version of the model, in which the parameters to be estimated are subjected to random perturbations at each observation. This extra variability effectively smooths the likelihood surface and combats particle depletion by introducing diversity into particle population. As the iterations progress, the magnitude of the perturbations is diminished according to a user-specified cooling schedule. The algorithm is presented and justified in Ionides et al. (2015).

### Usage

    ## S4 method for signature 'data.frame'
    mif2(data, Nmif = 1, rw.sd,
      cooling.type = c("geometric", "hyperbolic"), cooling.fraction.50, Np,
      tol = 1e-17, max.fail = Inf, params, rinit, rprocess, dmeasure,
      partrans, ..., verbose = getOption("verbose", FALSE))

    ## S4 method for signature 'pomp'
    mif2(data, Nmif = 1, rw.sd,
      cooling.type = c("geometric", "hyperbolic"), cooling.fraction.50, Np,
      tol = 1e-17, max.fail = Inf, ..., verbose = getOption("verbose",
      FALSE))

    ## S4 method for signature 'pfilterd_pomp'
    mif2(data, Nmif = 1, Np, tol, max.fail = Inf,
      ..., verbose = getOption("verbose", FALSE))

    ## S4 method for signature 'mif2d_pomp'
    mif2(data, Nmif, rw.sd, cooling.type,
      cooling.fraction.50, ..., verbose = getOption("verbose", FALSE))

### Arguments

`data` | either a data frame holding the time series data, or an object of class ‘pomp’, i.e., the output of another pomp calculation.
`Nmif` | The number of filtering iterations to perform.

`rw.sd`

specification of the magnitude of the random-walk perturbations that will be applied to some or all model parameters. Parameters that are to be estimated should have positive perturbations specified here. The specification is given using the `rw.sd` function, which creates a list of unevaluated expressions. The latter are evaluated in a context where the model time variable is defined (as `time`). The expression `ivp(s)` can be used in this context as shorthand for

    ifelse(time==time[1],s,0).

Likewise, `ivp(s,lag)` is equivalent to

    ifelse(time==time[lag],s,0).

See below for some examples.

The perturbations that are applied are normally distributed with the specified s.d. If parameter transformations have been supplied, then the perturbations are applied on the transformed (estimation) scale.

`cooling.type, cooling.fraction.50` | specifications for the cooling schedule, i.e., the manner and rate with which the intensity of the parameter perturbations is reduced with successive filtering iterations. `cooling.type` specifies the nature of the cooling schedule. See below (under “Specifying the perturbations”) for more detail.

`Np`

the number of particles to use in filtering. This may be specified as a single positive integer, in which case the same number of particles will be used at each timestep. Alternatively, if one wishes the number of particles to vary across timestep, one may specify `Np` either as a vector of positive integers (of length `length(time(object))`) or as a function taking a positive integer argument. In the latter case, `Np(n)` must be a single positive integer, representing the number of particles to be used at the `n`-th timestep: `Np(1)` is the number of particles to use going from `timezero(object)` to `time(object)[1]`, `Np(2)`, from `time(object)[1]` to `time(object)[2]`, and so on.

`tol` | positive numeric scalar; particles with likelihood less than `tol` are considered to be incompatible with the data. See the section on Filtering Failures for more information.
`max.fail` | integer; the maximum number of filtering failures allowed (see below). If the number of filtering failures exceeds this number, execution will terminate with an error. By default, `max.fail` is set to infinity, so no error can be triggered.
`params` | optional; named numeric vector of parameters. This will be coerced internally to storage mode `double`.
`rinit` | simulator of the initial-state distribution. This can be furnished either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting `rinit=NULL` sets the initial-state simulator to its default. For more information, see ?rinit_spec.
`rprocess` | simulator of the latent state process, specified using one of the rprocess plugins. Setting `rprocess=NULL` removes the latent-state simulator. For more information, see ?rprocess_spec for the documentation on these plugins.
`dmeasure` | evaluator of the measurement model density, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting `dmeasure=NULL` removes the measurement density evaluator. For more information, see ?dmeasure_spec.

`partrans`

optional parameter transformations, constructed using `parameter_trans`.

Many algorithms for parameter estimation search an unconstrained space of parameters. When working with such an algorithm and a model for which the parameters are constrained, it can be useful to transform parameters. One should supply the `partrans` argument via a call to `parameter_trans`. For more information, see ?parameter_trans. Setting `partrans=NULL` removes the parameter transformations, i.e., sets them to the identity transformation.

`...`

additional arguments supply new or modify existing model characteristics or components. See `pomp` for a full list of recognized arguments.

When named arguments not recognized by `pomp` are provided, these are made available to all basic components via the so-called userdata facility. This allows the user to pass information to the basic components outside of the usual routes of covariates (`covar`) and model parameters (`params`). See ?userdata for information on how to use this facility.

`verbose` | logical; if `TRUE`, diagnostic messages will be printed to the console.

### Value

Upon successful completion, `mif2` returns an object of class ‘mif2d_pomp’.

### Methods

The following methods are available for such an object:

`continue`

  picks up where `mif2` leaves off and performs more filtering iterations.

`logLik`

  returns the so-called mif log likelihood which is the log likelihood of the perturbed model, not of the focal model itself. To obtain the latter, it is advisable to run several `pfilter` operations on the result of a `mif2` computatation.

`coef`

  extracts the point estimate

`eff.sample.size`

  extracts the effective sample size of the final filtering iteration

Various other methods can be applied, including all the methods applicable to a `pfilterd_pomp` object and all other pomp estimation algorithms and diagnostic methods.

### Specifying the perturbations

The `rw.sd` function simply returns a list containing its arguments as unevaluated expressions. These are then evaluated in a context containing the model `time` variable. This allows for easy specification of the structure of the perturbations that are to be applied. For example,

        rw.sd(a=0.05, b=ifelse(0.2,time==time[1],0),
              c=ivp(0.2), d=ifelse(time==time[13],0.2,0),
              e=ivp(0.2,lag=13), f=ifelse(time<23,0.02,0))

results in perturbations of parameter `a` with s.d. 0.05 at every time step, while parameters `b` and `c` both get perturbations of s.d. 0.2 only before the first observation. Parameters `d` and `e`, by contrast, get perturbations of s.d. 0.2 only before the thirteenth observation. Finally, parameter `f` gets a random perturbation of size 0.02 before every observation falling before t=23.

On the m-th IF2 iteration, prior to time-point n, the d-th parameter is given a random increment normally distributed with mean 0 and standard deviation c[m,n] sigma[d,n], where c is the cooling schedule and sigma is specified using `rw.sd`, as described above. Let N be the length of the time series and alpha=`cooling.fraction.50`. Then, when `cooling.type="geometric"`, we have

c[m,n]=alpha^((n-1+(m-1)N)/(50N)).

When `cooling.type="hyperbolic"`, we have

c[m,n]=(s+1)/(s+n+(m-1)N),

where s satisfies

(s+1)/(s+50N)=alpha.

Thus, in either case, the perturbations at the end of 50 IF2 iterations are a fraction alpha smaller than they are at first.

### Filtering failures

If the degree of disagreement between model and data becomes sufficiently large, a “filtering failure” results. A filtering failure occurs when, at some time point, none of the `Np` particles is compatible with the data. In particular, if the conditional likelihood of a particle at any time is below the tolerance value `tol`, then that particle is considered to be uninformative and its likelihood is taken to be zero. A filtering failure occurs when this is the case for all particles. A warning is generated when this occurs unless the cumulative number of failures exceeds `max.fail`, in which case an error is generated.

### Author(s)

Aaron A. King, Edward L. Ionides, Dao Nguyen

### References

E. L. Ionides, D. Nguyen, Y. Atchad\'e, S. Stoev, and A. A. King. Inference for dynamic and latent variable models via iterated, perturbed Bayes maps. Proc. Natl. Acad. Sci. U.S.A., 112:719–724, 2015.

### See Also

Other particle filter methods: `bsmc2`, `cond.logLik`, `eff.sample.size`, `filter.mean`, `filter.traj`, `pfilter`, `pmcmc`, `pred.mean`, `pred.var`

Other pomp parameter estimation methods: `abc`, `bsmc2`, `kalman`, `nlf`, `pmcmc`, `pomp-package`, `probe.match`, `spect.match`

[Package pomp version 2.3 Index]