bfast01 {bfast}  R Documentation 
Checking for one major break in the time series
Description
A function to select a suitable model for the data by choosing either a model with 0 or with 1 breakpoint.
Usage
bfast01(
data,
formula = NULL,
test = "OLSMOSUM",
level = 0.05,
aggregate = all,
trim = NULL,
bandwidth = 0.15,
functional = "max",
order = 3,
lag = NULL,
slag = NULL,
na.action = na.omit,
reg = c("lm", "rlm"),
stl = "none",
sbins = 1
)
Arguments
data 
A time series of class 
formula 
formula for the regression model. The default is
intelligently guessed based on the arguments order/lag/slag i.e.

test 
character specifying the type of test(s) performed. Can be one
or more of BIC, supLM, supF, OLSMOSUM, ..., or any other test supported by

level 
numeric. Significance for the

aggregate 
function that aggregates a logical vector to a single
value. This is used for aggregating the individual test decisions from

trim 
numeric. The mimimal segment size passed to the 
bandwidth 
numeric scalar from interval (0,1), functional. The

functional 
arguments passed on to

order 
numeric. Order of the harmonic term, defaulting to 
lag 
numeric. Order of the autoregressive term, by default omitted. 
slag 
numeric. Order of the seasonal autoregressive term, by default omitted. 
na.action 
arguments passed on to 
reg 
whether to use OLS regression 
stl 
argument passed on to 
sbins 
argument passed on to 
Details
bfast01
tries to select a suitable model for the data by choosing
either a model with 0 or with 1 breakpoint. It proceeds in the following
steps:
The data is preprocessed with bfastpp using the arguments
order
/lag
/slag
/na.action
/stl
/sbins
.A linear model with the given formula is fitted. By default a suitable formula is guessed based on the preprocessing parameters.
The model with 1 breakpoint is estimated as well where the breakpoint is chosen to minimize the segmented residual sum of squares.
A sequence of tests for the null hypothesis of zero breaks is performed. Each test results in a decision for FALSE (no breaks) or TRUE (structural break(s)). The test decisions are then aggregated to a single decision (by default using all() but any() or some other function could also be used).
Available methods for the object returned include standard methods for linear models (coef, fitted, residuals, predict, AIC, BIC, logLik, deviance, nobs, model.matrix, model.frame), standard methods for breakpoints (breakpoints, breakdates), coercion to a zoo series with the decomposed components (as.zoo), and a plot method which plots such a zoo series along with the confidence interval (if the 1break model is visualized). All methods take a 'breaks' argument which can either be 0 or 1. By default the value chosen based on the 'test' decisions is used.
Note that the different tests supported have power for different types of alternatives. Some tests (such as supLM/supF or BIC) assess changes in all coefficients of the model while residualbased tests (e.g., OLSCUSUM or OLSMOSUM) assess changes in the conditional mean. See Zeileis (2005) for a unifying view.
Value
bfast01
returns a list of class "bfast01"
with the
following elements:
call 
the original function call. 
data 
the
data preprocessed by 
formula 
the model formulae. 
breaks 
the number of breaks chosen based on the 
test 
the individual test decisions. 
breakpoints 
the optimal breakpoint for the model with 1 break. 
model 
A list of two 'lm' objects with no and one breaks, respectively. 
Author(s)
Achim Zeileis, Jan Verbesselt
References
De Jong R, Verbesselt J, Zeileis A, Schaepman ME (2013). “Shifts in Global Vegetation Activity Trends.” Remote Sensing, 5(3), 1117–1133. ISSN 20724292, doi: 10.3390/rs5031117, https://doi.org/10.3390/rs5031117.
Zeileis A (2005). “A Unified Approach to Structural Change Tests Based on ML Scores, F Statistics, and OLS Residuals.” Econometric Reviews, 24(4), 445–466. ISSN 07474938, doi: 10.1080/07474930500406053, https://doi.org/10.1080/07474930500406053.
See Also
Examples
library(zoo)
## define a regular time series
ndvi < as.ts(zoo(som$NDVI.a, som$Time))
## fit variations
bf1 < bfast01(ndvi)
bf2 < bfast01(ndvi, test = c("BIC", "OLSMOSUM", "supLM"), aggregate = any)
bf3 < bfast01(ndvi, test = c("OLSMOSUM", "supLM"), aggregate = any, bandwidth = 0.11)
## inspect test decisions
bf1$test
bf1$breaks
bf2$test
bf2$breaks
bf3$test
bf3$breaks
## look at coefficients
coef(bf1)
coef(bf1, breaks = 0)
coef(bf1, breaks = 1)
## zoo series with all components
plot(as.zoo(ndvi))
plot(as.zoo(bf1, breaks = 1))
plot(as.zoo(bf2))
plot(as.zoo(bf3))
## leveraged by plot method
plot(bf1, regular = TRUE)
plot(bf2)
plot(bf2, plot.type = "multiple",
which = c("response", "trend", "season"), screens = c(1, 1, 2))
plot(bf3)