pcpt-class | R Documentation |
A class for within period changepoint objects.
Objects can be created by calls of the form new("pcpt", ...)
.
new("pcpt", ...)
:creates a new object with class pcpt
data.set
:Object of class "ts"
, a coerced time series of the original data.
periodlength
:Object of class "numeric"
, the period length of the data.
minseglen
:Object of class "numeric"
, the minimum segment length (no. of observations between changepoints) used in the analysis.
npcpts.max
:Object of class "numeric"
, maximum number of within period changepoints that can be identified.
distribution
:Object of class "character"
, the sampling distribution of the data being analysed.
nsegparam
:Object of class "numeric"
, the number of parameters for the sampling distribution per segment.
pcpt.prior
:Object of class "list"
, containing the within period changepoint prior details.
param.prior
:Object of class "numeric"
,vector containing the within period segment parameter prior details.
MCMC.options
:Object of class "list"
, containing algorithmic details to be supplied to the MCMC program.
MCMC.inits
:Object of class "list"
, containing the within period changepoint positions for initiating each chain.
MCMC.last
:Object of class "list"
, containing the last with period changepoint positions from each chain. Slot filled when asked to summarise chain output.
results
:Object of class "list"
, containing either the sampled MCMC chains (summarised slot = FALSE) or the table(s) summarising the samples (summarised slot = TRUE).
summarised
:Object of class "logical"
, flag indicating whether the results slot contains the summarise table of samples.
param.mode
:Object of class "matrix"
, most sampled within period changepoint vector from across all chains. (Nb, contains only one instance in the case of ties. See summmaised results for other modes.)
pcpt.mode
:Object of class "numeric"
, table containing the segment paramter mode estimates for the within period changepoint vector in the pcpt.mode slot.
fit
:Object of class "numeric"
, Estimates of 5 measures of fit (see fit() for further detials).
date
:Object of class "character"
, date and time the changepoint analysis was run.
version
:Object of class "character"
, version number of the package used when the analysis was run.
signature(object = "pcpt")
: retrieves the data.set slot
signature(object = "pcpt")
: retrieves the periodlength slot
signature(object = "pcpt")
: retrieves the minseglen slot
signature(object = "pcpt")
: retrieves the npcpts.max slot
signature(object = "pcpt")
: retrieves distribution slot
signature(object = "pcpt")
: retrieves pcpt.prior slot
signature(object = "pcpt")
: retrieves param.prior slot
signature(object = "pcpt")
: retrieves MCMC.options slot
signature(object = "pcpt")
: retrieves from the MCMC.options slot the n.chains
item.
signature(object = "pcpt")
: retrieves from the MCMC.options slot the n.iter
item.
signature(object = "pcpt")
: retrieves from the MCMC.options slot the n.burn
item.
signature(object = "pcpt")
: inverts the logical item quiet
in the MCMC.options slot.
signature(object = "pcpt")
: retrieves MCMC.inits slot
signature(object = "pcpt")
: retrieves results slot
signature(object = "pcpt", index = "numeric")
: retrieves from the results slot the contents corresponding to the index
-th chain.
signature(object = "pcpt")
: retrieves MCMC.last slot
signature(object = "pcpt")
: retrieves summarised slot
signature(object = "pcpt")
: retrieves summarised slot
signature(object = "pcpt")
: retrieves nsegparam slot
signature(object = "pcpt")
: retrieves pcpt.mode slot
signature(object = "pcpt")
: retrieves param.mode slot
signature(object = "pcpt")
: retrieves fit slot
signature(object = "pcpt")
: Calculates the within period segment lengths from the pcpt.mode slot
signature(object = "pcpt")
: Calculates the number of within period segments from the pcpt.mode slot
signature(object = "pcpt")
: Calculates the number of within period changepoints from the pcpt.mode slot
signature(x = "pcpt")
: prints details of the pcpt object including summary
signature(object = "pcpt")
: prints details of the pcpt object including summary
signature(object = "pcpt", ...)
: prints a summary of the pcpt object
signature(x = "pcpt", ...)
: quantile estimate for the segment parameters for each within period time step.
signature(x = "pcpt", ...)
: plots the pcpt object
Simon Taylor Rebecca Killick
data.set-methods
,PeriodCPT
showClass("pcpt") # shows the structure of the pcpt class
x = new("pcpt") # creates a new object with the pcpt class defaults
periodlength(x) # retrieves the periodlength slot from x
periodlength(x) <- 12 # replaces the periodlength slot from x with 12
# Example of a within period change in probability in simulated bernoulli data
set.seed(1)
x = ts(rbinom(n = 120, size = 1, rep( c(0.2,0.5), each = 6)), freq = 12)
ans = PeriodCPT(x, distribution = "bern", niter = 1e3)
print(ans) # prints details of the analysis including a summary
summary(ans)
##\/TODO\/
##########
##quantile(ans)
##plot(ans) # plots the data with change (vertical line) at 100
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.