p.spatial {OLIN} | R Documentation |
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.
p.spatial(X,delta=2,N=-1,av="median",p.adjust.method="none")
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 . |
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
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.
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.
Matthias E. Futschik (http://itb.biologie.hu-berlin.de/~futschik)
# To run these examples, "un-comment" them! # # 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. # P <- p.spatial(M,delta=2,N=10000,av="median") # sigxy.plot(P$Pp,P$Pn,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 # P <- p.spatial(M,delta=2,N=10000,av="median") # VISUALISATION OF RESULTS # sigxy.plot(P$Pp,P$Pn,color.lim=c(-5,5),main="FDR")