Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/NeighborOmega.R
Generate precision matrix of nearest-neighbor network following the set-up in Li and Gui (2006) and Lee and Liu (2006).
1 | NeighborOmega(p, sd = 1, knn = 4, norm.type = 2)
|
p |
dimension of generated precision matrix. |
sd |
seed for random number generation. Default is 1. |
knn |
sparsity of precision matrix, i.e., matrix is generated from a |
norm.type |
normalization methods of generated precision matrix, i.e., Ω_{11}=1 if norm.type = 1 and ||Ω||_F =1 if norm.type = 2. Default value is 2. |
For a knn
nearest-neighbor graph, this function first randomly picks p points from a
unit square and computes all pairwise distances among the points. Then it searches for the knn nearest-neighbors
of each point and a pair of symmetric entries in the precision matrix that has a random chosen value from [-1, -0.5] U [0.5, 1]. Finally, to
ensure positive definite property, it normalizes the matrix as Ω <- Ω + (λ (Ω)+0.2) 1_p where
λ (.) refers to the samllest eigenvalue.
A precision matrix generated from the knn
nearest-neighor graph.
Xiang Lyu, Will Wei Sun, Zhaoran Wang, Han Liu, Jian Yang, Guang Cheng.
1 2 3 4 5 6 7 8 9 10 | m.vec = c(5,5,5) # dimensionality of a tensor
n = 5 # sample size
knn=4 # sparsity
Omega.true.list = list()
for ( k in 1:length(m.vec)){
Omega.true.list[[k]] = NeighborOmega(m.vec[k],knn=4, sd=k*100,norm.type=2)
}
Omega.true.list # a list of length 3 contains precision matrices from 4-nearnest neighbor graph
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.