View source: R/InterpolateOutliers.R
InterpolateOutliers | R Documentation |
Interpolates Outliers setting them NaN and then applying spline interpolation
InterpolateOutliers(Time, Datavector, OutliersTime, option = "stine",
PlotIt = TRUE)
Time |
[1:n] vector of time, |
Datavector |
[1:n] numerical vector of data |
OutliersTime |
[1:k] vector of time of outliers, in the format of the Time values |
option |
see |
PlotIt |
Default: FALSE, TRUE: Evaluates output of function versus input by plots |
Assumption is that outliers should be ignore in timeseries analysis.
[1:n] interpolated vector of data
Michael Thrun
In case of missing data, e.g. NA values, see InterpolateMissingValues
instead
data(airquality)
ind = which(is.finite(airquality$Solar.R))
# Remove non finite values or alternatively, interpolate missing values:
# data = InterpolateMissingValues(dates, airquality$Solar.R)
date_strings = paste("1973", airquality$Month[ind], airquality$Day[ind], sep = "-")
dates = as.Date(date_strings)
data = airquality$Solar.R[ind]
res = WaveletOutlierDetection(data)
outliersInd = which(res!=0)
vals = InterpolateOutliers(dates,data,dates[outliersInd])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.