social network analysis in r

23
Social Network Analysis in R

Upload: francis-frye

Post on 02-Jan-2016

58 views

Category:

Documents


1 download

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 Presentation

TRANSCRIPT

Page 1: Social Network Analysis in R

Social Network Analysis in R

Page 2: 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

Page 3: Social Network Analysis in R

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

Page 4: Social Network Analysis in R

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

Page 5: Social Network Analysis in R

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

Page 6: Social Network Analysis in R

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

Page 7: Social Network Analysis in R

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

Page 8: Social Network Analysis in R

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

Page 9: Social Network Analysis in R

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

Page 10: Social Network Analysis in R

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

Page 11: Social Network Analysis in R

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”

Page 12: Social Network Analysis in R

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

 

Page 13: Social Network Analysis in R

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

Page 14: Social Network Analysis in R

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

 

Page 15: Social Network Analysis in R

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

Page 16: Social Network Analysis in R

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

Page 17: Social Network Analysis in R

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

 

Page 18: Social Network Analysis in R

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}

Page 19: Social Network Analysis in R

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}

Page 20: Social Network Analysis in R

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

Page 21: Social Network Analysis in R

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

Page 22: Social Network Analysis in R

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

Page 23: Social Network Analysis in R

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