infer.analysis: Inference Performance Measures

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/infer.analysis.R

Description

False positive, false negative, discoveries, and non-discoveries of inference for sparse tensor graphical models.

Usage

1
infer.analysis(mat.list, critical, Omega.true.list, offdiag = TRUE)

Arguments

mat.list

list of matrices. (i,j) entry in its kth element is test statistic value for (i,j) entry of kth true precision matrix.

critical

critical level of rejecting null hypothesis. If critical is not positive, all null hypothesis will not be rejected.

Omega.true.list

list of true precision matrices of tensor, i.e., Omega.true.list[[k]] is true precision matrix for the kth tensor mode, 1 <= k <= K .

offdiag

logical; indicate if excludes diagnoal when computing performance measures. If offdiag = TRUE, diagnoal in each matrix is ingored when comparing two matrices. Default is TRUE.

Details

This function computes performance measures of inference for sparse tensor graphical models. False positive, false negative, discovery (number of rejected null hypothesis), non-discovery (number of non-rejected null hypothesis), and total non-zero entries of each true precision matrix is listed in output.

Value

A list, named Out, of following performance measures:

Out$fp vector; number of false positive of each mode
Out$fn vector; number of false negative of each mode
Out$d vector; number of all discovery of each mode
Out$nd vector; number of all non-discovery of each mode
Out$t vector; number of all true non-zero entries in true precision matrix of each mode

Author(s)

Xiang Lyu, Will Wei Sun, Zhaoran Wang, Han Liu, Jian Yang, Guang Cheng.

See Also

Tlasso.fit, est.analysis, ChainOmega

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
m.vec = c(5,5,5)  # dimensionality of a tensor 
n = 5   # sample size 
Omega.true.list = list()
Omega.true.list[[1]] = ChainOmega(m.vec[1], sd = 1)
Omega.true.list[[2]] = ChainOmega(m.vec[2], sd = 2)
Omega.true.list[[3]] = ChainOmega(m.vec[3], sd = 3)
lambda.thm = 20*c( sqrt(log(m.vec[1])/(n*prod(m.vec))), 
                   sqrt(log(m.vec[2])/(n*prod(m.vec))), 
                   sqrt(log(m.vec[3])/(n*prod(m.vec))))
DATA=Trnorm(n,m.vec,type='Chain') 
# obersavations from tensor normal distribution
out.tlasso = Tlasso.fit(DATA,T=1,lambda.vec = lambda.thm)   
# output is a list of estimation of precision matrices
mat.list=list()
for ( k in 1:3) {
  rho=covres(DATA, out.tlasso, k = k) 
  # sample covariance of residuals, including diagnoal 
  varpi2=varcor(DATA, out.tlasso, k = k)
  # variance correction term for kth mode's sample covariance of residuals
  bias_rho=biascor(rho,out.tlasso,k=k)
  # bias corrected 
  
  tautest=matrix(0,m.vec[k],m.vec[k])
  for( i in 1:(m.vec[k]-1)) {
    for ( j in (i+1):m.vec[k]){
      tautest[j,i]=tautest[i,j]=sqrt((n-1)*prod(m.vec[-k]))*
        bias_rho[i,j]/sqrt(varpi2*rho[i,i]*rho[j,j])
    }
  }
  # list of matrices of test statistic values (off-diagnoal). See Sun et al. 2016
  mat.list[[k]]=tautest
}

infer.analysis(mat.list, qnorm(0.975), Omega.true.list, offdiag=TRUE)
# inference measures (off-diagnoal) 

Tlasso documentation built on Feb. 1, 2022, 9:07 a.m.