truth | R Documentation |
Returns the proportion of zero correctly or incorrectly found in each colum of the loadings matrix Z.
truth(Ztrue, Z, method = "correct")
Ztrue |
the true sparse loadings matrix. |
Z |
the obtained sparse loading matrix. |
method |
either "correct" or "incorrect". |
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.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.