Learn R Programming

OLIN (version 1.50.0)

fdr.spatial: Assessment of the significance of spatial bias

Description

This function assesses the significance of spatial bias by a one-sided random permutation test. This is achieved by comparing the observed average values of logged fold-changes within a spot's spatial neighbourhood with an empirical distribution generated by random permutation. The significance of spatial bias is given by the false discovery rate.

Usage

fdr.spatial(X,delta=2,N=100,av="median",edgeNA=FALSE)

Arguments

X
matrix of logged fold changes. For alternative input format, see fdr.spatial2.
delta
integer determining the size of spot neighbourhoods ((2*delta+1)x(2*delta+1)).
N
number of random permutations performed for generation of empirical background distribution
av
averaging of M within neighbourhood by mean or median (default)
edgeNA
treatment of edges of array: For edgeNA=TRUE, the significance of a neighbourhood (defined by a sliding window) is set to NA, if the neighbourhood extends over the edges of the matrix.

Value

FDRp) and negative (FDRn) deviations of $median/mean of \code{M}$ of the spot's neighbourhood is produced.

Details

The function fdr.spatial assesses the significance of spatial bias using a one-sided random permutation test. The null hypothesis states random spotting i.e. the independence of log ratio M and spot location. First, a neighbourhood of a spot is defined by a two dimensional square window of chosen size ((2*delta+1)x(2*delta+1)). Next, a test statistic is defined by calculating the median or mean of M within a symmetrical spot's neighbourhood. An empirical distribution of $median/mean of \code{M}$ is generated based N random permutations of the spot locations on the array. The randomisation and calculation of $median/mean of \code{M}$ is repeated N times. Comparing this empirical distribution of $median/mean of \code{M}$ with the observed distribution of $median/mean of \code{M}$, the independence of M and spot location can be assessed. If M is independent of spot's location, the empirical distribution can be expected to be distributed around its mean value. To assess the significance of observing positive deviations of $median/mean of \code{M}$, the false discovery rate (FDR) is used. It indicates the expected proportion of false discoveries among rejected null hypotheses. It is defined as $FDR=q*T/s$, where q is the fraction of $median/mean of \code{M}$ larger than chosen threshold c for the empirical distribution, s is the number of neighbourhoods with $(median/mean of \code{M})> c$ for the distribution derived from the original data and T is the total number of neighbourhoods on the array. FDRs equal zero are set to $FDR=1/T*N$. Varying threshold c determines the FDR for each spot neighbourhood. Correspondingly, the significance of observing negative deviations of $median/mean of \code{M}$ can be determined.

See Also

p.spatial, fdr.int, sigxy.plot, fdr.spatial2

Examples

Run this code

# To run these examples, delete the comment signs before the commands.
#
# LOADING DATA
# data(sw)
# M <- v2m(maM(sw)[,1],Ngc=maNgc(sw),Ngr=maNgr(sw),
#                Nsc=maNsc(sw),Nsr=maNsr(sw),main="MXY plot of SW-array 1")
#
# CALCULATION OF SIGNIFICANCE OF SPOT NEIGHBOURHOODS
# For this illustration, N was chosen rather small. For "real" analysis, it should be larger.
# FDR <- fdr.spatial(M,delta=2,N=10,av="median",edgeNA=TRUE)
# sigxy.plot(FDR$FDRp,FDR$FDRn,color.lim=c(-5,5),main="FDR")
#
# LOADING NORMALISED DATA
# data(sw.olin)
# M<- v2m(maM(sw.olin)[,1],Ngc=maNgc(sw.olin),Ngr=maNgr(sw.olin),
#                Nsc=maNsc(sw.olin),Nsr=maNsr(sw.olin),main="MXY plot of SW-array 1")
#
# CALCULATION OF SIGNIFICANCE OF SPOT NEIGHBOURHOODS
# FDR <- fdr.spatial(M,delta=2,N=10,av="median",edgeNA=TRUE)
# VISUALISATION OF RESULTS
# sigxy.plot(FDR$FDRp,FDR$FDRn,color.lim=c(-5,5),main="FDR")

Run the code above in your browser using DataLab