pfilter: Particle filtering for panel data

pfilterR Documentation

Particle filtering for panel data

Description

Tools for applying particle filtering algorithms to panel data.

Usage

## S4 method for signature 'panelPomp'
pfilter(
  data,
  shared,
  specific,
  params,
  Np,
  verbose = getOption("verbose"),
  ...
)

## S4 method for signature 'pfilterd.ppomp'
logLik(object, ...)

## S4 method for signature 'pfilterd.ppomp'
unitLogLik(object, ...)

Arguments

data

An object of class panelPomp or inheriting class panelPomp.

shared, specific

optional; these arguments depend on the type of object.

If object is a list of pomps, shared must be a numeric vector specifying parameter values shared among panel units. specific must be a matrix with parameter values that are unit-specific with rows naming parameters and columns naming units (these names must match those of object). If no values are specified and object has parameter values, these are set to be all unit-specific.

If object is a panelPomp object, these arguments can still be used as described above to modify the parameters of object. Alternatively, the parameter configuration of object can be modified providing only a character shared naming parameters of object that should be shared (with values for parameters not originally shared taken from the unit-specific parameters of the first panel unit of object). shared=NULL sets all parameters as unit-specific.

params

optional; a named numeric vector. In this case, the nature of parameters is determined via a naming convention: names ending in “[unit_name]” are assumed to denote unit-specific parameters; all other names specify shared parameters.

Np

the number of particles to use. 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 timesteps, one may specify Np either as a vector of positive integers of length

length(time(object,t0=TRUE))

or as a function taking a positive integer argument. In the latter case, Np(k) must be a single positive integer, representing the number of particles to be used at the k-th timestep: Np(0) is the number of particles to use going from timezero(object) to time(object)[1], Np(1), from timezero(object) to time(object)[1], and so on, while when T=length(time(object)), Np(T) is the number of particles to sample at the end of the time-series.

verbose

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

...

additional arguments, passed to the pfilter method of pomp.

object

required; either (i) a list of pomp objects; or (ii) an object of class panelPomp or inheriting class panelPomp.

If object is a list of pomps, the list must be named. All these pomps must either have no parameters or have the same parameter names. (This is just a format requirement. pomp codes can ignore any parameter that is irrelevant to any given panel unit.)

If object is a panelPomp object, the function allows modifying the shared and unit-specific configuration of object.

Value

pfilter() returns an object of class pfilterd.ppomp that is also a panelPomp object (with the additional filtering details).

When applied to an object of class pfilterd.ppomp, logLik() returns a numeric value.

\unitLogLikReturn

Methods

logLik

Extracts the estimated log likelihood for the entire panel.

unitLogLik

Extracts the estimated log likelihood for each panel unit.

Author(s)

Carles \Breto

References

\arulampalam

2002

\breto

2020

See Also

pomp's pfilter at pfilter, panel_loglik

Other panelPomp workhorse functions: mif2(), panelPomp, panel_loglik

Examples

# filter, which generates log likelihoods
pfrw <- pfilter(panelRandomWalk(),Np=10)
class(pfrw) # "pfilterd.ppomp"
is(pfrw,"panelPomp") # TRUE
pfrw
# extract single log likelihood for the entire panel
logLik(pfrw)
# extract log likelihood for each panel unit
unitLogLik(pfrw)

cbreto/panelPomp documentation built on Sept. 15, 2024, 10:42 p.m.