trend | R Documentation |
Estimates the trend (polynomial or lowess) of a time series and returns a graphic of the series with the trend and error bounds superimposed.
trend(series, order = 1, lowess = FALSE, lowspan = .75, robust = TRUE,
col = c(4, 6), ylab = NULL, ci=TRUE, ...)
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. |
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.
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
.
D.S. Stoffer
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/.
detrend
## Not run:
par(mfrow=2:1)
trend(soi)
trend(soi, lowess=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.