truth: proportion of correct or incorrect zero

Description Usage Arguments Details Examples

View source: R/critEval.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 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 July 2, 2017, 1:14 a.m.