robust.g.test {GeneTS} | R Documentation |
robust.g.test
calculates the p-value(s) for a robust
nonparametric version of Fisher's g-test (1929). Details
of this approach are described in Ahdesmaki et al. (2005), along with
an extensive discussion of its application to gene expression data.
g.statistic
computes the test statistic given a discrete
time series spectrum.
robust.spectrum
computes a robust rank-based estimate
of the periodogram/correlogram - see Ahdesmaki et al. (2005)
for details.
robust.g.test(y, index, perm = FALSE, x, noOfPermutations = 5000) g.statistic(y, index) robust.spectrum(x)
y |
the matrix consisting of the spectral estimates as column vectors |
x |
a matrix consisting of the time series as column
vectors. In robust.g.test only needed if
permutation tests are used |
index |
an index to the spectral
estimates that is to be used in the testing for periodicity.
If index is missing, the maximum component of the
spectral estimate is used in testing (regardless of the
frequency of this maximum) |
perm |
if perm is FALSE ,
a simulated distribution for the g-statistic is used.
If per perm is TRUE , permutation tests are
used to find the distribution of the g-statistic for each
time series separately. |
noOfPermutations |
number of permutations that are used for each time series (default = 5000) |
Application of robust.g.test
can be very computer intensive, especially
the production of the distribution of the test statistics may take a lot
of time. Therefore, this distribution (dependening on the length of
the time series) is stored in an external file to avoid recomputation
(see example below).
For the general idea behind the Fisher's g test also see
fisher.g.test
which implements an analytic approach for g-testing.
This is faster but not robust and also assumes Gaussian noise.
robust.g.test
returns a list of p-values, and g.statistic
the associated
test statistics. robust.spectrum
returns a matrix where the column vectors correspond
to the spectra corresponding to each time series.
Miika Ahdesmaki (miika.ahdesmaki@tut.fi).
Fisher, R.A. (1929). Tests of significance in harmonic analysis. Proc. Roy. Soc. A, 125, 54–59.
Ahdesmaki, M., Lahdesmaki, H., Peason, R., Huttunen, H., and Yli-Harja O. (2005). BMC Bioinformatics 6:117.
## Not run: # load GeneTS library library("GeneTS") # load data set data(caulobacter) # how many samples and and how many genes? dim(caulobacter) # robust, rank-based spectral estimator applied to first 5 genes spe5 <- robust.spectrum(caulobacter[,1:5]) # g statistics computed from the spectrum g.statistic(spe5) # robust p-values pval <- robust.g.test(spe5) # generates a file with the name "g_pop_length_11.txt" pval <- robust.g.test(spe5) # second call: much faster.. pval # delete the external file unlink("g_pop_length_11.txt") ## End(Not run)