censored.fit: Fit Null Distribution To Censored Data by Maximum Likelihood

Description Usage Arguments Details Value See Also Examples

View source: R/censored.fit.R

Description

censored.fit fits a null distribution to censored data.

fndr.cutoff finds a suitable cutoff point based on the (approximate) false non-discovery rate (FNDR).

Usage

1
2
censored.fit(x, cutoff, statistic=c("normal", "correlation", "pvalue", "studentt"))
fndr.cutoff(x, statistic=c("normal", "correlation", "pvalue", "studentt"))

Arguments

x

vector of test statistics.

cutoff

truncation point (this may a single value or a vector).

statistic

type of statistic - normal, correlation, or student t.

Details

As null model truncated normal, truncated student t or a truncated correlation density is assumed. The truncation point is specified by the cutoff parameter. All data points whose absolute value are large than the cutoff point are ignored when fitting the truncated null model via maximum likelihood. The total number of data points is only used to estimate the fraction of null values eta0.

Value

censored.fit returns a matrix whose rows contain the estimated parameters and corresponding errors for each cutoff point.

fndr.cutoff returns a tentative cutoff point.

See Also

fdrtool.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# load "fdrtool" library
library("fdrtool")

# simulate normal data
sd.true = 2.232
n = 5000
z = rnorm(n, sd=sd.true)
censored.fit(z, c(2,3,5), statistic="normal")


# simulate contaminated mixture of correlation distribution
r = rcor0(700, kappa=10)
u1 = runif(200, min=-1, max=-0.7)
u2 = runif(200, min=0.7, max=1)
rc = c(r, u1, u2)

censored.fit(r, 0.7, statistic="correlation")
censored.fit(rc, 0.7, statistic="correlation")

# pvalue example
data(pvalues)
co = fndr.cutoff(pvalues, statistic="pvalue")
co
censored.fit(pvalues, cutoff=co, statistic="pvalue")

Example output

     cutoff N.cens      eta0     eta0.SE       sd      sd.SE
[1,]      2   3167 1.0000000 0.010789492 2.223472 0.17097623
[2,]      3   4105 0.9890670 0.006531240 2.185879 0.06795245
[3,]      5   4863 0.9955343 0.002363085 2.199912 0.02986764
     cutoff N.cens      eta0    eta0.SE   kappa  kappa.SE
[1,]    0.7    681 0.9855847 0.00622226 10.6381 0.6081641
     cutoff N.cens      eta0    eta0.SE   kappa  kappa.SE
[1,]    0.7    681 0.6271903 0.01483325 10.6381 0.6081641
   cutoff 
0.6767363 
        cutoff N.cens      eta0    eta0.SE
[1,] 0.6767363    569 0.4103924 0.01602273

fdrtool documentation built on Nov. 14, 2021, 1:07 a.m.