bfastlite {bfast}  R Documentation 
Detect multiple breaks in a time series
Description
A combination of bfastpp
and breakpoints
to do lightweight detection of multiple breaks in a time series
while also being able to deal with NA values by excluding them
via bfastpp
.
Usage
bfastlite(
data,
formula = response ~ trend + harmon,
order = 3,
breaks = "LWZ",
lag = NULL,
slag = NULL,
na.action = na.omit,
stl = c("none", "trend", "seasonal", "both"),
decomp = c("stl", "stlplus"),
sbins = 1,
...
)
bfast0n(
data,
formula = response ~ trend + harmon,
order = 3,
breaks = "LWZ",
lag = NULL,
slag = NULL,
na.action = na.omit,
stl = c("none", "trend", "seasonal", "both"),
decomp = c("stl", "stlplus"),
sbins = 1,
...
)
Arguments
data 
A time series of class 
formula 
a symbolic description for the model in which breakpoints will be estimated. 
order 
numeric. Order of the harmonic term, defaulting to 
breaks 
either a positive integer specifying the maximal number of breaks to be calculated,
or a string specifying the information criterion to use to automatically determine
the optimal number of breaks (see also 
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 (seasontrend
decomposition via LOESS smoothing) can be employed for trendadjustment
and/or seasonadjustment. The 
decomp 
"stlplus" or "stl": use the NAtolerant decomposition package or the reference package (which can make use of time series with 23 observations per year) 
sbins 
numeric. Controls the number of seasonal dummies. If integer > 1,
sets the number of seasonal dummies to use per year.
If <= 1, treated as a multiplier to the number of observations per year, i.e.

... 
Additional arguments to 
Value
An object of class bfastlite
, with two elements:
breakpoints 
output from 
data_pp 
preprocessed data as output by 
Author(s)
Dainius Masiliunas, Jan Verbesselt
Examples
plot(simts) # stl object containing simulated NDVI time series
datats < ts(rowSums(simts$time.series))
# sum of all the components (season,abrupt,remainder)
tsp(datats) < tsp(simts$time.series) # assign correct time series attributes
plot(datats)
# Detect breaks
bp = bfastlite(datats)
# Default method of estimating breakpoints
bp[["breakpoints"]][["breakpoints"]]
# Plot
plot(bp)
# Custom method of estimating number of breaks (request 2 breaks)
strucchangeRcpp::breakpoints(bp[["breakpoints"]], breaks = 2)
# Plot including magnitude based on RMSD for the cos1 component of harmonics
plot(bp, magstat = "RMSD", magcomp = "harmoncos1", breaks = 2)