monteCarlo_double {localScore} | R Documentation |
Monte Carlo method for real score case [p-value]
Description
Calculates an empirical p-value based on simulations of similar sequences of the same length. Perfect for small sequences (both markov chains and identically and independantly distributed) with length ~ 10^3. Function dedicated for real score case.
Usage
monteCarlo_double(local_score, FUN, ..., plot = TRUE, numSim = 1000)
Arguments
local_score |
local score observed in a segment. |
FUN |
function to simulate similar sequences with. |
... |
parameters for FUN |
plot |
Boolean value if to display plots for cumulated function and density |
numSim |
number of sequences to generate during simulation |
Value
Floating value corresponding to the probability to obtain a local score with value greater or equal to the parameter
Examples
score_reels=c(-1,-0.5,0,0.5,1)
proba_score_reels=c(0.2,0.3,0.1,0.2,0.2)
sample_from_model <- function(score.sple,proba.sple, length.sple){sample(score.sple,
size=length.sple, prob=proba.sple, replace=TRUE)}
monteCarlo_double(5.5,FUN=sample_from_model, plot = TRUE,
score.sple=score_reels,proba.sple=proba_score_reels, length.sple=100, numSim = 1000)
[Package localScore version 1.0.11 Index]