The function calculates breakpoints for time series and provides plots of the analysis results
plot_breakpoints(
dataset,
formula,
alpha = 0.05,
line.col = "chocolate",
ci.col = c(
rgb(0, 0, 255, maxColorValue = 255, alpha = 0.5),
rgb(0, 255, 0, maxColorValue = 255, alpha = 0.5),
rgb(255, 0, 0, maxColorValue = 255, alpha = 0.5)
),
legend.show = TRUE,
legend.pos = c(
"topright",
"topright",
"topright",
"topright"
),
xlab = "Time",
ylab = "Y",
ylim = NULL,
plot.main = c(
"Breakpoints",
"Segment model fits",
"BIC and Residual Sum of Squares",
"Model without breaks (one segment)"
),
output.full = TRUE,
separate_plots = FALSE,
...
)data.frame with one row for each model segment with coefficients, \(R^2\), etc.
data.frame object with (infections) time series
formula object for linear regression formula
Significance level \(\alpha\) for 1-\(\alpha\)*100 confidence intervals
Line color in time series plot
Colors for confidence intervals in 3 plots
bool: Show legend?
Position of legend
Label of x axis
Label of y axis
Limits of y axis
Titles for 4 plots
bool: All 4 plots or just one (breakpoints)?
bool: All 4 plots in one or separate?
Further arguments passed to breakpoints()
Thomas Wieland
The function uses the breakpoints() function from the strucchange package (Zeileis et al. 2003) to estimate breaks in time series given by the user. These breakpoints are visualized, confidence intervals and model diagnostics are calculated, and for \(M\) breakpoints, \(M+1\) models are estimated and returned.
Wieland T (2020) A phenomenological approach to assessing the effectiveness of COVID-19 related nonpharmaceutical interventions in Germany. Safety Science 131, 104924. tools:::Rd_expr_doi("https://doi.org/10.1016/j.ssci.2020.104924")
Zeileis A, Kleiber C, Krämer W, Hornik K (2003) Testing and dating of structural changes in practice. Computational Statistics & Data Analysis 44(1-2) 109–123. tools:::Rd_expr_doi("https://doi.org/10.1016/S0167-9473(03)00030-6")
logistic_growth, exponential_growth
data(Infections)
# Confirmed SARS-CoV-2 cases in Germany
plot_breakpoints(
Infections,
log(infections_daily) ~ day,
output.full = TRUE
)
# Breakpoints for time series
Run the code above in your browser using DataLab