social network analysis in r
DESCRIPTION
Social Network Analysis in R. Enabled Analytics: The vision. What is Social Network Analysis?. A way of mapping and measuring relationships Can be applied to many types of networks Provides visual inspection, as well as mathematical analysis - PowerPoint PPT PresentationTRANSCRIPT
Social Network Analysis in R
2© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionWhat is Social Network Analysis?
• A way of mapping and measuring relationships
• Can be applied to many types of networks
• Provides visual inspection, as well as mathematical analysis
• A way to understand complex problems within a network of people or objects
3© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionObjectives
• To identify important entities/people within a given network
• To find people within a network that can influence other
people’s behavior
4© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionSocial Networks are Everywhere
5© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionSocial Networks are Everywhere
6© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionThe Mathematics: Graph Theory
7© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionSoftware
has many network analysis packages: igraph,
SNA, S.N.O.R.T., tnet
8© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionPitfalls
• Not a one person job
• The necessary computers are very expensive
• The most basic measurements are computationally
expensive
• Sampling is virtually impossible
• Data is not easy to obtain
• Data can be very large
9© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionEver Expanding Data
10© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionEver Expanding Data
11© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionMetrics
Mohamed Atta
Essid Sami Ben Khemais
Zacarias Moussaoui
Marwan Al-Shehhi
• Social Network Analysis metrics measure the importance of a particular node
• Measures of “center”
12© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionBetweeness Centrality
13© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionBetweeness Centrality
Zacarias Moussaoui
Mohamed Atta
Hani Hanjour
Betweeness
Atta .588
Khemais .252
Moussaoui .232
Alhamzi .154
Hanjour .126
Essid Sami Ben Khemais
Nawaf Alhamzi
14© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionCloseness Centrality
15© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionCloseness Centrality
• Special case: Graphs that are not connected
16© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionCloseness Centrality
Mohamed Atta
Ramzi Bin al-Shibh
Marwan Al-Shehhi
Nawaf Alhamzi
Hani Hanjour
Closeness
Atta .588
Al-Shehhi .466
Hanjour .445
Alhamzi .442
Al-Shibh .436
17© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionCustom Metrics
18© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionFirst Order Influence Centrality
first.order.influence<-function(g,vids,weight=NULL,nodeweight=NULL){ result<-vector('numeric',length(vids)) if(is.null(nodeweight)==F){ nweight<-sum(nodeweight) }else{ nweight<-vcount(g) } for(z in 1:length(vids)){ arcs<-incident(g,vids[z],'out') if(length(arcs)==0){ next } if(is.null(weight)==F){ if(is.numeric(weight)==F){ arcweights<-sum(get.edge.attribute(g,weight,arcs)) }else{ arcweights<-sum(weight[arcs]) } }else{ arcweights<-length(arcs) } result[z]<-arcweights/nweight } result}
19© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionSecond Order Influence Centrality
second.order.influence<-function(g,vids,weight=NULL,nodeweight=NULL){ result<-vector('numeric',length(vids)) if(is.null(nodeweight)==FALSE){ nweight<-sum(nodeweight,na.rm=TRUE) }else{ nweight<-vcount(g) } inner<-function(g1,vids2,weight1=weight,n2weight=nweight){ inr<-vector('numeric',length(vids2)) for(z in 1:length(vids2)){ arcs<-incident(g1,vids2[z],'out') if(length(arcs)==0){ next } if(is.null(weight1)==F){ if(is.numeric(weight1)==F){ arcweights<-sum(get.edge.attribute(g1,weight1,arcs)) }else{ arcweights<-sum(weight1[arcs]) } }else{ arcweights<-length(arcs) } inr[z]<-arcweights/n2weight } inr } for(i in 1:length(vids)){ hood<-neighbors(g,vids[i],'out') if(length(hood)==0){ next } result[i]<-sum(inner(g1=g,vids2=hood,weight1=weight,n2weight=nweight)) } result}
20© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionKPMG [Link] versus KSU
21© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionKPMG [Link] versus KSU
First-Order
Priestley .26
Bell .24
VanBrackle .24
Yanosky .17
DeMaio .14
Second-Order
VanBrackle 2.12
Bell 1.95
Priestley 1.95
Castle 1.41
DeMaio 1.41
22© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionReferences
• Ranking of Closeness Centrality for Large-Scale Social Networks, Kazuya Okamoto, Wei Chen, Xiang-Yang Li
• Krebs, Valdis. "Uncloaking Terrorist Networks" First Monday [Online], Volume 7 Number 4 (1 April 2002)
• Opsahl, T., Agneessens, F., Skvoretz, J., 2010. Node centrality in weighted networks: Generalizing degree and shortest paths. Social Networks 32 (3), 245-251
23© 2014 KPMG LLP, a Delaware limited liability partnership and the U.S. member firm of the KPMG network of independent member firms affiliated with KPMG International Cooperative ("KPMG International"), a Swiss entity. All rights reserved.
Enabled Analytics:The visionResources
• The igraph library http://igraph.sourceforge.net/
• www.orgnet.com
• S.N.A.P. http://snap.stanford.edu/snap/index.html