truth: Proportion of correct or incorrect zero

View source: R/critEval.R

truthR Documentation

Proportion of correct or incorrect zero

Description

Returns the proportion of zero correctly or incorrectly found in each colum of the loadings matrix Z.

Usage

truth(Ztrue, Z, method = "correct")

Arguments

Ztrue

the true sparse loadings matrix.

Z

the obtained sparse loading matrix.

method

either "correct" or "incorrect".

Details

The proportion of zero correctly found is the true positive rate (tpr) i.e. the proportion of true zero put to zero in Z. The proportion of zero incorrectly found is the false positive rate (fpr) i.e. the proportion of zero in Z which are not true zero.

Examples

# Example from Shen & Huang 2008
 v1 <- c(1,1,1,1,0,0,0,0,0.9,0.9)
 v2 <- c(0,0,0,0,1,1,1,1,-0.3,0.3)
 Ztrue <- cbind(v1,v2)
 valp <- c(200,100,50,50,6,5,4,3,2,1)
 n <- 50
 A <- simuPCA(n,Ztrue,valp,seed=1)
 Z <- sparsePCA(A,2,c(0.5,0.5),block=1)$Z
 truth(Ztrue,Z) #tpr
 truth(Ztrue,Z,method="incorrect") #fpr

chavent/sparsePCA documentation built on Feb. 2, 2023, 1:12 p.m.