logLik.breakpoints: Log Likelihood and Information Criteria for Breakpoints

Description Usage Arguments Details Value References See Also Examples

View source: R/breakpoints.R

Description

Computation of log likelihood and AIC type information criteria for partitions given by breakpoints.

Usage

1
2
3
4
5
6
7
8
## S3 method for class 'breakpointsfull'
logLik(object, breaks = NULL, ...)
## S3 method for class 'breakpointsfull'
AIC(object, breaks = NULL, ..., k = 2)
## S3 method for class 'breakpointsfull'
LWZ(object, ...)
## S3 method for class 'breakpoints'
LWZ(object, ...)

Arguments

object

an object of class "breakpoints" or "breakpointsfull".

breaks

if object is of class "breakpointsfull" the number of breaks can be specified.

...

for LWZ, parameters passed to AIC.breakpointsfull. Unused in logLik and AIC.

k

the penalty parameter to be used, the default k = 2 is the classical AIC, k = log(n) gives the BIC, k = 0.299 * log(n)^2.1 gives the LWZ, if n is the number of observations.

Details

As for linear models the log likelihood is computed on a normal model and the degrees of freedom are the number of regression coefficients multiplied by the number of segments plus the number of estimated breakpoints plus 1 for the error variance.

If AIC or LWZ is applied to an object of class "breakpointsfull" breaks can be a vector of integers and the AIC or LWZ for each corresponding partition will be returned. By default the maximal number of breaks stored in the object is used. See below for an example.

Value

An object of class "logLik" or a simple vector containing the AIC respectively.

References

Liu, J., Wu, S., & Zidek, J. V. (1997). On segmented multivariate regression. Statistica Sinica, 497-525.

See Also

breakpoints

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Nile data with one breakpoint: the annual flows drop in 1898
## because the first Ashwan dam was built
data("Nile")
plot(Nile)

bp.nile <- breakpoints(Nile ~ 1)
summary(bp.nile)
plot(bp.nile)

## BIC of partitions with 0 to 5 breakpoints
plot(0:5, AIC(bp.nile, k = log(bp.nile$nobs)), type = "b")
## AIC
plot(0:5, AIC(bp.nile), type = "b")
## LWZ
plot(0:5, LWZ(bp.nile), type = "b")

## BIC, AIC, LWZ, log likelihood of a single partition
bp.nile1 <- breakpoints(bp.nile, breaks = 1)
AIC(bp.nile1, k = log(bp.nile1$nobs))
AIC(bp.nile1)
LWZ(bp.nile1)
logLik(bp.nile1)

appelmar/strucchange documentation built on Nov. 27, 2021, 8:55 a.m.