Learn R Programming

changepoint (version 0.3)

decision: Likelihood Ratio Decision Function

Description

Uses the function parameters to decide if a proposed changepoint is a true changepoint or due to random variability. Test is conducted using the user specified penalty.

Usage

decision(tau,null,alt,penalty="SIC",n=0,diffparam=1,value=0)

Arguments

tau
A numeric value or vector specifying the proposed changepoint location(s).
null
The value of the null likelihood to be used in the liklihood ratio calculation. If tau is a vector, so is null.
alt
The value of the alternative likelihood (at tau) to be used in the likelihood ratio calculation. If tau is a vector, so is alt.
penalty
Choice of "None", "SIC", "BIC", "AIC", "Hannan-Quinn", "Asymptotic" and "Manual" penalties. If Manual is specified, the manual penalty is contained in the value parameter.
n
The length of the original data, required to give sensible "no changepoint".
diffparam
The difference in the number of parameters in the null and alternative hypotheses, required for the SIC, BIC, AIC, Hanna-Quinn and possibly Manual penalties.
value
The value of the penalty when using the Manual or Asymptotic option. This can be a numeric value or text giving the formula to use. Available variables are, n=length of original data, null=null likelihood, alt=alternative likelihood, tau=proposed change

Value

  • A list is returned with two elements, cpt and pen.
  • cptIf tau is a single value then a single value is returned: Either the value of the true changepoint location or n (length of data) if no changepoint is found. If tau is a vector of length m then a vector of length m is returned:Each element is either the value of the true changepoint location or n (length of data) if no changepoint is found. The first element is for the first value of tau and the final element is for the final value of tau.
  • penThe numeric value of the penalty used for the test(s).

Details

This function is used to test whether tau is a true changepoint or not. This test uses the likelihood ratio as the test statistic and performs the test where the null hypothesis is no change point and the alternative hypothesis is a single changepoint at tau. The test is (null-alt)>=penalty, if TRUE then the changepoint is deemed a true changepoint, if FALSE then n (length of data) is returned.

In reality this function should not be used unless you are performing a changepoint test using output from other functions. This function is used in the "see also" functions that perform various changepoint tests, ideally these should be used.

References

SIC/BIC: Schwarz, G. (1978) Estimating the Dimension of a Model, The Annals of Statistics 6(2), 461--464

AIC: Akaike, H. (1974) A new look at the statistical model identification, Automatic Control, IEEE Transactions on 19(6), 716--723

Hannan-Quinn: Hannan, E. J. and B. G. Quinn (1979) The Determination of the Order of an Autoregression, Journal of the Royal Statistical Society, B 41, 190--195

See Also

cpt.mean,cpt.var,cpt.meanvar,single.mean.norm,single.var.norm,single.meanvar.norm,single.reg.norm

Examples

Run this code
# Example of finding a change
out=c(100,765.1905,435.6529) # tau, null, alt
decision(out[1],out[2],out[3],penalty="SIC",n=200,diffparam=1) # returns 100 as a true changepoint

# Example of no change found
out=c(53,-22.47768,-24.39894) # tau, null, alt
decision(out[1],out[2],out[3],penalty="Manual",n=200,diffparam=1,value="2*log(n)")

Run the code above in your browser using DataLab