getCriticalN: countBug counts the frequency of the most commonly identified...

View source: R/montecarlo.R

getCriticalNR Documentation

countBug counts the frequency of the most commonly identified bug in a simulated signature. getCriticalN performs a Monte Carlo simulation to estimate the number of times the most frequent taxon is expected to be observed in a list of signatures

Description

countBug counts the frequency of the most commonly identified bug in a simulated signature. getCriticalN performs a Monte Carlo simulation to estimate the number of times the most frequent taxon is expected to be observed in a list of signatures

Usage

getCriticalN(relevant.sigs, siglengths, alpha = 0.05, nsim = 1000)

Arguments

relevant.sigs

a list of signatures that form the "background" from which taxa for simulated signatures will be drawn. These are used to estimate how frequently taxa occur

siglengths

The sizes of signatures found in a set of related studies. Simulated signatures will match these in number and size.

alpha

Probability at which a critical threshold will be calculated (default: 0.05)

nsim

Number of simulations (default: 1000)

Details

E.g. for alpha = 0.05, we expect only a 5

Value

The 1 - alpha quantile of Monte Carlo simulated values for the maximum number of times any taxon is identified.

Examples

full.dat <- bugsigdbr::importBugSigDB()
my.dat <- full.dat[full.dat$Curator == "Mst Afroza Parvin", ]
relevant.dat <- full.dat[full.dat$`Body site` %in% my.dat$`Body site`, ]
relevant.sigs <- bugsigdbr::getSignatures(my.dat)
my.sigs.increased <- relevant.sigs[grep("UP", names(relevant.sigs))]
(my.siglengths <- sapply(my.sigs.increased, length))
getCriticalN(relevant.sigs, my.siglengths)
# Compare to observed
frequencySigs(my.sigs.increased)

waldronlab/bugSigSimple documentation built on Feb. 1, 2024, 12:22 a.m.