Description Usage Arguments Details Value Author(s) References See Also Examples
Time series preprocessing for subsequent regression modeling. Based on a (seasonal) time series, a data frame with the response, seasonal terms, a trend term, (seasonal) autoregressive terms, and covariates is computed. This can subsequently be employed in regression models.
1 2 3 |
data |
A time series of class |
order |
numeric. Order of the harmonic term, defaulting to |
lag |
numeric. Orders of the autoregressive term, by default omitted. |
slag |
numeric. Orders of the seasonal autoregressive term, by default omitted. |
na.action |
function for handling |
stl |
character. Prior to all other preprocessing, STL (season-trend decomposition
via LOESS smoothing) can be employed for trend-adjustment and/or season-adjustment.
The |
To facilitate (linear) regression models of time series data, bfastpp
facilitates
preprocessing and setting up regressor terms. It returns a data.frame
containing the
first column of the data
as the response
while further columns (if any) are
used as covariates xreg
. Additionally, a linear trend, seasonal dummies, harmonic
seasonal terms, and (seasonal) autoregressive terms are provided.
Optionally, each column of data
can be seasonally adjusted and/or trend-adjusted via
STL (season-trend decomposition via LOESS smoothing) prior to preprocessing. The idea would
be to capture season and/or trend nonparametrically prior to regression modelling.
bfastpp
returns a "data.frame"
with the following variables (some of which may be matrices).
time |
numeric vector of time stamps, |
response |
response vector (first column of |
trend |
linear time trend (running from 1 to number of observations), |
season |
factor indicating season period, |
harmon |
harmonic seasonal terms (of specified |
lag |
autoregressive terms (or orders |
slag |
seasonal autoregressive terms (or orders |
xreg |
covariate regressor (all columns of |
Achim Zeileis
Verbesselt J, Zeileis A, Herold M (2011). Near Real-Time Disturbance Detection in Terrestrial Ecosystems Using Satellite Image Time Series: Drought Detection in Somalia. Working Paper 2011-18. Working Papers in Economics and Statistics, Research Platform Empirical and Experimental Economics, Universitaet Innsbruck. http://EconPapers.RePEc.org/RePEc:inn:wpaper:2011-18. Submitted to Remote Sensing and Environment.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## set up time series
library(zoo)
ndvi <- as.ts(zoo(cbind(a = som$NDVI.a, b = som$NDVI.b), som$Time))
ndvi <- window(ndvi, start = c(2006, 1), end = c(2009, 23))
## parametric season-trend model
d1 <- bfastpp(ndvi, order = 2)
d1lm <- lm(response ~ trend + harmon, data = d1)
summary(d1lm)
## autoregressive model (after nonparametric season-trend adjustment)
d2 <- bfastpp(ndvi, stl = "both", lag = 1:2)
d2lm <- lm(response ~ lag, data = d2)
summary(d2lm)
|
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Call:
lm(formula = response ~ trend + harmon, data = d1)
Residuals:
Min 1Q Median 3Q Max
-0.228691 -0.041100 -0.004046 0.055139 0.169111
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.145e-01 1.610e-02 25.748 < 2e-16 ***
trend -7.742e-05 3.024e-04 -0.256 0.798563
harmoncos1 7.279e-03 1.109e-02 0.657 0.513237
harmoncos2 3.868e-02 1.109e-02 3.488 0.000768 ***
harmonsin1 -3.747e-02 1.130e-02 -3.316 0.001337 **
harmonsin2 -1.041e-01 1.114e-02 -9.351 9.51e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.07517 on 86 degrees of freedom
Multiple R-squared: 0.5648, Adjusted R-squared: 0.5395
F-statistic: 22.32 on 5 and 86 DF, p-value: 2.8e-14
Call:
lm(formula = response ~ lag, data = d2)
Residuals:
Min 1Q Median 3Q Max
-0.153435 -0.030022 -0.001384 0.021004 0.214001
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.0003608 0.0060051 0.060 0.9522
lag1 0.2697747 0.1045785 2.580 0.0116 *
lag2 0.2204984 0.1045727 2.109 0.0379 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.05696 on 87 degrees of freedom
Multiple R-squared: 0.1626, Adjusted R-squared: 0.1433
F-statistic: 8.446 on 2 and 87 DF, p-value: 0.0004445
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.