| plot_breakpoints | R Documentation |
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,
...
)
dataset |
|
formula |
|
alpha |
Significance level |
line.col |
Line color in time series plot |
ci.col |
Colors for confidence intervals in 3 plots |
legend.show |
|
legend.pos |
Position of legend |
xlab |
Label of x axis |
ylab |
Label of y axis |
ylim |
Limits of y axis |
plot.main |
Titles for 4 plots |
output.full |
|
separate_plots |
|
... |
Further arguments passed to breakpoints() |
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.
data.frame with one row for each model segment with coefficients, R^2, etc.
Thomas Wieland
Wieland T (2020) A phenomenological approach to assessing the effectiveness of COVID-19 related nonpharmaceutical interventions in Germany. Safety Science 131, 104924. \Sexpr[results=rd]{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. \Sexpr[results=rd]{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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.