CPSS_control: Returns the graph with desired FDR/freq from a path of CPSS...

Description Usage Arguments Details Value Examples

View source: R/stability_function.R

Description

Returns the graph with desired FDR/freq from a path of CPSS estimates from CPSS_path().

Usage

1
CPSS_control(path, FDR = NULL, freq = NULL, B = 50)

Arguments

path

A list returned by CPSS_path

FDR

A number between 0 and 1, the desired FDR (false discovery rate); exactly one of FDR and freq must be NULL.

freq

A number between 0 and 1, the frequency threshold; exactly one of FDR and freq must be NULL.

B

An integer, number of pairs of subsamples to be drawn, should be equal to the B used when calling CPSS_path(). Defaults to 50.

Details

Returns the densest graph along the CPSS path that has FDR <= FDR or freq >= freq. If the resulting graph is empty, returns the sparsest non-empty graph. Fore more details, see Shah and Samworth (2012) and the documentation on CPSS_fit() and CPSS_path().

Note: The user is expected to call CPSS_fit(), followed by CPSS_path(), and then followed by CPSS_control().

Value

A list associated with the selected estimated DAG.

graph

The estimated adjacency matrix.

actual_fdr

The actual FDR controlled.

freq

The frequency threshold for the selected graph using 2*B CPSS estimates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
m <- 3; n <- 200; B <- 10
adj_mat <- ZiDAG::make_dag(m, mode = "chain")
d <- ZiDAG::gen_zero_dat(seed=1, gen_para="pms", adj_mat=adj_mat, n=n, gen_uniform_degree=1)
fitting_func <- function(indices) return (
    ZiDAG::ziGDS(V=d$V[indices,], Y=d$Y[indices,], parametrization="pms", verbose=FALSE,
    control=list("max_uniform_degree"=1L, "tol"=1e-8, "print_best_degree"=FALSE)))
freq_B <- ZiDAG::CPSS_fit(nrow(d$V), fitting_func, B=B, parallel=FALSE, num_cores=1)
cpss_path <- CPSS_path(freq_B, B = B)
CPSS_control(cpss_path, freq=0.5, B=B)
CPSS_control(cpss_path, FDR=0.2, B=B)

sqyu/ZiDAG documentation built on Jan. 19, 2021, 4:11 p.m.