Learn R Programming

stepR (version 2.1-10)

compareBlocks: Compare fit blockwise with ground truth

Description

Blockwise comparison of a fitted step function with a known ground truth using different criteria.

Usage

compareBlocks(truth, estimate, dist = 5e3)

Value

A data.frame, containing just one row if two single stepblock were given, with columns

true.num, est.num

the true / estimated number of blocks

true.pos, false.pos, false.neg, sens.rate, prec.rate

the number of true / false positive, false negatives, as well as the corresponding sensitivity and precision rates, where an estimated block is considered a true positive if it there is a corresponding block in the ground truth with both endpoints within dist of each other

fpsle

false positive sensitive localization error: for each estimated block's midpoint find into which true block it falls, and sum distances of the respective borders

fnsle

false negative sensitive localization error: for each true block's mid-point find into which estimated block it falls, and sum distances of the respective borders

total.le

total localization error: sum of fpsle and fnsle

Arguments

truth

an object of class stepblock giving the ground truth, or a list of such objects

estimate

corresponding estimated object(s) of class stepblock

dist

a single numeric specifying the distance for at which jumps will be considered as having matched in the qualitative criterion

References

Elhaik, E., Graur, D., Josić, K. (2010) Comparative testing of DNA segmentation algorithms using benchmark simulations. Molecular Biology and Evolution 27(5), 1015-24.

Futschik, A., Hotz, T., Munk, A. Sieling, H. (2014) Multiresolution DNA partitioning: statistical evidence for segments. Bioinformatics, 30(16), 2255--2262.

See Also

stepblock, stepfit, contMC

Examples

Run this code
# simulate two Gaussian hidden Markov models of length 1000 with 2 states each
# with identical transition rates being 0.01 and 0.05, resp, signal-to-noise ratio is 5
sim <- lapply(c(0.01, 0.05), function(rate)
  contMC(1e3, 0:1, matrix(c(0, rate, rate, 0), 2), param=1/5))
plot(sim[[1]]$data)
lines(sim[[1]]$cont, col="red")
# use smuceR to estimate fit
fit <- lapply(sim, function(s) smuceR(s$data$y, s$data$x))
lines(fit[[1]], col="blue")
# compare fit with (discretised) ground truth
compareBlocks(lapply(sim, function(s) s$discr), fit)

Run the code above in your browser using DataLab