Learn R Programming

RUVcorr (version 1.4.2)

findWeights: Finds weights of each level of a factor.

Description

findWeights returns a list of variances and weights based on the correlation between genes for each level of a factor found in the annotation. This function is typically used to find the weights of each individual in the data set.

Usage

findWeights(X, anno, Factor)

Arguments

X
A matrix of gene expression values.
anno
A dataframe or a matrix containing the annotation of arrays in X.
Factor
A character string corresponding to a column name of anno. For all levels of this factor corresponding weights will be calculated.

Value

  • findWeights returns output of the class Weights. An object of class Weights is a list with the following components:
    • Weights
    { A list containing the weights of each level of Factor.}
  • Inv.SigmaA list containing the inverse variances of each level of Factor.

Details

Note that because calculations of weights include finding correlations between all genes, this function might take some time. Hence, recalculation of weights is not advisable and should be avoided. However often the inverse variances can be used to calculate new weights. In particlular, when $W_i$ denotes the weight of the $i^{th}$ level and $V_i$ the variance as calculated from the gene-gene correlations: $$W_i=\frac{\frac{1}{V_i}}{\sum_{i=1}^{n}\frac{1}{V_i}}$$

Examples

Run this code
Y<-simulateGEdata(500, 500, 10, 2, 5, g=NULL, Sigma.eps=0.1,
250, 100, intercept=FALSE, check.input=FALSE)
anno<-as.matrix(sample(1:4, dim(Y$Y)[1], replace=TRUE))
colnames(anno)<-"Factor"
findWeights(Y$Y, anno, "Factor")

Run the code above in your browser using DataLab