top of page
  • Twitter
  • LinkedIn
  • Facebook

The Barabasi-Albert Model for S&P500

  • gkonstantinov1111
  • 19. Juni 2025
  • 1 Min. Lesezeit

Aktualisiert: 23. Juni 2025

Gueorgui S. Konstantinov and Frank J. Fabozzi - Network Models in Finance: Expanding the Tools for Portfolio and Risk Management, John Wiley & Sons, 2025



Preferential Attatchment Models are among the most powerful models in Network theory. The following code in the R programming language helps to

generate a realistic S&P500 Index network for analytical purposes.

ba.model<-barabasi.game(502,power=1, out.dist=c(0.25,0.65,0.25,0.25), directed=FALSE,zero.appeal=1)



A<-as.matrix(ba.model)

colnames(A)<-t(SPX.Index.Members) # make a vector with the S&P500 Index members

ba.model<-graph_from_adjacency_matrix(A)


#

E(ba.model)$arrow.size<-0

V(ba.model)$size<-5

V(ba.model)[degree(ba.model)>mean(degree(ba.model))]$color="red"

plot(ba.model, vertex.label.cex=.3,vertex.size=degree(ba.model)/10,layout=layout_with_kk)




netz_spx<-sample_pa(501)

Aa<-as.matrix(netz_spx)

colnames(Aa)<-(SPX.Index.Members[2:502,])

netz_sp500<-graph_from_adjacency_matrix(Aa)

E(netz_sp500)$arrow.size<-0

V(netz_sp500)[degree(netz_sp500)>mean(degree(netz_sp500))]$color="red"

plot(netz_sp500,vertex.size=sqrt(degree(netz_sp500))*2,vertex.label.cex=.3, layout=layout_with_kk)


#with community structure

cfg<-cluster_fast_greedy(as.undirected(netz_spx))

plot(cfg, netz_sp500,vertex.size=sqrt(degree(netz_sp500))/4,vertex.label.cex=.3, layout=layout_with_kk)



#with MST


plot(mst(netz_sp500),vertex.size=sqrt(eigen_centrality(netz_sp500)$vector)*12,vertex.label.cex=.3, layout=layout_with_fr)

 
 
 

Kommentare


bottom of page