spatialFDR | R Documentation |
Computed adjusted p-values for all hyperspheres, using a density-weighted version of the Benjamini-Hochberg method.
spatialFDR(x, pvalues, neighbors=50, bandwidth=NULL, num.threads=1)
x |
A numeric matrix of hypersphere coordinates, containing the median intensity of each marker (column) in each hypersphere (row). Alternatively, a CyData object containing median intensities for groups of cells, such as that produced by |
pvalues |
A numeric vector of p-values for each hypersphere. |
neighbors |
An integer scalar specifying the number of neighbors with which to compute the bandwidth. |
bandwidth |
A numeric scalar specifying the bandwidth for density estimation. |
num.threads |
Integer scalar specifying the number of threads to use. |
Consider the set of significant hyperspheres, distributed in some manner across the M-dimensional space (for M markers). The aim is to control the FDR across the subspaces containing significant hyperspheres. This is subtly different from controlling the FDR across the hypersphere themselves, which will skew the results for densely occupied subspaces.
Control of the spatial FDR is achieved by weighting the hyperspheres inversely proportional to their local densities. This downweights hyperspheres in dense subspaces while upweighting hyperspheres in sparse subspaces. The computed weights are then used as frequency weights in the Benjamini-Hochberg method, to control the FDR across subspaces.
The local density is calculated using a tricube kernel and the specified bandwidth
.
If unspecified, bandwidth
is set to the median of the distances to the neighbors
-closest neighbor for all hyperspheres.
This usually provides stable density estimates while maintaining sensitivity to fine-scale structure.
A numeric vector of adjusted p-values for all hyperspheres.
Aaron Lun
Lun ATL, Richard AC, Marioni JC (2017). Testing for differential abundance in mass cytometry data. Nat. Methods, 14, 7:707-709.
coords <- matrix(rgamma(10000, 2, 2), nrow=1000)
pvalues <- rbeta(nrow(coords), 1, 2)
out <- spatialFDR(coords, pvalues)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.