vlo: vlo

Description Usage Arguments Value Author(s) Examples

View source: R/functions.R

Description

Return co-ordinates of L-regions using 'oracle' method in which PDFs of ZP,ZQ|HP0 and ZP,ZQ are known

Usage

1
2
vlo(p, q, f0, f, indices = NULL, at = NULL, nt = 5000, nv = 1000,
  scale = c("p", "z"), closed = T)

Arguments

p

principal p-values

q

conditional p-values

f0

PDF of ZP,ZQ|HP0. Function of two variables. Can also be CDF if oracle cFDR is wanted instead of cfdr.

f

PDF of ZP,ZQ. Function of two variables. Can also be CDF if oracle cFDR is wanted instead of cfdr.

indices

instead of at cfdr cutoffs, compute v(L) at indices of points. Overrides parameter at if set.

at

cfdr cutoff/cutoffs. Defaults to null

nt

number of test points in x-direction, default 5000

nv

resolution for constructing L-curves, default 1000

scale

return curves on the p- or z- plane. Y values are equally spaced on the z-plane.

closed

determines whether curves are closed polygons encircling regions L (closed=T), or lines indicating the rightmost border of regions L

Value

list containing elements x, y. Assuming n curves are calculated (where n=length(indices) or length(at)) and closed=T, x is a matrix of dimension n x (4+nv), y ix a vector of length (4+nv).

Author(s)

James Liley

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Generate standardised simulated dataset
set.seed(1); n=10000; n1p=100; n1pq=100; n1q=100
zp=c(rnorm(n1p,sd=3), rnorm(n1q,sd=1),rnorm(n1pq,sd=3), rnorm(n-n1p-n1q-n1pq,sd=1))
zq=c(rnorm(n1p,sd=1), rnorm(n1q,sd=3),rnorm(n1pq,sd=3), rnorm(n-n1p-n1q-n1pq,sd=1))
p=2*pnorm(-abs(zp)); q=2*pnorm(-abs(zq))
fold_id=(1:n) %% 3


# points to generate L-regions for
example_indices=c(4262, 268,83,8203)


v1=vlo(p,q,f0,f,indices=example_indices); 
plot(p,q,cex=0.5,col="gray",xlim=c(0,0.001),ylim=c(0,1), main="Oracle rejection regions"); 
for (i in 1:length(example_indices)) lines(v1$x[i,],v1$y); 
for (i in 1:length(example_indices)) points(p[example_indices[i]],q[example_indices[i]],qh=16,col="blue")

jamesliley/cfdr documentation built on July 31, 2020, 9:42 a.m.