SMC.Full: Generic Sequential Monte Carlo Using Full Information...

Description Usage Arguments Value References Examples

Description

Generic sequential Monte Carlo using full information proposal distribution.

Usage

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

Arguments

SISstep.Full

a function that performs one step propagation using a proposal distribution. Its input includes (mm,xx,logww,yyy,par,xdim,ydim,resample), 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), resample is a binary value for resampling.

nobs

the number of observations T.

yy

the observations with T columns and ydim rows.

mm

the Monte Carlo sample size m.

par

a list of parameter values to pass to Sstep.

xx.init

the initial samples of x_0.

xdim

the dimension of the state varible 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 a list with the following components:

xhat

the fitted values.

loglike

the log-likelihood.

References

Tsay, R. and Chen, R. (2019). Nonlinear Time Series Analysis. Wiley, New Jersey.

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
38
39
nk <- 5
nobs <- 100; pd <- 0.95; ssw <- 0.1; ssv <- 0.1;
xx0 <- 0; ss0 <- 0.1; nyy <- 50; yrange <- c(-80,80);
xdim <- 2; ydim <- nyy; yr <- yrange[2]-yrange[1]
par <- list(ssw=ssw,ssv=ssv,nyy=nyy,pd=pd,yr=yr)
#--- simulation for repeated use
Yy <- array(dim=c(nyy,nobs,nk))
Xx <- matrix(ncol=nk,nrow=nobs)
Ii <- matrix(ncol=nk,nrow=nobs)
kk <- 0
seed.k <- 1
while(kk < nk){
seed.k <- seed.k+1
	set.seed(seed.k)
	kk <- kk+1
	simu <- simuTargetClutter(nobs,pd,ssw,ssv,xx0,ss0,nyy,yrange)
if(max(abs(simu$yy))>80){
	kk <- kk-1
}else{
	Xx[,kk] <- simu$xx; Yy[,,kk] <- simu$yy; Ii[,kk] <- simu$ii
}
}
resample.sch <- rep.int(1,nobs)
delay <- 0; mm <- 10000;
Xxhat.full <- array(dim=c(nobs,1,nk))
Xxhat.p <- array(dim=c(nobs,1,nk))
Xres.com2 <- array(dim=c(nobs,2,nk))
set.seed(1)
for(kk in 1:nk){
	xx.init <- matrix(nrow=2,ncol=mm)
xx.init[1,] <- yrange[1]+runif(mm)*yr
xx.init[2,] <- rep(0.1,mm)
out1 <- SMC(Sstep.Clutter,nobs,Yy[,,kk],mm,par,
xx.init,xdim,ydim,resample.sch)
Xxhat.p[,1,kk] <- out1$xhat[1,,1]
out2 <- SMC.Full(Sstep.Clutter.Full,nobs,Yy[,,kk],mm,par,
xx.init,xdim,ydim,resample.sch)
Xxhat.full[,1,kk] <- out2$xhat[1,,1]
}

ConvFuncTimeSeries/test_t documentation built on May 29, 2019, 1:39 p.m.