Learn R Programming

blockcpd (version 1.0.0)

toy_regularization: Implements the regularization functions used in the estimation

Description

The estimator in this package computes the optimum of \(-l(C, p) + \lambda*R(leftIndex, rightIndex, nrow, ncol)\), where l is the log likelihood of the family, lambda is the penalization constant and R is the regularization function. The user can create his own regularization function and pass as an argument to fit_blockcpd. It should have four arguments, in the following order: left_index, right_index, nrow and ncol. Each argument is explained in the parameter section. If the function depends on leftIndex and rightIndex, it will be non-homogeneous, which might be interesting in some applications. The package implements some functions as an example, but uses only bic_loss as the default. The algorithm is consistent as long as the the regularization is bounded by a constant.

Usage

toy_regularization(left_index, right_index, nrow, ncol)

Arguments

left_index

First index of the interval

right_index

Last index of the interval

nrow

Number of rows/signals/series

ncol

Number of columns/variables

Examples

Run this code
my_reg <- function(leftIndex, rightIndex, nrow, ncol){
    block_size = (rightIndex - leftIndex + 1)
    return(log(nrow*ncol)*(1/block_size))
}

Run the code above in your browser using DataLab