ngsmth {timsac} | R Documentation |
Trend estimation by Non-Gaussian smoothing.
ngsmth(y,noisev=2,tau2,bv=1.0,noisew=1,sig2,bw=1.0,initd=1,k=200,plot=TRUE)
y |
a univariate time series. |
noisev |
type of system noise density. (1:Gaussian (normal), 2:Pearson family, 3:two-sides exponential) |
tau2 |
variance of dispersion of system noise. |
bv |
shape parameter of system noise (for noisev=2). |
noisew |
type of observation noise density. (1:Gaussian (normal), 2:Pearson family, 3:two-sided exponential, 4:double exponential) |
sig2 |
variance of dispersion of observation noise. |
bw |
shape parameter of observation noise (for noisew=2). |
initd |
type of density function. (0:two-sided exponential, 1:Gaussian (normal), 2:uniform) |
k |
number of intervals |
plot |
logical. If TRUE (default) trend and smoothed density are plotted. |
Consider a one dimensional state space model
x(n) = x(n-1) + v(n),
y(n) = x(n) + w(n),
where the observation noise w(n) is assumed to be Gaussian distributed and the system noise v(n) is assumed to be distributed as the Pearson system
q(v(n)) = c/(tau^2 + v(n)^2)^b
with 1/2 < b < infty and c = tau^{2b-1}Γ(b) / Γ(1/2)Γ(b - 1/2).
This broad family of distributions includes the Cauchy distribution (b=1).
trend |
trend. |
smt |
smoothed density. |
lkhood |
log-likelihood. |
Kitagawa, G., (1993) Time series analysis programing (in Japanese). The Iwanami Computer Science Senes.
Kitagawa, G. and Gersch, W., (1996) Smoothness Priors Analysis of Time Series. Lecture Notes in Statistics, No.116, Springer-Verlag.
# trend model x <- rep(0,400) x[101:200] <- 1 x[201:300] <- -1 y <- rnorm(600, mean=0, sd=0.5) y <- y[101:500] z1 <- ngsmth(x+y, noisev=2, tau2=0.211e-09, bv=1, noisew=2, sig2=1.042, bw=1 ) z2 <- ngsmth(x+y, noisev=1, tau2=0.14e-01, bv=1, noisew=2, sig2=1.048, bw=1 ) # an earthquake wave data data(MYE1F) n <- length(MYE1F) m <- n/2 y <- rep(0, n) for( i in 2:n ) y[i] <- MYE1F[i] - 0.5*MYE1F[i-1] yy <- rep(0, m) for( i in 1:m ) yy[i] <- y[i*2] z <- tvvar(yy, trend.order=2, tau20= 6.6e-06, delta=1.0e-06, plot=FALSE) z1 <- ngsmth( z$ts, noisev=2, tau2=0.00026, bv=1, noisew=2, sig2=1.644934, bw=1, k=190 ) z2 <- ngsmth( z$ts, noisev=1, tau2=0.04909, bv=1, noisew=2, sig2=1.644934, bw=1, k=190 )