Learn R Programming

Shrinkage (version 1.0)

nlocfdr.est: LFDR based shrinkage estimator.

Description

Shrinkage estimator based on Efrons local false discovery rate (LFDR).

Usage

nlocfdr.est(x.stat = NULL, y.pvalue = NULL, pval.fun = t.test, arglis.pvalfun = list(), alternative = "greater", param = NULL, param0 = NULL, logx = TRUE, nulltype = 0, q.norm = T, ...)
nlocfdr.x(x = NULL, y = NULL, pval.fun = t.test, arglis.pvalfun = list(), alternative = "greater", param = NULL, param0 = NULL, logx = TRUE, nulltype = 0, q.norm = T, ...)
nlocfdr.stat(stat = NULL, pvalue = NULL, param = NULL, param0 = 0, nulltype = 0, q.norm = T, ...)

Arguments

x.stat
Input data matrix (features (rows) x samples (columns)) or numeric vector of statistics for the general function nlocfdr.est.
y.pvalue
Optional input data matrix or numeric vector of pvalues for the general function nlocfdr.est.
x
Input data matrix: features (rows) x samples (columns) for function nlocfdr.x. See examples.
y
Optional input data matrix for function nlocfdr.x.
stat
Input (numeric) vector of statistics for function nlocfdr.stat. Pvalues (pvalue) or statistics (stat) must be non null.
pvalue
Input (numeric) vector of pvalues for function nlocfdr.stat (see Note).
pval.fun
Function to compute p-values from the input data. Usually: "t.test", "wilcox.test", etc.
alternative
Argument for input function pval.fun, type of p-values to be computed: "less", "greater", "two-sided" (see stats R package).
arglis.pvalfun
Further arguments for the input function pval.fun (see stats R package).
param
Numeric vector as the parameter of interest (effect-size). If input param = NULL, it is internally computed from the input matrices x and y if they are given.
param0
Null value of the parameter of interest (i.e. log fold change corresponding to no change, usually 0). If input param0 = NULL, it is internally set.
logx
If logx = TRUE (and param = NULL and param0 = NULL), param is computed internally considering that input matrices x and y are logarithms, and param0 is set to 0.
nulltype
Parameter for selection of the type of null hypothesis distribution in Efrons method (package locfdr):
0:
theoretical null hypothesis distribution,

1-3:
empirical null hypothesis distribution (See function locfdr in locfdr package).

q.norm
If q.norm = TRUE, stat is internally computed from pvalue (see Note).
...
Further arguments to pass to function locfdr (see package locfdr).

Value

A vector of length equal to the total number of features (i.e. proteins, genes,...).

References

Yanofsky, C. M., & Bickel, D. R. (2010). Validation of differential gene expression algorithms: Application comparing fold-change estimation to hypothesis testing. BMC Bioinformatics, 11, 63.

Montazeri, Z., Yanofsky, C. M., & Bickel, D. R. (2010). Shrinkage estimation of effect sizes as an alternative to hypothesis testing followed by estimation in high-dimensional biology: Applications to differential gene expression. Statistical Applications in Genetics and Molecular Biology, 9, 23.

See Also

Function and package locfdr.

Examples

Run this code
#simulate some data sets: matrices of log-abundance levels
nsam<-20        #number of individuals
nfeat<-40       #number of features (metabolites, genes,...)
diffs<-c(1:4)   #features with differential log-abundance levels
lfc<-5          #differential quantity

# create data sets:
x <- matrix(rnorm(nfeat*nsam), nrow = nfeat, ncol = nsam) #case
y <- matrix(rnorm(nfeat*nsam), nrow = nfeat, ncol = nsam) #control
x[diffs,] <- x[diffs,] + lfc

stat<-rnorm(nfeat) #a vector of statistics
stat[diffs]<-stat[diffs]+lfc

# shrinkage estimator ----------
z1 <- nlocfdr.stat(stat=stat,param=rowMeans(x))
z2 <- nlocfdr.x(x=x,y=y,pval.fun="wilcox.test",nulltype=1,df=3)      


Run the code above in your browser using DataLab