Learn R Programming

Shrinkage (version 1.0)

nhard.threshold.est: Hard-threshold estimators.

Description

Hard-threshold estimators based on the raw estimates of the log fold change and their p-values.

Usage

nhard.threshold.est(x, y = NULL, opt = c("fold.change","twer", "fwer", "lfdr", "lfdr0", "lfdr1"), alpha = 0.05, pval.fun = t.test, arglis.pvalfun = list(), alternative = "two.sided", ...)
nfc.threshold.est(x, y = NULL, threshold = 0.5, ...)

Arguments

x
Input data matrix: features(rows) x samples (columns). See examples.
y
Optional input data matrix.
opt
Option for selecting the type of estimator, it is a character:
"fold.change"
estimator based on the log of the raw estimated fold change (can use function nfc.threshold.est instead)

"twer"
estimator based on the raw p-value that controls test-wise error rate (TWER).

"fwer"
estimator based on the adjusted p-value that controls family-wise error rate (FWER) from multtest package.

"lfdr"
estimator based on the Efrons local false discovery rate (LFDR) from locfdr package.

alpha
Hard threshold value for the general function nhard.threshold.est.
threshold
Hard threshold value for function nfc.threshold.est.
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).
...
Arguments to pass to function mt.rawp2adjp (for opt = FWER), locfdr (for opt = LFDR) or to another internal function.

Value

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

References

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

multtest and locfdr packages.

Examples

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

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

# hard threshold estimator on fold change: ----------
z1 <- nhard.threshold.est(x=x,y=y,alpha=0.3,opt="fold.change")
z2 <- nfc.threshold.est(x=x,y=y,threshold=0.5)

# other options: -----
z4 <- nhard.threshold.est(x=x,y=y,pval.fun=t.test,opt="TWER")
z5 <- nhard.threshold.est(x=x,y=y,alpha=0.05,opt="FWER")     
z6 <- nhard.threshold.est(x=x,y=y,pval.fun=wilcox.test,opt="LFDR")

Run the code above in your browser using DataLab