Learn R Programming

not (version 1.6)

logLik.not: Extract likelihood from a 'not' object

Description

Calculates the Gaussian log-likelihood for the signal estimated using predict.not with the change-points at cpt. The type of the signal depends on on the value of contrast that has been passed to not (see predict.not).

Usage

# S3 method for not
logLik(object, cpt, ...)

Arguments

object

An object of class 'not', returned by not.

cpt

An integer vector with locations of the change-points. If missing, the features is called internally to extract the change-points from object.

...

Further parameters that can be passed to predict.not and features.

Examples

Run this code
#' # **** Piecewisce-constant mean with Gaussian noise.
x <- c(rep(0, 100), rep(1,100)) + rnorm(100)
# *** identify potential locations of the change-points
w <- not(x, contrast = "pcwsConstMean")
# *** log-likelihood for the model with the change-point estimated  via 'not'
logLik(w)
# *** log-likelihood for the model with the change-point at 100
logLik(w, cpt=100)

Run the code above in your browser using DataLab