-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M. Bostock co-occurrence matrix #64
Comments
This will be even easier since Elijah Meeks has made a reusable layout. If I did it, I would most likely try to squeeze into |
This would be a very worthy addition to networkD3. I can think of a number of uses, but in the finance context: think about default/non default of a bond (highly non-normal). Run a large monte-carlo analysis to generate outcomes. Plotting co-occurence of default of bonds within a portfolio helps visualize adjacency, which highlights risk factors/co-dependency in the portfolio. Just my two cents. I could certainly use something like this. |
@Cat1796 and @smartinsightsfromdata, I'll be adding this to
@Cat1796, I'd absolutely love to see a bond default co-occurence example. |
awesome! |
As I work through this, I have started to realize that an adjacency matrix really is just a subset of heatmap. In this case, we can just piggyback off of Here are some quick examples to help me think through the issue.
|
Hi @timelyportfolio, I am not very familiar with d3heatmap, but having a look at your examples, it seems to be roughly the same. Still, a plot of a bond default co-occurence (naive example below with 6 independent bonds), d3heatmap seem to display bonds that have low co-occurence close together, when what we what really is the opposite. A larger simulation with dependent bonds would lead to several clusters in the bostock co-occurence matrix. bonds_def_prob<-c(0.01,0.02,0.001,0.023,0.024,0.025)
nbbonds<-length(bondsdefprob)
nbsim<-10000
randomness<-matrix(runif(nbbonds*nbsim,0,1),ncol=nbbonds,nrow=nbsim,byrow=TRUE)
prob_matrix<-matrix(bonds_def_prob,nrow=nbsim,ncol=length(bonds_def_prob),byrow=TRUE)
defaults<-randomness<prob_matrix
co_oc<-t(defaults) %*% defaults
diag(co_oc)<-0 In any case, the animation of bostock above is way cooler than d3heatmap (which is very cool itself). Also, the concept of moving from ordering by name (no logic), concurrence (riskiness of bond), cluster (co-dependence) makes a huge amount of sense in the financial context. |
I just found this interesting post , where shiny and ggplot2 are used to represent co-occurrence examples. Unfortunately, while it is a good static representation of the concept, it is ... "static". Let me clarify where do I come from. Recently I've been working on using graph databases & graph visualisations to represent securities in a stock exchange. A lot of studies have been done on this, typically some years ago with relatively "old" style visualisations.
The picture below comes from the paper. I started to think how interesting it would be if there were different ways to analyse visually types of aggregation at this level, quickly comparing one to the other. Could I do this with ggplot2 as per the example above? Possibly, but I was looking for something that would be able to:
I recently asked @jcheng5 if d3heatmap was suitable to build the equivalent of Mike Bostock's Les Misérables Co-occurrence and as you can see in the post Joe reply was:
|
I just realized I never followed up with a quick prototype I built http://www.buildingwidgets.com/blog/2015/10/22/week-42-adjacency-matrix. |
Hello, I need to make https://bost.ocks.org/mike/miserables/ this from the co-occurrence matrix I have generated., Can you help?? |
Hello, I need to make https://bost.ocks.org/mike/miserables/ this from the co-occurrence matrix I have generated., Can you help?? |
Hello, I need to make https://bost.ocks.org/mike/miserables/ this from the co-occurrence matrix I have generated., Can you help?? |
I've seen this very elegant example of adjacency / co-occurrence matrix designed by M. Bostock. Very impressive.
http://bost.ocks.org/mike/miserables/
I wonder if there is anything similar already achievable with any htmlwidgets?
I see quite a bit of interesting applications...
The text was updated successfully, but these errors were encountered: