fdr.spatial {OLIN} R Documentation

## 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 `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.

### 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` (bar{M}) within a symmetrical spot's neighbourhood. An empirical distribution of median/mean of `M` is generated based `N` random permutations of the spot locations on the array. The randomisation and calculation of median/mean of `M` is repeated `N` times. Comparing this empirical distribution of median/mean of `M` with the observed distribution of median/mean of `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 `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 `M` larger than chosen threshold c for the empirical distribution, `s` is the number of neighbourhoods with (median/mean of `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 `M` can be determined.

### Value

A list of vectors containing the false discovery rates for positive (`FDRp`) and negative (`FDRn`) deviations of median/mean of `M` of the spot's neighbourhood is produced.

### Author(s)

Matthias E. Futschik (http://itb.biologie.hu-berlin.de/~futschik)

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

### Examples

```
# To run these examples, "un-comment" them!
#
# 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")
#