SMC: Generic Sequential Monte Carlo Method

View source: R/SMC.r

SMCR Documentation

Generic Sequential Monte Carlo Method

Description

Function of generic sequential Monte Carlo method with delay weighting not using full information proposal distribution.

Usage

SMC(
  Sstep,
  nobs,
  yy,
  mm,
  par,
  xx.init,
  xdim,
  ydim,
  resample.sch,
  delay = 0,
  funH = identity
)

Arguments

Sstep

a function that performs one step propagation using a proposal distribution. Its input includes (mm,xx,logww,yyy,par,xdim,ydim), where xx and logww are the last iteration samples and log weight. yyy is the observation at current time step. It should return xx (the samples xt) and logww (their corresponding log weight).

nobs

the number of observations T.

yy

the observations with T columns and ydim rows.

mm

the Monte Carlo sample size.

par

a list of parameter values to pass to Sstep.

xx.init

the initial samples of x_0.

xdim

the dimension of the state variable x_t.

ydim

the dimension of the observation y_t.

resample.sch

a binary vector of length nobs, reflecting the resampling schedule. resample.sch[i]= 1 indicating resample should be carried out at step i.

delay

the maximum delay lag for delayed weighting estimation. Default is zero.

funH

a user supplied function h() for estimation E(h(x_t) | y_t+d). Default is identity for estimating the mean. The function should be able to take vector or matrix as input and operates on each element of the input.

Value

The function returns xhat, an array with dimensions (xdim; nobs; delay+1), and the scaled log-likelihood value loglike. If loglike is needed, the log weight calculation in the Sstep function should retain all constants that are related to the parameters involved. Otherwise, Sstep function may remove all constants that are common to all the Monte Carlo samples. It needs a utility function circular2ordinal, also included in the NTS package, for efficient memory management.

References

Tsay, R. and Chen, R. (2018). Nonlinear Time Series Analysis. John Wiley & Sons, New Jersey.

Examples

nobs= 100; pd= 0.95; ssw= 0.1; ssv= 0.5;
xx0= 0; ss0= 0.1; nyy= 50;
yrange= c(-80,80); xdim= 2; ydim= nyy;
mm= 10000
yr=yrange[2]-yrange[1]
par=list(ssw=ssw,ssv=ssv,nyy=nyy,pd=pd,yr=yr)
simu=simuTargetClutter(nobs,pd,ssw,ssv,xx0,ss0,nyy,yrange)
xx.init=matrix(nrow=2,ncol=mm)
xx.init[1,]=yrange[1]+runif(mm)*yr
xx.init[2,]=rep(0.1,mm)
resample.sch=rep.int(1,nobs)
out= SMC(Sstep.Clutter,nobs,simu$yy,mm,par,xx.init,xdim,ydim,resample.sch)

NTS documentation built on Sept. 25, 2023, 1:08 a.m.

Related to SMC in NTS...