getIc.new: Index of criticality Scoring System with estimated...

View source: R/BioTIP_update_04202022.R

getIc.newR Documentation

Index of criticality Scoring System with estimated correlation, an updated Ic-score

Description

This function calculates the BioTIP score on a given data matrix X (or two matrixes X and Y). It can also calculate the I_c score, if desired.

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)

This approach is modified to ignore missing values, analogous to how cor(X, use = "pairwise.complete.obs") works.

The gene-gene correlations are shrunk towards 0, whereas the sample-sample correlations are shrunk towards their empirical average.

Usage

getIc.new(
  X,
  method = c("BioTIP", "Ic"),
  PCC_sample.target = c("average", "zero", "half"),
  output = c("IndexScore", "PCCg", "PCCs")
)

Arguments

X

A G x S matrix of counts. Rows correspond to genes, columns correspond to samples.

method

A flag specifying whether to calculate the BioTIP score or the I_c score

PCC_sample.target

A character choose among ('average', 'zero', 'half'), indicating whether to shrink PCC towards towards their empirical common average, zero or 0.5 (for sample-sample correlations).

output

A string. Please select from 'IndexScore', 'PCCg', or 'PCCs'. Uses 'IndexScore' by default. 'PCCg' is the PCC between genes (numerator) and 'PCCs' is PCC between samples (denominator).

Value

A value containing the shrunk BioTIP or non-shrunk I_c score

Author(s)

Andrew Goldstein andrewgoldstein@uchicago.edu

Examples

## Generating a data X as coming from a multivariate normal distribution 
## with 10 highly correlated variables, roughly simulating correlated genes.
M = matrix(.9, nrow = 10, ncol = 10)
diag(M) = 1
mu = rnorm(10)
X = MASS::mvrnorm(1000, mu, M)
dim(X)  #1000 10  

## Calculating pairwise correlation between 1000 genes; then the mean value
## in two ways, respectively
cor_tX = cor(t(X))
mean(abs(cor_tX[upper.tri(cor_tX, diag = FALSE)])) # 0.9150228

getIc.new(X, method = "Ic", output ='PCCg') # 0.9150228
getIc.new(X, method = "BioTIP", output ='PCCg') # 0.8287838

## Uisng the Index of critical scoreing system, in two ways, respectively 
(newscore = getIc.new(X, method = "BioTIP"))
(oldscore = getIc.new(X, method = "Ic"))


xyang2uchicago/BioTIP documentation built on June 30, 2024, 10:14 p.m.