pub fn duplicate_correlation(
y: &[f64],
n_genes: usize,
n_samples: usize,
design: &[f64],
n_coef: usize,
block: &[usize],
weights: Option<&Recycled<f64>>,
trim: f64,
) -> Result<f64, EdgeErrors>Expand description
Consensus intra-block correlation, limma’s duplicateCorrelation.
Fits y_g = X beta_g + Z u_g + e_g for each gene, with u_g a random block
effect, and reports tanh of the trimmed mean of the Fisher z-transformed
per-gene correlations sigma_block^2 / (sigma_block^2 + sigma_e^2).
Fits y_g = X beta_g + Z u_g + e_g per gene with u_g a random block
effect, and reports tanh of the trimmed mean of the Fisher z-transformed
per-gene correlations sigma_block^2 / (sigma_block^2 + sigma_e^2).
Returns exactly zero, as limma does, when every block has a single member or the block factor already lies in the column space of the design.
A gene contributes only with more than n_coef + 2 observations, more than
one block and fewer blocks than n_obs - 1; others are dropped from the
trimmed mean, not counted as zero.
edgePython replaces the per-gene mixed model with a one-way ANOVA moment
estimator and drops several of limma’s admission rules. This follows limma.
See UPSTREAM_DEVIATIONS.md A14.
§Params
y- Row-majorn_genes * n_sampleslog-expression valuesn_genes- Number of genesn_samples- Number of samplesdesign- Row-majorn_samples * n_coefdesign matrixn_coef- Number of design columnsblock- Block label per sample; only equality of labels mattersweights- Optional gene by sample observation weights. Non-positive or non-finite weights mark the observation missing, as limma does.trim- Fraction trimmed from each tail of the z-transformed correlations, in[0, 0.5). limma’s default is 0.15.
§Returns
The consensus correlation, or EdgeErrors on a shape mismatch, an
out-of-range trim, or when no gene yielded a correlation at all.
§References
Smyth, Michaud and Scott, Bioinformatics 21:2067-2075, 2005