Stat

Stat Class

class kedgeswap.Stat.Stat(mc, eta=None, turbo=False, verbose=False, njobs=1)[source]

Bases: object

Class to compute statistics on a Markov Chain object. This class implements methods to estimate the Markov Chain’s sampling gap, and to follow its convergence using the DFGLS test.

Attributes:

mc: MarkovChain object

The MarkovChain object on which we follow the convergence.

eta: float

The sampling gap used for the Markov Chain. The sampling gap gives a number of steps to make on the Markov Chain to obtain two uncorrelated graphs.

turbo: bool

Enable to make a fast but unverified estimation of the sampling gap.

verbose: bool

Enable to add information to the logs

static CheckAutocorrLag1(S_T, alpha)[source]

Check the autocorrelation with lag 1 of a time serie.

Parameters:
  • S_T (list(float)) – List of assortativity(/number of triangles) values to test autocorrelation

  • alpha (float) – Significance level of the test (usually fixed to 0.04).

guesstimate_sampling_gap(graph, gamma)[source]

Sampling gap estimation is long, this function gives an empirical estimation of the sampling gap. Measure the acceptation rate A of the Markov Chain, and fix the sampling gap as 10*(1/A) * M, where M is the number of edges of the network. This estimation was fixed empirically to overestimate the sampling gap we measure using the estimation from Dutta, U. (2022).

estimate_sampling_gap(graph, gamma)[source]

Estimate the sampling gap for the MCMC, following algorithm 1 (and using the same values) of Dutta, U. (2022). Sampling random graphs with specified degree sequences

run_dfgls(output)[source]

If no sampling gap eta specified, run estimation of eta. Run Markov Chain for eta steps, retrieve list of assortativity values (or number of triangles) and estimate the convergence of this time serie, to decide if the Markov Chain is converged.