Description Usage Arguments Value References Examples
This function implements one step of the sequential importance sampling method for a target with passive sonar.
1 | Sstep.Sonar(mm, xx, logww, yy, par, xdim = 1, ydim = 1)
|
mm |
the Monte Carlo sample size |
xx |
the sample in the last iteration. |
logww |
the log weight in the last iteration. |
yy |
the observations with |
par |
a list of parameter values. |
xdim |
the dimension of the state varible |
ydim |
the dimension of the observation |
The function returns a list with the following components:
xx |
the new sample. |
logww |
the log weights. |
Tsay, R. and Chen, R. (2019). Nonlinear Time Series Analysis. Wiley, New Jersey.
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 | s2 <- 20 #second sonar location at (s2,0)
q <- c(0.03,0.03)
r <- c(0.02,0.02)
nobs <- 200
start <- c(10,10,0.01,0.01)
H <- c(1,0,1,0,0,1,0,1,0,0,1,0,0,0,0,1)
H <- matrix(H,ncol=4,nrow=4,byrow=TRUE)
W <- c(0.5*q[1], 0,0, 0.5*q[2],q[1],0,0,q[2])
W <- matrix(W,ncol=2,nrow=4,byrow=TRUE)
V <- diag(r)
mu0 <- start
SS0 <- diag(c(1,1,1,1))*0.01
simu_out <- simPassiveSonar(nobs,q,r,start,seed=20)
yy <- simu_out$yy
mm <- 100000
resample.sch <- rep(1,nobs)
par <- list(H=H,W=W,V=V,s2=s2)
xdim <- 4;ydim <- 2;
xx.init <- mu0+SS0%*%matrix(rnorm(mm*4),nrow=4,ncol=mm)
delay <- 20
out <- SMC(Sstep.Sonar,nobs,yy,mm,par,xx.init,xdim,ydim,resample.sch,delay)
tt <- 100:200
plot(simu_out$xx[1,tt],simu_out$xx[2,tt],xlab='x',ylab='y',xlim=c(25.8,34))
for(dd in c(1,11,21)){
tt <- 100:(200-dd)
lines(out$xhat[1,tt,dd],out$xhat[2,tt,dd],lty=22-dd,lwd=2)
}
legend(26.1,-12,legend=c("delay 0","delay 10","delay 20"),lty=c(21,11,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.