R: Interpolate missing values in a time series

na.interp {forecast} | R Documentation

## Interpolate missing values in a time series

### Description

Uses linear interpolation for non-seasonal series. For seasonal series, a robust STL decomposition is used. A linear interpolation is applied to the seasonally adjusted data, and then the seasonal component is added back.

### Usage

    na.interp(x, lambda = NULL)

### Arguments

`x` | time series
`lambda` | Box-Cox transformation parameter. If `lambda="auto"`, then a transformation is automatically selected using `BoxCox.lambda`. The transformation is ignored if NULL. Otherwise, data transformed before model is estimated.

### Details

A more general and flexible approach is available using `na.approx` in the `zoo` package.

### Value

Time series

### Author(s)

Rob J Hyndman

### See Also

`tsoutliers`

### Examples

    data(gold)
    plot(na.interp(gold))

[Package forecast version 8.4 Index]