nEffRatio: Effective Sample Size Ratio

View source: R/simulatePhyloPoissonLogNormal.R

nEffRatioR Documentation

Effective Sample Size Ratio

Description

Ratio between the tree sample size and the sample size of the equivalent problem with independent measures. A result larger than one indicates a problem that is made "easier" by the tree structure. Note that it strongly depends on the tip conditions (see examples).

Usage

nEffRatio(tree, id.condition, model, selection.strength)

Arguments

tree

A phylogenetic tree. If NULL, samples are assumed to be iid.

id.condition

A named vector giving the state of each tip (sample).

model

The trait evolution model. One of "BM" or "OU".

selection.strength

If model="OU", the selection strength parameter.

Value

The ratio of sample sizes.

Examples

set.seed(1289)
## Ballanced tree
ntips <- 2^5
tree <- ape::compute.brlen(ape::stree(ntips, "balanced"))
## Alt cond : nEff greater than 1
id_cond <- rep(rep(0:1, each = 2), ntips / 4)
names(id_cond) <- tree$tip.label
plot(tree); ape::tiplabels(pch = 21, col = id_cond, bg = id_cond)
compcodeR:::nEffRatio(tree, id_cond, "BM", 0)
## Bloc cond : nEff smaller than 1
id_cond <- rep(0:1, each = ntips / 2)
names(id_cond) <- tree$tip.label
plot(tree); ape::tiplabels(pch = 21, col = id_cond, bg = id_cond)
compcodeR:::nEffRatio(tree, id_cond, "BM", 0)


csoneson/compcodeR documentation built on Oct. 25, 2023, 1:28 a.m.