https://github.com/cran/forecast
Raw File
Tip revision: 878f06ca38ae78337c242c034bc814eb38df9be9 authored by Rob Hyndman on 27 February 2023, 21:02:28 UTC
version 8.21
Tip revision: 878f06c
na.interp.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/clean.R
\name{na.interp}
\alias{na.interp}
\title{Interpolate missing values in a time series}
\usage{
na.interp(
  x,
  lambda = NULL,
  linear = (frequency(x) <= 1 | sum(!is.na(x)) <= 2 * frequency(x))
)
}
\arguments{
\item{x}{time series}

\item{lambda}{Box-Cox transformation parameter. If \code{lambda="auto"},
then a transformation is automatically selected using \code{BoxCox.lambda}.
The transformation is ignored if NULL. Otherwise,
data transformed before model is estimated.}

\item{linear}{Should a linear interpolation be used.}
}
\value{
Time series
}
\description{
By default, uses linear interpolation for non-seasonal series. For seasonal series, a
robust STL decomposition is first computed. Then a linear interpolation is applied to the
seasonally adjusted data, and the seasonal component is added back.
}
\details{
A more general and flexible approach is available using \code{na.approx} in
the \code{zoo} package.
}
\examples{

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

}
\seealso{
\code{\link[forecast]{tsoutliers}}
}
\author{
Rob J Hyndman
}
\keyword{ts}
back to top