Reputation: 2036
I have a precision matrix of a multivariate gaussian distribution. I want to draw the graph of the variable from this precision matrix. So if the precision matrix is of size 100x100, I have 100 random variables. The non zero entries in the precision matrix means there is an edge between the two variables. If the entry is 0, it means there is no edge. How can I plot such a graph in matlab?
Upvotes: 0
Views: 514
Reputation: 49
If A is your "precision matrix", you can visualize its nonzero elements (called a sparsity pattern) with
spy(A)
This will produce an image of dots in a new figure window, one dot for each nonzero entry in A.
The precision matrix is an inverse of a covariance and its sparsity pattern can compactly represent the correlation structure among jointly random multivariate gaussians. A longer discussion can be found here: See NRH's comment on this thread--especially the link on partial correlations
Upvotes: 0
Reputation: 1623
It sounds like you've got an adjacency matrix (what you're calling a precision matrix).
And if so, there are some third party packages that will allow you to draw both directed and undirected graphs in MATLAB. Here's one from UBC. I think the function you'll want to use is drawNetwork(adj), where adj is your precision matrix.
Upvotes: 0