# ngsmth

##### Non-Gaussian Smoothing

Trend estimation by non-Gaussian smoothing.

- Keywords
- ts

##### Usage

```
ngsmth(y, noisev = 2, tau2, bv = 1.0, noisew = 1, sigma2, bw = 1.0,
initd = 1, k = 200, plot = TRUE, …)
```

##### Arguments

- y
a univariate time series.

- noisev
type of system noise density.

1 : Gaussian (normal) 2 : Pearson family - 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 - sigma2
variance of dispersion of observation noise.

- bw
shape parameter of observation noise (for

`noisew`

= 2).- initd
type of density function.

1 : Gaussian (normal) 2 : uniform - k
number of intervals.

- plot
logical. If

`TRUE`

(default), '`trend`

' and '`smt`

' are plotted.- …
further arguments to be passed to

`plot.ngsmth`

.

##### Details

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 \(\frac{1}{2} < b < \infty\) and \(c = \tau^{2b-1}\Gamma(b) \bigm/ \Gamma(\frac{1}{2})\Gamma(b-\frac{1}{2})\).

This broad family of distributions includes the Cauchy distribution (\(b = 1\)) and \(t\)-distribution (\(b = (k+1)/2\)).

##### Value

An object of class `"ngsmth"`

. It contains the following components:

trend.

smoothed density.

##### References

Kitagawa, G. (2010)
*Introduction to Time Series Modeling*. Chapman & Hall/CRC.

Kitagawa, G. and Gersch, W. (1996)
*Smoothness Priors Analysis of Time Series*. Lecture Notes in Statistics,
No.116, Springer-Verlag.

##### Examples

```
# NOT RUN {
## trend model
x <- rep(0, 400)
x[101:200] <- 1
x[201:300] <- -1
y <- x + rnorm(400, mean = 0, sd = 1.0)
# system noise density : Gaussian (normal)
s1 <- ngsmth(y, noisev = 1, tau2 = 1.4e-02, noisew = 2, sigma2 = 1.048)
plot(s1, "smt", theta = 20, phi = 60, expand = 0.3)
# system noise density : Pearson family
s2 <- ngsmth(y, noisev = 2, tau2 = 2.11e-10, bv = 0.6, noisew = 2,
sigma2 = 1.042)
plot(s2, "smt", theta = 25, phi = 30, expand = 0.25)
## seismic data
data(MYE1F)
n <- length(MYE1F)
yy <- rep(0, n)
for (i in 2:n) yy[i] <- MYE1F[i] - 0.5 * MYE1F[i-1]
m <- seq(1, n, by = 2)
y <- yy[m]
z <- tvvar(y, trend.order = 2, tau2.ini = 4.909e-02, delta = 1.0e-06)
# system noise density : Gaussian (normal)
s3 <- ngsmth(z$sm, noisev = 1, tau2 = z$tau2, noisew = 2, sigma2 = pi*pi/6,
k = 190)
plot(s3, "smt", phi = 50, expand = 0.5, col = 8)
# }
```

*Documentation reproduced from package TSSS, version 1.2.3, License: GPL (>= 2)*