na.StructTS | R Documentation |
Generic function for filling NA
values using seasonal Kalman filter.
na.StructTS(object, ...)
## S3 method for class 'ts'
na.StructTS(object, ..., na.rm = FALSE, maxgap = Inf)
## S3 method for class 'zoo'
na.StructTS(object, ..., na.rm = FALSE, maxgap = Inf)
object |
an object. |
... |
other arguments passed to methods. |
na.rm |
logical. Whether to remove end portions or fill them with NA. |
maxgap |
Runs of more than |
Interpolate with seasonal Kalman filter, using StructTS
,
followed by tsSmooth
. The input object should
be a regular time series and have a frequency. It is assumed the cycle length is 1.
StructTS
, tsSmooth
, na.approx
z <- zooreg(rep(10 * seq(8), each = 4) + rep(c(3, 1, 2, 4), times = 8),
start = as.yearqtr(2000), freq = 4)
z[25] <- NA
zout <- na.StructTS(z)
plot(cbind(z, zout), screen = 1, col = 1:2, type = c("l", "p"), pch = 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.