Description Usage Arguments Value Specifying the perturbations: the rw.sd function Re-running mif2 Iterations Continuing mif2 Iterations Methods Author(s) References See Also Examples
An improved 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).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## S4 method for signature 'pomp'
mif2(object, Nmif = 1, start, Np, rw.sd, transform = FALSE,
cooling.type = c("hyperbolic", "geometric"), cooling.fraction.50,
tol = 1e-17, max.fail = Inf, verbose = getOption("verbose"), ...)
## S4 method for signature 'pfilterd.pomp'
mif2(object, Nmif = 1, Np, tol, ...)
## S4 method for signature 'mif2d.pomp'
mif2(object, Nmif, start, Np, rw.sd, transform,
cooling.type, cooling.fraction.50, tol, ...)
## S4 method for signature 'mif2d.pomp'
continue(object, Nmif = 1, ...)
## S4 method for signature 'mif2d.pomp'
conv.rec(object, pars, transform = FALSE, ...)
## S4 method for signature 'mif2List'
conv.rec(object, ...)
rw.sd(...)
|
object |
An object of class |
Nmif |
The number of filtering iterations to perform. |
start |
named numerical vector; the starting guess of the parameters. By default, start=coef(object). |
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 |
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 ifelse(time==time[1],s,0). Likewise, 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 |
transform |
logical;
if |
cooling.type, cooling.fraction.50 |
specifications for the cooling schedule, i.e., the manner in which the intensity of the parameter perturbations is reduced with successive filtering iterations.
|
tol, max.fail |
passed to the particle filter.
See the descriptions under |
verbose |
logical; if TRUE, print progress reports. |
... |
additional arguments that override the defaults. |
pars |
names of parameters. |
Upon successful completion, mif2
returns an object of class mif2d.pomp
.
This class inherits from the pfilterd.pomp
and pomp
classes.
rw.sd
functionThis 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,
1 2 3 4 5 6 |
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.
mif2
IterationsTo re-run a sequence of mif2
iterations, one can use the mif2
method on a mif2d.pomp
object.
By default, the same parameters used for the original mif2
run are re-used (except for tol
, max.fail
, and verbose
, the defaults of which are shown above).
If one does specify additional arguments, these will override the defaults.
mif2
IterationsOne can resume a series of mif2
iterations from where one left off using the continue
method.
A call to mif2
to perform Nmif=m
iterations followed by a call to continue
to perform Nmif=n
iterations will produce precisely the same effect as a single call to mif2
to perform Nmif=m+n
iterations.
By default, all the algorithmic parameters are the same as used in the original call to mif2
.
Additional arguments will override these defaults.
Methods that can be used to manipulate, display, or extract information from a mif2d.pomp
object:
conv.rec(object, pars = NULL)
returns the columns of the convergence-record matrix corresponding to the names in pars
.
By default, all rows are returned.
Returns the value in the loglik
slot.
NB: this is not the same as the likelihood of the model at the MLE!
Concatenates mif2d.pomp
objects into a mif2List
.
Plots a series of diagnostic plots when applied to a mif2d.pomp
or mif2List
object.
Aaron A. King kingaa at umich dot edu, Edward L. Ionides, and Dao Nguyen
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.
pomp
, pfilter
, mif
, and the tutorials on the package website.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
pompExample(ou2)
guess1 <- guess2 <- coef(ou2)
guess1[c('x1.0','x2.0','alpha.2','alpha.3')] <- 0.5*guess1[c('x1.0','x2.0','alpha.2','alpha.3')]
guess2[c('x1.0','x2.0','alpha.2','alpha.3')] <- 1.5*guess1[c('x1.0','x2.0','alpha.2','alpha.3')]
m1 <- mif2(ou2,Nmif=100,start=guess1,Np=1000,
cooling.type="hyperbolic",cooling.fraction.50=0.05,
rw.sd=rw.sd(x1.0=ivp(0.5),x2.0=ivp(0.5),
alpha.2=0.1,alpha.3=0.1))
m2 <- mif2(ou2,Nmif=100,start=guess2,Np=1000,
cooling.type="hyperbolic",cooling.fraction.50=0.05,
rw.sd=rw.sd(x1.0=ivp(0.5),x2.0=ivp(0.5),
alpha.2=0.1,alpha.3=0.1))
plot(c(m1,m2))
rbind(mle1=c(coef(m1),loglik=logLik(pfilter(m1,Np=1000))),
mle2=c(coef(m2),loglik=logLik(pfilter(m1,Np=1000))),
truth=c(coef(ou2),loglik=logLik(pfilter(m1,Np=1000))))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.