ks_dist: Kolmogorov-Smirnov distance function

View source: R/ks_dist.R

ks_distR Documentation

Kolmogorov-Smirnov distance function

Description

A function to calculate the Kolmogorov-Smirnov distance. It is used in estimate_parameters_ks to estimate the parameter that minimize the distance in the optim function from the stats library.

Usage

ks_dist(theta, ecdf)

Arguments

theta

A vector. with two elements. The two Kimura parameters h0 and b.

ecdf

A vector containing 10000 values from the empirical cumulative distribution function of the input heteroplasmy data vector. To be used in the optim function in estimate_parameters_ks.

Value

The maximum distance from the theoretical Kimura distribution.

Examples

h=rnorm(20,0.5,0.1)
ecdf_h <- (stats::ecdf(h))(seq(0, 1, 1e-04))
ks_dist(c(0.5,0.95),ecdf_h)

kostasgian21/heteroplasmy documentation built on Jan. 30, 2024, 12:30 a.m.