add_divergence: Add a statistical divergence function.

Description Usage Arguments Details Examples

View source: R/divergences.R

Description

This function is used to specify a divergence function beyond the three already implemented ones.

Usage

1
add_divergence(name, divergence)

Arguments

name

A character string with the name of the divergence.

divergence

A function with arguments (pre_change_mean, pre_change_sd, post_change_mean, post_change_sd), that returns the measured divergence.

Details

After calling this function, your implemented divergence function can used in tpca by the argument divergence = name.

Examples

1
2
3
4
5
simple_divergence <- function(mu1, sigma1, mu2, sigma2) {
  (mu2 - mu1)^2 + sigma2^2 / sigma1^2
}
add_divergence('simple', simple_divergence)
tpca(generate_cov_mat(10), divergence = 'simple')

Tveten/tpca documentation built on June 10, 2021, 8:43 p.m.