trend {astsa} | R Documentation |
Estimate Trend
Description
Estimates the trend (polynomial or lowess) of a time series and returns a graphic of the series with the trend and error bounds superimposed.
Usage
trend(series, order = 1, lowess = FALSE, lowspan = .75, robust = TRUE,
col = c(4, 6), ylab = NULL, ci=TRUE, ...)
Arguments
series |
The time series to be analyzed (univariate only). |
order |
Order of the polynomial used to estimate the trend with a linear default (order=1) unless |
lowess |
If TRUE, |
lowspan |
The smoother span used for lowess. |
robust |
If TRUE (default), the lowess fit is robust. |
col |
Vector of two colors for the graphic, first the color of the data (default is blue [4]) and second the color of the trend (default is magenta [6]). Both the data and trend line will be the same color if only one value is given. |
ylab |
Label for the vertical axis (default is the name of the series). |
ci |
If TRUE (default), pointwise 95 |
... |
Other graphical parameters. |
Details
Produces a graphic of the time series with the trend and a .95 pointwise confidence interval superimposed. The trend estimate and the error bounds are returned invisibly.
Value
Produces a graphic and returns the trend estimate fit
and error bounds lwr
and upr
invisibly
(see details) and with the same time series attributes as the input series
.
Author(s)
D.S. Stoffer
References
You can find demonstrations of astsa capabilities at FUN WITH ASTSA.
The most recent version of the package can be found at https://github.com/nickpoison/astsa/.
In addition, the News and ChangeLog files are at https://github.com/nickpoison/astsa/blob/master/NEWS.md.
The webpages for the texts and some help on using R for time series analysis can be found at https://nickpoison.github.io/.
See Also
Examples
## Not run:
par(mfrow=2:1)
trend(soi)
trend(soi, lowess=TRUE)
## End(Not run)