Feeds:
Posts

## data for financial net model and code for graph laplacian and degree distribution

 Inbox x

### Zulfikar Ahmed<wile.e.coyote.006@gmail.com>

4:29 PM (34 minutes ago)

 to David
1.  code for creating and dumping a single large R-analyzable table that works attached along with a snapshot showing that column means seem sensible.  This code needs a minor change pointing to the directory where all the .csv flat files with historical stock price data exists.

I will get you full dataset analyzable with R along with graphs of Laplacian and degree spectrum within the hour.  With R package igraph these are simple exercises once the large matrix of daily volatility are avaliable.
We create a covariance matrix and threshold by a single standard deviation to remove noise and then use the non-zero values to create an adjacency matrix deleting the diagonal!  And then just use eigen() to get the spectrum.  igraph has a degree.distributution function for a graph so that’s trivial.
2 Attachments

### Zulfikar Ahmed<wile.e.coyote.006@gmail.com>

4:43 PM (20 minutes ago)

 to David
Attached is the entire large matric containing closing prices for all the stocks in a large table that one can gunzip and pull into R.  A scan showed that minus expected missing data this looks good.

Here is my analysis code again in R:

# code to generate the fundamental VOLATILITY data

n<-dim(as.matrix(V))[2]
prices<-as.matrix(V)[,2:n]
returns<-diff(log(prices))
eps<-10e-6
noisy.volatility<-log(returns**2+eps)

# we create a graph using volatilities correlated by subtracting diagonal

# then soft thresholding by sd, and then setting all nonzero entries to 1
C<-matrix.cov( noisy.volatility)
C<-C-diag(C)
C<-C-sd(C)
C[C<0]<-0
A<-C
A[A>0]<-1
# now create a graph from these data using A as adjacency matrix
library(igraph)