View source: R/mod_meanshift.R
fit_meanshift | R Documentation |
Fast implementation of meanshift model
fit_meanshift(x, tau, distribution = "norm", ...)
fit_meanshift_norm(x, tau, ...)
fit_meanshift_lnorm(x, tau, ...)
fit_meanshift_norm_ar1(x, tau, ...)
x |
A time series |
tau |
a set of indices representing a changepoint set |
distribution |
A character indicating the distribution of the data. Should match R distribution function naming conventions (e.g., "norm" for the Normal distribution, etc.) |
... |
arguments passed to |
fit_meanshift_norm()
returns the same model as fit_lmshift()
with the
deg_poly
argument set to 0.
However, it is faster on large changepoint sets.
fit_meanshift_lnorm()
fit the meanshift model with the assumption of
log-normally distributed data.
fit_meanshift_norm_ar1()
applies autoregressive errors.
A mod_cpt object.
Xueheng Shi, Ben Baumer
Other model-fitting:
fit_lmshift()
,
fit_meanvar()
,
fit_nhpp()
,
model_args()
,
model_name()
,
new_fun_cpt()
,
whomademe()
# Manually specify a changepoint set
tau <- c(365, 826)
# Fit the model
mod <- fit_meanshift_norm_ar1(DataCPSim, tau)
# View model parameters
logLik(mod)
deg_free(mod)
# Manually specify a changepoint set
cpts <- c(1700, 1739, 1988)
ids <- time2tau(cpts, as_year(time(CET)))
# Fit the model
mod <- fit_meanshift_norm(CET, tau = ids)
# Review model parameters
glance(mod)
# Fit an autoregressive model
mod <- fit_meanshift_norm_ar1(CET, tau = ids)
# Review model parameters
glance(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.