simulation_Ic {BioTIP} | R Documentation

## Calculating random Index of Critical transition (Ic scores) for randomly-selectd genes

### Description

Simulating Ic scores for `x` randomly selected samples, where x should be the same as the length of identified critical-transition signal (CTS) (e.g., number of genes) and `B` is self-defined running times.

### Usage

    simulation_Ic(
      obs.x,
      sampleL,
      counts,
      B = 1000,
      fun = c("cor", "BioTIP"),
      shrink = TRUE,
      use = c("everything", "all.obs", "complete.obs", "na.or.complete",
        "pairwise.complete.obs"),
      output = c("Ic", "PCCg", "PCCs")
    )

### Arguments

`obs.x` | An integer, length of identified CTS.
`sampleL` | A list of vectors, whose length is the number of states. Each vector gives the sample names in a state. Note that the vector s (sample names) has to be among the column names of the R object 'df'.
`counts` | A numeric matrix or dataframe in which columns are samples and rows are transcripts. Each row needs to have a unique row name (i.e. transcript ID).
`B` | An integer, setting the permutation with `B` runs. Default is 1000.
`fun` | An optional character string indicating the R functon to calculate correlations for all possible pairs of columns of a matrix. When using "BioTIP", The method is modified to ignore missing values, analogous to how `cor(X, use = "pairwise.complete.obs")` works. Note that the "BioTIP" option only function together with shrink = TRUE.
`shrink` | A flag specifying whether to shrink the correlation or not. This appraoch uses the method outlined by Schafer and Strimmer in "A Shrinkage Approach to Large-Scale Covariance Matrix Estimation and Implications for Functional Genomics" (2005) Comparing to fun='cor', the 'BioTIP' method without shinkage is modified to ignore missing values, analogous to how `cor(X, use = "pairwise.complete.obs")` works.
`use` | An optional character string, when fun=="cor", it gives a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs".
`output` | A string. Please select from 'Ic', 'PCCg', or 'PCCs'. Uses 'Ic' by default. 'PCCg' is the PCC between genes (numerator) and 'PCCs' is PCC between samples (denominator)

### Value

A matrix of `y` rows and `B` columns where `y` is the length of `sampleL` and `B` is self-defined. Each column is a set of Ic scores calculated for each state

### Author(s)

Zhezhen Wang zhezhen@uchicago.edu

### Examples

    counts = matrix(sample(1:100, 27), 3, 9)
    colnames(counts) = 1:9
    row.names(counts) = c('loci1', 'loci2', 'loci3')
    cli = cbind(1:9, rep(c('state1', 'state2', 'state3'), each = 3))
    colnames(cli) = c('samples', 'group')
    samplesL <- split(cli[, 1], f = cli[, 'group'])
    simulation_Ic(2, samplesL, counts, B =3, fun="BioTIP", shrink=TRUE)

[Package BioTIP version 1.8.0 Index]