Learn R Programming

localScore (version 2.0.3)

maxPartialSumd: Maximum of the partial sum [probability] [iid]

Description

Calculates the distribution of the maximum of the partial sum process for a given value in the identically and independently distributed model

Usage

maxPartialSumd(
  k,
  score_probabilities,
  sequence_min = NULL,
  sequence_max = NULL,
  score_values = NULL
)

Value

A double representing the probability of the maximum of the partial sum process equal to k

Arguments

k

value at which calculates the probability

score_probabilities

the probabilities for each score from lowest to greatest (Optionnaly with scores as names)

sequence_min

minimum score (optional if score_values OR names(score_probabilities) is defined)

sequence_max

maximum score (optional if score_values OR names(score_probabilities) is defined)

score_values

vector of integer score values, associated to score_probabilities (optional if sequence_min and sequence_max OR names(score_probabilities) are defined)

Details

Implement the formula (4) of the article Mercier, S., Cellier, D., & Charlot, D. (2003). An improved approximation for assessing the statistical significance of molecular sequence features. Journal of Applied Probability, 40(2), 427-441. doi:10.1239/jap/1053003554
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 inconsistency.

Examples

Run this code
maxPartialSumd(10, c(0.08, 0.32, 0.08, 0.00, 0.08, 0.00, 0.00, 0.08, 0.02, 0.32, 0.02), -6, 4)
prob <- c(0.08, 0.32, 0.08, 0.00, 0.08, 0.00, 0.00, 0.08, 0.02, 0.32, 0.02)
score_values <- which(prob != 0) - 7 # keep only non null probability scores
prob0 <- prob[prob != 0]             # and associated probability
p <- maxPartialSumd(10, prob, sequence_min = -6, sequence_max =  4)
p0 <- maxPartialSumd(10,prob0, score_values = score_values)
p == p0 # TRUE

Run the code above in your browser using DataLab