fit_meanshift(x, tau, distribution ="norm",...)fit_meanshift_norm(x, tau,...)fit_meanshift_lnorm(x, tau,...)fit_meanshift_norm_ar1(x, tau,...)
Arguments
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 stats::lm()
Returns
A mod_cpt object.
Details
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.
# Manually specify a changepoint settau <- c(365,826)# Fit the modelmod <- fit_meanshift_norm_ar1(DataCPSim, tau)# View model parameterslogLik(mod)deg_free(mod)# Manually specify a changepoint setcpts <- c(1700,1739,1988)ids <- time2tau(cpts, as_year(time(CET)))# Fit the modelmod <- fit_meanshift_norm(CET, tau = ids)# Review model parametersglance(mod)# Fit an autoregressive modelmod <- fit_meanshift_norm_ar1(CET, tau = ids)# Review model parametersglance(mod)
See Also
Other model-fitting: fit_lmshift(), fit_meanvar(), fit_nhpp(), model_args(), model_name(), new_fun_cpt(), whomademe()