log_lik_slope: Calculate the log-likelihood in the case of a continuous...

View source: R/Finalised_coding.R

log_lik_slopeR Documentation

Calculate the log-likelihood in the case of a continuous piecewise-linear mean signal

Description

This function calculates the Gaussian log-likelihood for the continuous piecewise-linear mean signal estimated using est_signal with the changepoints at cpt and for type = ``slope''.

Usage

log_lik_slope(x, cpt)

Arguments

x

A numeric vector containing the data.

cpt

A positive integer vector with the locations of the change-points. If missing, the ID function is called internally to detect any change-points that might be present in x.

Value

The Gaussian log-likelihood for the continuous piecewise-linear mean signal estimated using est_signal with the changepoints at cpt.

Author(s)

Andreas Anastasiou, anastasiou.andreas@ucy.ac.cy

Examples

single.cpt.plm <- c(seq(0, 999, 1), seq(998.5, 499, -0.5))
single.cpt.plm.noise <- single.cpt.plm + rnorm(2000)
cpt_detect <- ID(single.cpt.plm.noise, contrast = "slope")
loglik_cpt <- IDetect:::log_lik_slope(single.cpt.plm.noise, cpt_detect$cpt)

IDetect documentation built on May 7, 2026, 5:09 p.m.