Description Usage Arguments Value Examples
Checks whether it's probable that there is a changepoint in the unidimensional time series x. Currently only one changepoint is supported. The model works by investigating the hypothesis that there is a point in the time series at which the generating probability distribution shifts. These distributions are assumed to be gaussian with a mu1 and mu2. If mu1 and mu2 overlap completely there is no changepoint. The distribution of the location of the changepoint is in the "tau" parameter and is returned in the results as median.
1 2 | hasChangepoint(x, chains = 2, iter = 1000, allpars = FALSE,
cores = max(parallel::detectCores() - 1, 1), ...)
|
x |
the numeric vector representing the timeseries to investigate |
chains |
number of MCMC chains to run defualts to 2 |
iter |
number of samples to pull from MCMC defaults to 1000 |
allpars |
return all parameter samples from the changepoint model which defaults to FALSE and thus returns only the relevant ones for the decision |
cores |
the number of cores to use which defaults to max(parallel::detectCores()-1, 1) |
... |
other arguments passed to the sampling method in rstan |
a list of names results containing a tibble with overlap probabilities for mu and sigma as well as the samples for the relevant parameters of the model.
1 2 3 4 5 | ## Not run:
a <- hasChangepoint(c(rnorm(50, 100, 100), rnorm(50, 150, 100)))
print(a$results)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.