rain: Detection of rhythmic behavior in time series.

Description Usage Arguments Details Value Author(s) References Examples

View source: R/mainFunction.R

Description

rain detects rhythms in time-series using non parametric methods. It uses an extension of the rank test for Umbrella Alternatives (Mack & Wolfe, 1981), based on on the Jonckheere-Terpstra test, which tests whether sets of groups have a trend or not. The Umbrella method extends this to independent rising and falling sets.

Usage

1
2
3
rain(x, deltat, period, period.delta = 0, peak.border = c(0.3, 0.7),
  nr.series = 1, measure.sequence = NULL, method = "independent",
  na.rm = FALSE, adjp.method = "ABH", verbose = getOption("verbose"))

Arguments

x

numeric array, containing the data. One row per time point, one column per sample. If more than one replicate is done, see nr.series for formatting.

deltat

numeric: sampling interval.

period

numeric: Period to search for. The given period is mapped to the best matching number of measurements. A set of periods can be defined by period and period.delta.

period.delta

numeric: width of period interval. A interval of different period-length to evaluate is defined by period $-$ period.delta and period $+$ period.delta. In this interval all possible numbers of time points according to the deltat are tested.

peak.border

vector c(min,max): defines the different form of the peak. min and max have to be >0 and <1. The concrete interpretation depends on the chosen method (see Details). (default = c(0.3,0.7))

nr.series

numeric: Number of replicates of the whole time series. If using nr.series all series have to have the same length. These multiple time series contained in x must be organized timepoint by timepoint using the following format [r1t1, r2t1, r1t2, r2t2, ..., r1tn, r2tn] where ritj is the i'th repeat of the j'th time-point.

measure.sequence

numeric array: Numbers of replicates for each time point. By using 'measure.sequence', irregular time courses may be evaluated. A value of 0 is possible and handeled correctly. The array determines how many values are present for each time piont. The values are ordered in the same format as specified above. measure.sequence overwrites nr.series if both are set.

method

string ('independent', 'longitudinal'): identify the method to use (see Details).

na.rm

boolean: calculate individual statistics for time series containign NAs. The time series of a sample containing NAs is treated as if the time points with NA are not measured. Using this option increases calculation time.

adjp.method

string (see mt.rawp2adjp): select the method wich is used for the multiple testing correction for the different phases and periods and shapes tested

verbose

status output

Details

The method tests whether a the time course consists of alternating rising and falling slopes, repeated with a distinct period. The partitions of the rising part with respect to the whole period are given by peak.border = c(min, max). The value peak.shape specifies this partition in the best matching model. The phase is defined as the time point with the peak. There are two versions of umbrella:

independent

Multiple periods are interpreted as repeats of one period.

logitudinal

The whole time series remains unaffected. Partial slopes in the beginning and end of the time series are evaluated as shorter slopes. This method implicitly rejects underlying trends.This should be used only with longitudinal samples, hat may contain strong trends

Value

An array containing p-values and the description of the best matching model. Each row apply to a sample in x.

pVal

The p-Values

phase

The phase of the peak (see Details)

peak.shape

The shape of the curve depending on the method used (see Details)

period

The period length, same unit as deltat

Author(s)

Paul F. Thaben

References

Mack, G. A., & Wolfe, D. A. (1981). K-Sample Rank Tests for Umbrella Alternatives. Journal of the American Statistical Association, 76(373), 175–181.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# create a dataset with different noise levels
noise.levels <- c(1, 0.5, 0.2, 0.1, 0.05, 0.02)
period <- 15
testset <- apply(matrix(noise.levels, nrow = 1), 2, function(noise){
   timecourse = 1 + 0.4 * cos((1:30) / period * 2 * pi) +
   rnorm(30, 0, noise)
})


results <- rain(testset, period=15, deltat=1, method='independent')

plot(-log(results$pVal) ~ noise.levels)

## Not run: 
# testing a biological dataset
data(menetRNASeqMouseLiver)
menet.ossc <- rain(t( menetRNASeqMouseLiver ), deltat = 4, period = 24,
   nr.series = 2, peak.border = c(0.3, 0.7), verbose=TRUE)
require('lattice')

best <- order(results$pVal)[1:10]

xyplot(as.matrix(menetRNASeqMouseLiver
   [best, (0:5 * 2 + rep(c(1, 2), each = 6))])
 ~rep(0:11 * 4 + 2, each = 10) |rownames(menetRNASeqMouseLiver)[best],
 scales = list(y = list(relation = 'free')),
 layout = c(2, 5), type = 'b', pch = 16, xlab = 'time',
 ylab = 'expression value', cex.lab = 1)


## End(Not run)

Example output

Loading required package: gmp

Attaching package:gmpThe following objects are masked frompackage:base:

    %*%, apply, crossprod, matrix, tcrossprod

Loading required package: multtest
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:gmp:

    which.max, which.min

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


calculating distributions (30):***...........................
Done

Evaluating Datasets: 

  |                                    
  |                              |   0%
  |                                    
  |                              |   1%
  |                                    
  |                              |   2%
  |                                    
  |=                             |   2%
  |                                    
  |=                             |   3%
  |                                    
  |=                             |   4%
  |                                    
  |=                             |   5%
  |                                    
  |==                            |   5%
  |                                    
  |==                            |   6%
  |                                    
  |==                            |   7%
  |                                    
  |==                            |   8%
  |                                    
  |===                           |   8%
  |                                    
  |===                           |   9%
  |                                    
  |===                           |  10%
  |                                    
  |===                           |  11%
  |                                    
  |===                           |  12%
  |                                    
  |====                          |  12%
  |                                    
  |====                          |  13%
  |                                    
  |====                          |  14%
  |                                    
  |====                          |  15%
  |                                    
  |=====                         |  15%
  |                                    
  |=====                         |  16%
  |                                    
  |=====                         |  17%
  |                                    
  |=====                         |  18%
  |                                    
  |======                        |  18%
  |                                    
  |======                        |  19%
  |                                    
  |======                        |  20%
  |                                    
  |======                        |  21%
  |                                    
  |======                        |  22%
  |                                    
  |=======                       |  22%
  |                                    
  |=======                       |  23%
  |                                    
  |=======                       |  24%
  |                                    
  |=======                       |  25%
  |                                    
  |========                      |  25%
  |                                    
  |========                      |  26%
  |                                    
  |========                      |  27%
  |                                    
  |========                      |  28%
  |                                    
  |=========                     |  28%
  |                                    
  |=========                     |  29%
  |                                    
  |=========                     |  30%
  |                                    
  |=========                     |  31%
  |                                    
  |=========                     |  32%
  |                                    
  |==========                    |  32%
  |                                    
  |==========                    |  33%
  |                                    
  |==========                    |  34%
  |                                    
  |==========                    |  35%
  |                                    
  |===========                   |  35%
  |                                    
  |===========                   |  36%
  |                                    
  |===========                   |  37%
  |                                    
  |===========                   |  38%
  |                                    
  |============                  |  38%
  |                                    
  |============                  |  39%
  |                                    
  |============                  |  40%
  |                                    
  |============                  |  41%
  |                                    
  |============                  |  42%
  |                                    
  |=============                 |  42%
  |                                    
  |=============                 |  43%
  |                                    
  |=============                 |  44%
  |                                    
  |=============                 |  45%
  |                                    
  |==============                |  45%
  |                                    
  |==============                |  46%
  |                                    
  |==============                |  47%
  |                                    
  |==============                |  48%
  |                                    
  |===============               |  48%
  |                                    
  |===============               |  49%
  |                                    
  |===============               |  50%
  |                                    
  |===============               |  51%
  |                                    
  |===============               |  52%
  |                                    
  |================              |  52%
  |                                    
  |================              |  53%
  |                                    
  |================              |  54%
  |                                    
  |================              |  55%
  |                                    
  |=================             |  55%
  |                                    
  |=================             |  56%
  |                                    
  |=================             |  57%
  |                                    
  |=================             |  58%
  |                                    
  |==================            |  58%
  |                                    
  |==================            |  59%
  |                                    
  |==================            |  60%
  |                                    
  |==================            |  61%
  |                                    
  |==================            |  62%
  |                                    
  |===================           |  62%
  |                                    
  |===================           |  63%
  |                                    
  |===================           |  64%
  |                                    
  |===================           |  65%
  |                                    
  |====================          |  65%
  |                                    
  |====================          |  66%
  |                                    
  |====================          |  67%
  |                                    
  |====================          |  68%
  |                                    
  |=====================         |  68%
  |                                    
  |=====================         |  69%
  |                                    
  |=====================         |  70%
  |                                    
  |=====================         |  71%
  |                                    
  |=====================         |  72%
  |                                    
  |======================        |  72%
  |                                    
  |======================        |  73%
  |                                    
  |======================        |  74%
  |                                    
  |======================        |  75%
  |                                    
  |=======================       |  75%
  |                                    
  |=======================       |  76%
  |                                    
  |=======================       |  77%
  |                                    
  |=======================       |  78%
  |                                    
  |========================      |  78%
  |                                    
  |========================      |  79%
  |                                    
  |========================      |  80%
  |                                    
  |========================      |  81%
  |                                    
  |========================      |  82%
  |                                    
  |=========================     |  82%
  |                                    
  |=========================     |  83%
  |                                    
  |=========================     |  84%
  |                                    
  |=========================     |  85%
  |                                    
  |==========================    |  85%
  |                                    
  |==========================    |  86%
  |                                    
  |==========================    |  87%
  |                                    
  |==========================    |  88%
  |                                    
  |===========================   |  88%
  |                                    
  |===========================   |  89%
  |                                    
  |===========================   |  90%
  |                                    
  |===========================   |  91%
  |                                    
  |===========================   |  92%
  |                                    
  |============================  |  92%
  |                                    
  |============================  |  93%
  |                                    
  |============================  |  94%
  |                                    
  |============================  |  95%
  |                                    
  |============================= |  95%
  |                                    
  |============================= |  96%
  |                                    
  |============================= |  97%
  |                                    
  |============================= |  98%
  |                                    
  |==============================|  98%
  |                                    
  |==============================|  99%
  |                                    
  |==============================| 100%
Done

Loading required package: lattice

rain documentation built on Nov. 8, 2020, 6:56 p.m.