MeanFieldGraph
Documentation for MeanFieldGraph package.
MeanFieldGraph.DiscreteTimeDataMeanFieldGraph.MarkovChainConnectivityMeanFieldGraph.MarkovChainModelBase.randBase.randMeanFieldGraph.classificationMeanFieldGraph.estimatorsMeanFieldGraph.mvwMeanFieldGraph.mvw_infRecipesBase.plotStatsAPI.fit
MeanFieldGraph.DiscreteTimeData — TypeDiscreteTimeData(X)A binary discrete time data of length T with N dimensions.
Arguments
X::Matrix{Bool}:X[i, t]gives the presence or absence of an event at timetfor componenti.
length(data) # Get the time length of data
size(data) # Get the dimensions of data, i.e. `(N,T)`
data[:,range::UnitRange] # Extract the data in the time interval `range`.MeanFieldGraph.MarkovChainConnectivity — TypeMarkovChainConnectivity(model,θ)A Markov Chain model with parameters given by model and connectivity matrix given by θ.
Arguments
model::MarkovChainModel: contains the parametersμ,λandp.θ::Matrix{Bool}:θ[i, j]gives the presence or absence of the influence of componentjonto componenti.
size(connec) # Get the number of components.Remark
Since the connectiviy matrix is specified, the parameter model.p is not used.
MeanFieldGraph.MarkovChainModel — TypeMarkovChainModel(μ,λ,p)A Markov Chain model with parameters μ, λ and p.
Arguments
μ: Spontaneous event probability parameterλ: Interaction parameterp: Edge probability
External links
Base.rand — Methodrand(modelconnec::MarkovChainConnectivity, excitatory::Vector{Bool}, T::Int)Simulate a realization of a Markov Chain model with a specified connectivity matrix.
Arguments
modelconnec::MarkovChainConnectivity: aMarkovChainModelwith a specified connectivity matrixθ.excitatory::Vector{Bool}:truecoordinates correspond to excitatory components andfalsecoordinates correspond to inhibitory components.T::Int: Time length of the simulation.
using MeanFieldGraph
model = MarkovChainModel(.5, .5, .5)
θ = [[1 1];[0 1]]
modelconnec = MarkovChainConnectivity(model,θ)
excitatory = [true, false]
using Random
Random.seed!(1)
data = rand(modelconnec, excitatory, 10)
data.X
# output
2×10 Matrix{Bool}:
1 0 0 0 1 1 1 1 1 1
1 0 1 1 0 1 0 1 1 0Base.rand — Methodrand(model::MarkovChainModel, excitatory::Vector{Bool}, T::Int)Simulate a realization of a Markov Chain model without a specified connectivity matrix.
Arguments
model::MarkovChainModel: contains the parametersμ,λandp.excitatory::Vector{Bool}:truecoordinates correspond to excitatory components andfalsecoordinates correspond to inhibitory components.T::Int: Time length of the simulation.
Remark
It generates a connectivity matrix according to an Erdos-Rényi graph with parameter p and then apply the method rand(modelconnec::MarkovChainConnectivity, excitatory::Vector{Bool}, T::Int). ```
MeanFieldGraph.classification — Methodclassification(data::DiscreteTimeData)Estimates the two underlying communities (one excitatory and one inhibitory) from the data set data. It returns a Vector{Bool} where the true coordinates correspond to excitatory components and false coordinates correspond to inhibitory components.
MeanFieldGraph.estimators — Functionestimators(data::DiscreteTimeData, Δ::Int=floor(Int,log(length(data))))Compute the estimators $\hat{m}$, $\hat{v}$ and $\hat{w}$ on a data set data with tuning parameter Δ.
Remark
If the value Δ = 0 is chosen, then it is replaced by its default value floor(Int,log(length(data)))
MeanFieldGraph.mvw — Methodmvw(μ, λ, p, r₊)Compute the targets m, v and w corresponding to the parameters μ, λ, p and the ratio of excitatory components r₊.
The mathematical expressions are:
\[\begin{aligned} m &= \frac{\mu+(1-\lambda)pr_-}{1-p(1-\lambda)(r_+-r_-)},\ v &= (1-\lambda)^2 p(1-p)((m-r_-)^2+r_+r_-) , \ w &= m(1-m)\frac{1+4(1-\lambda)^2p^2r_+r_-}{(1-p(1-\lambda)(r_+-r_-))^2}. \end{aligned}\]
Arguments
μ: Spontaneous event probabilityλ: Interaction parameterp: Edge probabilityr₊: ratio of excitatory components
MeanFieldGraph.mvw_inf — Methodmvw_inf(modelconnec::MarkovChainConnectivity, excitatory::Vector{Bool})Compute the limit of the three estimators $\hat{m}$, $\hat{v}$ and $\hat{w}$ when $T\to \infty$.
The mathematical expressions are:
\[\begin{aligned} m_\infty = \overline{m^N}, \ v_\infty = \sum_{i=1}^N (m^N_i - \overline{m^N})^2 , \ w_\infty = \frac{1}{N} \sum_{i=1}^N (c^N_i)^2 m^N_i (1 - m^N_i) , \end{aligned}\]
Arguments
modelconnec::MarkovChainConnectivity: aMarkovChainModelwith a specified connectivity matrixθ.excitatory::Vector{Bool}:truecoordinates correspond to excitatory components andfalsecoordinates correspond to inhibitory components.
RecipesBase.plot — Methodplot(data::DiscreteTimeData)Plot a black and white image corresponding to data. Black pixels correspond to the value 1. The x-axis correspond to time and y-axis correspond to components.
StatsAPI.fit — Methodfit(::Type{MarkovChainModel}, data::DiscreteTimeData, r₊; Δ::Int=floor(Int,log(length(data))))Fit a MarkovChainModel to a data set data with asymptotic excitatory proportion r₊.
Keyword argument
Δ: tuning parameter of the method. Its default value is the floor of $\log(T)$ where $T$ is the time length ofdata.