karlin: Karlin [p-value] [iid]

View source: R/RcppExports.R

karlinR Documentation

Karlin [p-value] [iid]

Description

karlin Calculates an approximated p-value of a given local score value and a long sequence length in the identically and independently distributed model for the sequence. See also mcc function for another approximated method in the i.i.d. model that improved the one given by karlin or daudin for exact calculation.
karlin_parameters is a annex function returning the parameters \lambda, K^+ and K^* defined in Karlin and Dembo (1992).

Usage

karlin(
  local_score,
  sequence_length,
  score_probabilities,
  sequence_min,
  sequence_max
)

karlin_parameters(score_probabilities, sequence_min, sequence_max)

Arguments

local_score

the observed local score

sequence_length

length of the sequence (at least several hundreds)

score_probabilities

the probabilities for each unique score from lowest to greatest

sequence_min

minimum score

sequence_max

maximum score

Details

This method works the better the longer the sequence is. Important note : the calculus of the parameter of the distribution uses the resolution of a polynome which is a function of the score distribution, of order max(score)-min(score). There exists only empirical methods to solve a polynome of order greater that 5 with no warranty of reliable solution. The found roots are checked internally to the function and an error message is throw in case of inconsistent. In such case, you could try to change your score scheme (in case of discretization) or use the function karlinMonteCarlo . This function implements the formulae given in Karlin and Dembo (1992), page 115-6. As the score is discrete here (lattice score function), there is no limit distribution of the local score with the size of the sequence, but an inferior and a superior bound are given. The output of this function is conservative as it gives the upper bound for the p-value. Notice the lower bound can easily be found as it is the same call of function with parameter value local_score+1.

Value

A double representing the probability of a local score as high as the one given as argument

See Also

mcc, daudin, karlinMonteCarlo, monteCarlo

Examples

karlin(150, 10000, c(0.08, 0.32, 0.08, 0.00, 0.08, 0.00, 0.00, 0.08, 0.02, 0.32, 0.02), -5, 5)

localScore documentation built on April 3, 2025, 5:26 p.m.