probe_match: Probe matching

Description Usage Arguments Details Value Important Note Author(s) See Also Examples

Description

Estimation of parameters by maximum synthetic likelihood

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## S4 method for signature 'data.frame'
probe_objfun(data, est = character(0),
  fail.value = NA, probes, nsim, seed = NULL, params, rinit, rprocess,
  rmeasure, partrans, ..., verbose = getOption("verbose", FALSE))

## S4 method for signature 'pomp'
probe_objfun(data, est = character(0),
  fail.value = NA, probes, nsim, seed = NULL, ...,
  verbose = getOption("verbose", FALSE))

## S4 method for signature 'probed_pomp'
probe_objfun(data, est = character(0),
  fail.value = NA, probes, nsim, seed = NULL, ...,
  verbose = getOption("verbose", FALSE))

## S4 method for signature 'probe_match_objfun'
probe_objfun(data, est, fail.value,
  seed = NULL, ..., 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.

est

character vector; the names of parameters to be estimated.

fail.value

optional numeric scalar; if non-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).

probes

a single probe or a list of one or more probes. A probe is simply a scalar- or vector-valued function of one argument that can be applied to the data array of a ‘pomp’. A vector-valued probe must always return a vector of the same size. A number of useful probes are provided with the package: see basic probes.

nsim

the number of model simulations to be computed.

seed

integer. When fitting, it is often best to fix the seed of the random-number generator (RNG). This is accomplished by setting seed to an integer. By default, seed = NULL, which does not alter the RNG state.

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 here.

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 the documentation on these plugins.

rmeasure

simulator of the measurement model, 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 rmeasure=NULL removes the measurement model simulator. For more information, see here.

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 here. 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 the userdata documentation here for information on how to use this facility.

verbose

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

Details

In probe-matching, one attempts to minimize the discrepancy between simulated and actual data, as measured by a set of summary statistics called probes. In pomp, this discrepancy is measured using the “synthetic likelihood” as defined by Wood (2010).

Value

probe_objfun constructs a stateful objective function for probe matching. Specifically, probe_objfun returns an object of class ‘probe_match_objfun’, which is a function suitable for use in an optim-like optimizer. In particular, this function takes a single numeric-vector argument that is assumed to contain the parameters named in est, in that order. When called, it will return the negative synthetic log likelihood for the probes specified. It is a stateful function: Each time it is called, it will remember the values of the parameters and its estimate of the synthetic likelihood.

Important Note

Since pomp cannot guarantee that the final call an optimizer makes to the function is a call at the optimum, it cannot guarantee that the parameters stored in the function are the optimal ones. Therefore, it is a good idea to evaluate the function on the parameters returned by the optimization routine, which will ensure that these parameters are stored.

Author(s)

Aaron A. King

See Also

optim subplex nloptr

Other summary statistics methods: abc, basic_probes, probe, spect

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

Examples

 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
35
36
37
  library(magrittr)

  gompertz() -> po
  
  ## A list of probes:
  plist <- list(
    mean=probe.mean("Y",trim=0.1,transform=sqrt),
    sd=probe.sd("Y",transform=sqrt),
    probe.marginal("Y",ref=obs(po)),
    probe.acf("Y",lags=c(1,3,5),type="correlation",transform=sqrt),
    probe.quantile("Y",prob=c(0.25,0.75),na.rm=TRUE)
  )

  ## Construct the probe-matching objective function.
  ## Here, we just want to estimate 'K'.
  po %>%
    probe_objfun(probes=plist,nsim=100,seed=5069977,
      est="K") -> f

  ## Any numerical optimizer can be used to minimize 'f'.
  library(subplex)

  subplex(fn=f,par=0.4,control=list(reltol=1e-5)) -> out

  ## Call the objective one last time on the optimal parameters:
  f(out$par)

  ## There are 'plot' and 'summary' methods:
  f %>% as("probed_pomp") %>% plot()
  f %>% summary()

  f %>% probe() %>% plot()

  ## One can modify the objective function with another call
  ## to 'probe_objfun':

  f %>% probe_objfun(est=c("r","K")) -> f1

kidusasfaw/pomp documentation built on May 20, 2019, 2:59 p.m.