p.spatial {OLIN} R Documentation

## Assessment of the significance of spatial bias based on p-values

### Description

This function assesses the significance of spatial bias. 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 permutation tests. The significance is given by (adjusted) p-values derived in one-sided permutation test.

### Usage

`p.spatial(X,delta=2,N=-1,av="median",p.adjust.method="none")`

### 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 samples for generation of empirical background distribution `av` averaging of `M` within neighbourhood by mean or median (default) `p.adjust.method` method for adjusting p-values due to multiple testing regime. The available methods are “none”, “bonferroni”, “holm”, “hochberg”, “hommel” and “fdr”. See also `p.adjust`.

### Details

The function `p.spatial` assesses the significance of spatial bias using an 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}) for `N` random samples of size ((2*delta+1)x(2*delta+1)). Note that this scheme defines a sampling with replacement procedure whereas sampling without replacement is used for `fdr.spatial`. Comparing the 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`, p-values are calculated using Fisher's method. The p-value equals the fraction of values in the empirical distribution which are larger than the observed value . The minimal p-value is set to `1/N`. Correspondingly, the significance of observing negative deviations of median/mean of `M` can be determined.

### Value

A list of vectors containing the p-values for positive (`Pp`) and negative (`Pn`) 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)

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

### 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.
# P <- p.spatial(M,delta=2,N=10000,av="median")
# sigxy.plot(P\$Pp,P\$Pn,color.lim=c(-5,5),main="FDR")