exact_mc | R Documentation |
Calculates the exact p-value for short numerical Markov chains. Memory usage and time computation can be too large for a high local score value and high score range (see details).
exact_mc(local_score, m, sequence_length, score_values = NULL, prob0 = NULL)
local_score |
Integer local score for which the p-value should be calculated |
m |
Transition matrix [matrix object]. Optionality, rownames can be corresponding score values. m should be a transition matrix of an ergodic Markov chain. |
sequence_length |
Length of the sequence |
score_values |
A integer vector of sequence score values (optional). If not set, the rownames of m are used if they are numeric and set. |
prob0 |
Vector of probability distribution of the first score of the sequence (optional). If not set, the stationnary distribution of m is used. |
This method computation needs to allocate a square matrix of size local_score^(range(score_values)). This matrix is then exponentiated to sequence_length.
A double representing the probability of a local score as high as the one given as argument
monteCarlo
mTransition <- matrix(c(0.2, 0.3, 0.5, 0.3, 0.4, 0.3, 0.2, 0.4, 0.4), byrow = TRUE, ncol = 3)
scoreValues <- -1:1
initialProb <- stationary_distribution(mTransition)
exact_mc(local_score = 12, m = mTransition, sequence_length = 100,
score_values = scoreValues, prob0 = initialProb)
exact_mc(local_score = 150, m = mTransition, sequence_length = 1000,
score_values = scoreValues, prob0 = initialProb)
rownames(mTransition) <- scoreValues
exact_mc(local_score = 12, m = mTransition, sequence_length = 100, prob0 = initialProb)
# Minimal specification
exact_mc(local_score = 12, m = mTransition, sequence_length = 100)
# Score valeus with "holes"
scoreValues <- c(-2, -1, 2)
mTransition <- matrix(c(0.2, 0.3, 0.5, 0.3, 0.4, 0.3, 0.2, 0.4, 0.4), byrow = TRUE, ncol = 3)
initialProb <- stationary_distribution(mTransition)
exact_mc(local_score = 50, m = mTransition, sequence_length = 100,
score_values = scoreValues, prob0 = initialProb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.