Types API Reference

This page documents the core data types in Siena.jl.

The Siena Module

Siena — Module
Siena.jl - Stochastic Actor-Oriented Models for Julia

A Julia implementation of SIENA (Simulation Investigation for Empirical Network Analysis) for analyzing longitudinal network data. Port of RSiena (https://github.com/stocnet/rsiena).

Stochastic Actor-Oriented Models (SAOM) are statistical models for analyzing:

  • Longitudinal network data (panel data with repeated network observations)
  • Co-evolution of networks and behavior
  • Multivariate and two-mode networks

The models use simulation-based estimation (Method of Moments) with a continuous-time Markov chain model of network evolution.

Key Functions

Data Preparation

  • siena_data(): Create a Siena data object
  • siena_nodeset(): Define a node set
  • siena_dependent(): Define dependent network or behavior variable
  • constant_covariate(), varying_covariate(): Create actor covariates
  • constant_dyad_covariate(), varying_dyad_covariate(): Create dyadic covariates
  • add_composition_change!(): Attach actors joining/leaving (CompositionChange)

Model Specification

  • get_effects(): Create effects object from data
  • include_effects!(): Add effects to the model (a requested effect that does not exist is an error, not a warning)
  • include_interaction!(): Add a two- or three-way interaction of effects (RSiena's includeInteraction)

Estimation

  • fit_siena(): Estimate model parameters (main estimation function; siena07() is the RSiena-faithful alias)
  • siena_algorithm(): Configure estimation algorithm

Model Assessment

  • gof(): Goodness of fit testing (method of the shared NetworkCore.gof generic; the preferred entry point)
  • siena_gof(): the same test with the RSiena-style detailed result
  • score-type tests of fixed effects: include_effects!(...; fix=true, test=true) (RSiena's test=TRUE)
  • siena_time_test(): Score-type tests of time heterogeneity (RSiena's sienaTimeTest)

Example

The s50 friendship panel bundled with NetworkCore (50 pupils, three waves), with the model of RSiena's introductory script: RSiena's default effects (rates, outdegree, reciprocity), transitive triplets, and smoking-based selection.

using Siena, NetworkCore, Random

s50 = load_dataset(:s50)
data = siena_data()
add_nodeset!(data, NodeSet(50))
add_dependent!(data, DependentNetwork(:friendship, s50.friendship))
add_covariate!(data, ConstantCovariate(:smoke1, s50.smoke[:, 1]))

effects = get_effects(data)       # RSiena's defaults: rates, outdegree, recip
include_effects!(effects, :friendship, [:transTrip, :altsmoke1, :egosmoke1, :simsmoke1])

# Seeded, so the fit is reproducible; siena07(data, effects; ...) is an alias.
result = fit_siena(data, effects; rng=MersenneTwister(1),
                   algorithm=SienaAlgorithm(verbose=false))
result.converged                  # true
coeftable(result)                 # estimates, standard errors, z and p

See the RSiena manual for theoretical background on Stochastic Actor-Oriented Models.

source

Node Sets

NodeSet

Siena.NodeSet — Type
NodeSet

Represents a set of actors/nodes in the network.

Fields

  • n::Int: Number of nodes
  • names::Vector{String}: Optional node names
  • id::Symbol: Identifier for the node set

Example

using Siena
ns = NodeSet(3; names=["Ann", "Bob", "Cat"])
length(ns), ns.names[2]        # (3, "Bob")
source

Data Container

SienaData

Siena.SienaData — Type
SienaData

Container for all data needed for SAOM estimation.

Fields

  • nodesets::Dict{Symbol, NodeSet}: Named node sets
  • dependents::Dict{Symbol, AbstractDependent}: Dependent variables
  • covariates::Dict{Symbol, AbstractCovariate}: Covariates
  • composition_change::Union{CompositionChange, Nothing}: Composition changes
  • n_waves::Int: Number of observation waves

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
data.n_waves, length(data.dependents)       # (2, 1)
source

Data Operations

Siena.add_nodeset! — Function
add_nodeset!(data::SienaData, ns::NodeSet)

Add a node set to the data.

Example

using Siena
data = siena_data()
add_nodeset!(data, NodeSet(3))
length(data.nodesets[:actors])     # 3
source
Siena.add_dependent! — Function
add_dependent!(data::SienaData, dep::AbstractDependent)

Add a dependent variable to the data.

Example

using Siena
data = siena_data()
add_dependent!(data, DependentBehavior(:mood, [[1, 2, 3], [2, 2, 3]]))
data.n_waves      # 2
source
Siena.add_covariate! — Function
add_covariate!(data::SienaData, cov::AbstractCovariate)

Add a covariate to the data.

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40]))
haskey(data.covariates, :age)        # true
source

Dependent Variables

AbstractDependent

Siena.AbstractDependent — Type
AbstractDependent

Abstract type for dependent variables in SAOM.

Example

using Siena
DependentBehavior(:mood, [[1, 2, 3], [2, 2, 3]]) isa AbstractDependent  # true
source

DependentNetwork

Siena.DependentNetwork — Type
DependentNetwork

A dependent network variable observed at multiple time points.

Fields

  • name::Symbol: Variable name
  • networks::Vector{Matrix{Int}}: Network adjacency matrices at each observation (0/1 face values; structural codes are decoded on construction)
  • type::Symbol: Network type (:onemode, :twomode, :bipartite)
  • directed::Bool: Whether the network is directed
  • allow_self_loops::Bool: Whether self-loops are allowed
  • nodeset1::Symbol: ID of the first node set
  • nodeset2::Union{Symbol, Nothing}: ID of the second node set (for bipartite)
  • structural::Vector{BitMatrix}: Per-wave masks of structurally determined dyads (see below); empty when the data contain no structural codes
  • allow_only::Bool: Whether up-only and down-only periods restrict the simulation (RSiena's allowOnly; default true, see below)
  • uponly::Vector{Bool}, downonly::Vector{Bool}: Per period, whether the observed network only gains ties (only loses ties) between its two waves; all false when allow_only=false

Structural zeros and ones (RSiena 10/11 coding)

Adjacency matrices may contain RSiena-style structural codes alongside 0/1: by default 10 marks a structural zero (the tie is structurally absent — impossible, e.g. between actors who never met) and 11 a structural one (the tie is structurally present — forced, e.g. formal ties). The codes are configurable via the structural_zero/structural_one keywords. On construction each coded entry is decoded to its determined value (10 → 0, 11 → 1) in networks, and its position is recorded in the per-wave structural mask. Any entry other than 0, 1, or the two codes throws an ArgumentError.

Structurally determined dyads behave as in RSiena's first-order semantics: they are excluded from the candidate sets of ministep simulation for the period whose start wave marks them (an actor can never toggle them), they are excluded from the target and simulated moment statistics, and they do not count toward observed change in rate statistics.

Structural status that changes between waves

Only the period-start mask is used. When a dyad's structural status changes from one wave to the next, RSiena applies a further correction to the statistics that is not implemented here, so results on such data are not numerically equivalent to RSiena's. Data whose structural masks are the same in every wave — the common case — are unaffected.

Up-only and down-only periods

As in RSiena (sienaDependent(allowOnly = TRUE), the default), a period in which the observed network only gains ties is up-only: in that period an actor can create ties but never drop one. A period that only loses ties is down-only, and actors can only drop ties. Structurally determined dyads and the diagonal are ignored when the periods are classified. When every period is up-only (or every period is down-only), get_effects does not offer the outdegree (density) effect, as RSiena's getEffects does not. Pass allow_only=false to simulate every period without the restriction (RSiena's allowOnly = FALSE).

Undirected (symmetric) networks

directed=false declares a non-directed one-mode network (RSiena: a symmetric sienaDependent). Every wave must be a symmetric matrix (and so must its structural codes); a non-symmetric wave throws an ArgumentError, and a two-mode network cannot be undirected. Such a network evolves under RSiena's default model for non-directed networks, model type 2 (unilateral initiative and reciprocal confirmation, the "forcing" model): the actor with the opportunity chooses an alter using its objective function, and the tie i–j is created or dissolved in both directions at once. Only the effects RSiena defines for symmetric networks are available (see get_effects); their target statistics follow RSiena's conventions for symmetric data (e.g. the degree/density statistic counts each edge once).

Example

using Siena
w1 = [0 1 0; 0 0 1; 0 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
dep = DependentNetwork(:advice, [w1, w2])
n_actors(dep), n_waves(dep)            # (3, 2)

u1 = [0 1 0; 1 0 0; 0 0 0]            # undirected: symmetric waves
u2 = [0 1 1; 1 0 0; 1 0 0]
DependentNetwork(:friends, [u1, u2]; directed=false).directed   # false

Interoperability

The built-in NetworkCore.jl integration adds a constructor taking a Vector of Network objects (one per wave); adjacency matrices are extracted with NetworkCore.as_matrix, directedness and self-loop settings are taken from the networks, and the waves are validated to share the same node set. See the extension's docstring for details.

source

DependentBehavior

Siena.DependentBehavior — Type
DependentBehavior

A dependent behavioral variable observed at multiple time points.

Fields

  • name::Symbol: Variable name
  • values::Vector{Vector{Int}}: Behavior values at each observation
  • min_val::Int: Minimum allowed value
  • max_val::Int: Maximum allowed value
  • nodeset::Symbol: ID of the node set
  • mean_val::Float64: Overall mean of the observed values (used for centering, as in RSiena)
  • sim_mean::Float64: Mean pairwise similarity of the observed values over waves 1..M-1 (RSiena's ^sim)
  • allow_only::Bool: Whether up-only and down-only periods restrict the simulation (RSiena's allowOnly; default true)
  • uponly::Vector{Bool}, downonly::Vector{Bool}: Per period, whether no observed value falls (no observed value rises) between the period's two waves; all false when allow_only=false

As in RSiena, in an up-only period actors can only raise their value (or keep it), and in a down-only period only lower it. When every period is up-only (or every period is down-only), get_effects does not offer the linear shape effect, as RSiena's getEffects does not. Pass allow_only=false to lift the restriction.

Example

using Siena
dep = DependentBehavior(:mood, [[1, 2, 3, 2], [2, 2, 3, 1]])
(dep.min_val, dep.max_val, dep.mean_val)       # (1, 3, 2.0)
source

Dependent Variable Queries

Siena.n_waves — Function
n_waves(dn::DependentNetwork)

Return the number of observation waves.

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
n_waves(data.dependents[:advice])        # 2
source
Siena.n_actors — Function
n_actors(dn::DependentNetwork)

Return the number of actors (rows) in the network.

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
n_actors(data.dependents[:advice])       # 3
source

Structural Zeros and Ones

Siena.has_structural — Function
has_structural(dep::DependentNetwork) -> Bool

Whether the dependent network contains any structurally determined dyads (structural zeros/ones; see DependentNetwork).

Example

using Siena
has_structural(DependentNetwork(:net, [[0 10; 1 0], [0 10; 0 0]]))   # true: 10 = structural zero
source
Siena.is_structural_dyad — Function
is_structural_dyad(dep::DependentNetwork, wave::Int, i::Int, j::Int) -> Bool

Whether the dyad (i, j) is structurally determined (structural zero or one) at observation wave. Its determined face value is dep.networks[wave][i, j].

Example

using Siena
dep = DependentNetwork(:net, [[0 11; 0 0], [0 11; 1 0]])
is_structural_dyad(dep, 1, 1, 2)       # true: 11 = structural one
source
Siena.n_structural_dyads — Function
n_structural_dyads(dep::DependentNetwork, wave::Int) -> Int

Number of structurally determined dyads at observation wave.

Example

using Siena
n_structural_dyads(DependentNetwork(:net, [[0 10; 11 0], [0 10; 11 0]]), 1)    # 2
source

Covariates

AbstractCovariate

Siena.AbstractCovariate — Type
AbstractCovariate

Abstract type for covariates.

Example

using Siena
ConstantCovariate(:age, [20, 30, 40]) isa AbstractCovariate     # true
source

ConstantCovariate

Siena.ConstantCovariate — Type
ConstantCovariate(name::Symbol, values::AbstractVector; nodeset=:actors,
                  center=true, missing=:error)

A covariate that is constant across all waves (RSiena's coCovar).

Fields

  • name::Symbol: Covariate name
  • values::Vector{Float64}: Values for each actor (centred when center=true)
  • nodeset::Symbol: ID of the node set
  • centered::Bool: Whether values are centered
  • mean::Float64: Mean value (for centering)
  • sim_mean::Float64: Mean pairwise similarity (RSiena's $\widehat{sim}$)
  • range::Float64: Range of the values (the similarity denominator)
  • n_imputed::Int: Number of missing values imputed under missing=:mean

Missing values (missing or NaN) are refused by default; missing=:mean replaces them by the mean of the observed values, RSiena's default rule. (RSiena additionally leaves such actors out of the target statistics; Siena.jl does not, which approximations(fit) records for a fit using an imputed covariate.)

Example

using Siena
smoke = ConstantCovariate(:smoke, [1, 2, 2, 3])
smoke.values                          # centred: [-1.0, 0.0, 0.0, 1.0]
ConstantCovariate(:age, [20.0, NaN, 30.0]; missing=:mean).n_imputed   # 1
source

VaryingCovariate

Siena.VaryingCovariate — Type
VaryingCovariate(name::Symbol, values::Vector{<:AbstractVector}; nodeset=:actors,
                 center=true, missing=:error)

A covariate that varies across waves (RSiena's varCovar); values[w] holds the actor values used in period w.

Fields

  • name::Symbol: Covariate name
  • values::Vector{Vector{Float64}}: Values for each actor at each wave
  • nodeset::Symbol: ID of the node set
  • centered::Bool: Whether values are centered
  • mean::Float64: Overall mean value
  • sim_mean::Float64: Mean pairwise similarity, averaged over the waves
  • range::Float64: Range over all waves (the similarity denominator)
  • n_imputed::Int: Number of missing values imputed under missing=:mean

Missing values are handled as for ConstantCovariate (imputation uses the global mean over all waves, as RSiena does).

Example

using Siena
VaryingCovariate(:mood, [[1, 2, 3], [2, 2, 4]]).mean     # 2.333…
source

ConstantDyadCovariate

Siena.ConstantDyadCovariate — Type
ConstantDyadCovariate(name::Symbol, values::AbstractMatrix; nodeset1=:actors,
                      nodeset2=:actors, center=true, missing=:error)

A dyadic covariate that is constant across waves (RSiena's coDyadCovar).

Fields

  • name::Symbol: Covariate name
  • values::Matrix{Float64}: Values for each dyad (centred when center=true)
  • nodeset1::Symbol: ID of row node set
  • nodeset2::Symbol: ID of column node set
  • centered::Bool: Whether values are centered
  • mean::Float64: Mean value (over the off-diagonal entries for a one-mode covariate, as in RSiena)
  • n_imputed::Int: Number of missing values imputed under missing=:mean

Example

using Siena
W = [0 1 2; 1 0 1; 2 1 0]
ConstantDyadCovariate(:distance, W).mean       # 4/3: the diagonal is excluded
source

VaryingDyadCovariate

Siena.VaryingDyadCovariate — Type
VaryingDyadCovariate(name::Symbol, values::Vector{<:AbstractMatrix};
                     nodeset1=:actors, nodeset2=:actors, center=true,
                     missing=:error)

A dyadic covariate that varies across waves (RSiena's varDyadCovar).

Fields

  • name::Symbol: Covariate name
  • values::Vector{Matrix{Float64}}: Values for each dyad at each wave
  • nodeset1::Symbol: ID of row node set
  • nodeset2::Symbol: ID of column node set
  • centered::Bool: Whether values are centered
  • mean::Float64: Overall mean value (off-diagonal for one-mode covariates)
  • n_imputed::Int: Number of missing values imputed under missing=:mean

Example

using Siena
W1 = [0 1; 1 0]; W2 = [0 2; 2 0]
VaryingDyadCovariate(:contact, [W1, W2]).mean   # 1.5
source

Composition Change

CompositionChange

Siena.CompositionChange — Type
CompositionChange

Tracks changes in network composition (actors joining/leaving).

Fields

  • changes::Vector{Tuple{Int, Int, Symbol}}: (actor, wave, action) tuples where action is :join or :leave

Validation

A composition-change sequence describes a state machine per actor, and an inconsistent sequence would silently produce a wrong presence pattern (and hence wrong moment statistics), so it is rejected on construction:

  • action must be :join or :leave;
  • actor and wave must be positive (their upper bounds depend on the data and are checked by add_composition_change!, which knows the number of actors and waves);
  • an actor cannot have two events at the same wave;
  • an actor's events must alternate: joining an actor that has already joined, or removing one that has already left, is contradictory and throws.

An actor's first event fixes its initial state: a first :join at wave w means the actor is absent before w, a first :leave at wave w means it is present before w (see is_present).

Example

using Siena
cc = CompositionChange([(4, 2, :join), (7, 3, :leave)])
is_present(cc, 4, 1), is_present(cc, 4, 2)      # (false, true)
source

Composition Change Operations

Siena.add_change! — Function
add_change!(cc::CompositionChange, actor::Int, wave::Int, action::Symbol)

Add a composition change event, validating it against the actor's existing history (see CompositionChange). A contradictory or duplicate event throws and leaves cc unchanged.

Example

using Siena
cc = CompositionChange()
add_change!(cc, 3, 2, :leave)
is_present(cc, 3, 2)          # false
source
Siena.add_composition_change! — Function
add_composition_change!(data::SienaData, cc::CompositionChange)

Attach composition-change information (actors joining/leaving; see CompositionChange) to the data. The counterpart of supplying a sienaCompositionChange object in RSiena.

During estimation an actor contributes to a period only when present at both of its endpoint waves. Absent actors get no ministep opportunities, their dyads are excluded from the candidate sets, and their rows/columns are excluded from the target and simulated moment statistics and from the observed change (rate) distances. This is a whole-period (listwise) approximation, not RSiena's treatment, which places joining and leaving at times within the period (Huisman & Snijders 2003): an actor who leaves during a period is dropped from that whole period here, also as an alter of the others. approximations(fit) records it.

The data fix the ranges the events must fall in, so this is where they are checked: every actor must be an actor of the data (1:n_actors) and every wave an observation wave (1:n_waves). An out-of-range actor or wave throws — silently ignoring it would mean estimating a model whose composition differs from the one that was requested. The internal consistency of the sequence itself is checked earlier, by CompositionChange/add_change!.

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
add_composition_change!(data, CompositionChange([(3, 2, :join)]))
is_present(data.composition_change, 3, 1)        # false
source
Siena.is_present — Function
is_present(cc::CompositionChange, actor::Int, wave::Int) -> Bool

Whether an actor is present at an observation wave. An actor with a :join event at wave w is present from wave w onward (and absent before its first event); a :leave event at wave w makes the actor absent from wave w onward. Actors without composition-change events are always present.

Example

using Siena
cc = CompositionChange([(2, 3, :leave)])
is_present(cc, 2, 2), is_present(cc, 2, 3)      # (true, false)
source

Network State

The NetworkState type maintains the current state of networks and behaviors during simulation. It tracks adjacency matrices (as compact integer StateNetwork matrices with cached degrees) and behavior vectors as they evolve through mini-steps.

NetworkState

Siena.NetworkState — Type
NetworkState

Mutable state of networks and behaviors during simulation.

Fields

  • networks::Dict{Symbol, StateNetwork}: Current network states (bit-packed 0/1 matrices with incrementally maintained degree vectors; assigning a plain 0/1 integer matrix converts automatically — see StateNetwork)
  • behaviors::Dict{Symbol, Vector{Int}}: Current behavior states
  • time::Float64: Current simulation time within period
  • period::Int: Current period (index of the starting wave); used to select the values of varying covariates
  • active::Union{Nothing, BitVector}: Per-actor activity mask of the current period when the data have composition changes (nothing otherwise); inactive actors take no ministeps and their dyads are not candidates

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
state = initialize!(NetworkState(), data, 1)
state.networks[:advice] == w1        # true
source

StateNetwork

Siena.StateNetwork — Type
StateNetwork <: AbstractMatrix{Int}

Simulation-state representation of one network variable: a compact Matrix{Int8} of the 0/1 tie values (structural codes are decoded on data construction, so the state never holds values beyond 0/1) plus incrementally maintained out-/indegree vectors and sorted outgoing/incoming adjacency lists.

Indexing reads and writes behave exactly like a 0/1 Matrix{Int}; every setindex! updates the degree vectors, so _row_sum/_col_sum (the degree lookups of the effect hot loops) are O(1) instead of O(n) scans. Writing a value other than 0 or 1 throws.

Example

using Siena
sn = StateNetwork([0 1 1; 0 0 1; 0 0 0])
sn[2, 1] = 1
sn.outdeg, sn.indeg       # ([2, 2, 0], [1, 1, 2])
source

State Initialization

Siena.initialize! — Function
initialize!(state::NetworkState, data::SienaData, wave::Int; period::Int=wave)

Initialize network state from data at a given wave. period sets the period used for varying-covariate lookups (defaults to the wave itself; pass the starting wave when initializing at the end observation of a period).

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
state = initialize!(NetworkState(), data, 2; period=1)
state.period, state.networks[:advice] == w2      # (1, true)
source

snapshot

Siena.snapshot — Function
snapshot(state::NetworkState)

Return an independent copy of the current state.

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
state = initialize!(NetworkState(), data, 1)
copy_ = snapshot(state)
copy_.networks[:advice] !== state.networks[:advice]      # independent copy
source

Convenience Constructors

These functions mirror the RSiena API for creating data objects.

siena_data

Siena.siena_data — Function
siena_data()

Create an empty SienaData object. Counterpart of R's sienaDataCreate() without arguments.

Example

using Siena
data = siena_data()
data.n_waves      # 0 until a dependent variable is added
source

siena_nodeset

Siena.siena_nodeset — Function
siena_nodeset(n::Int; names::Vector{String}=String[], id::Symbol=:actors)

Create a node set. Counterpart of R's sienaNodeSet().

Example

using Siena
siena_nodeset(4; id=:clubs)        # NodeSet(:clubs, n=4)
source

siena_dependent

Siena.siena_dependent — Function
siena_dependent(name::Symbol, networks::Vector{<:AbstractMatrix}; kwargs...)

Create a dependent network variable. Counterpart of R's sienaDependent() for networks.

Matrices may contain RSiena-style structural codes (default: 10 = structural zero, 11 = structural one, configurable via the structural_zero/structural_one keywords); see DependentNetwork for the semantics.

Example

using Siena
siena_dependent(:advice, [[0 1; 0 0], [0 1; 1 0]]) isa DependentNetwork      # true
siena_dependent(:mood, [[1, 2], [2, 2]]) isa DependentBehavior                 # true
source
siena_dependent(name::Symbol, values::Vector{<:AbstractVector}; kwargs...)

Create a dependent behavior variable. Counterpart of R's sienaDependent() for behavior.

source
siena_dependent(name::Symbol, networks::Vector{<:AbstractNetwork}; kwargs...)

Create a dependent network variable from a vector of Network observations (requires NetworkCore.jl; see DependentNetwork, including its missing-dyad policy).

source

constant_covariate

Siena.constant_covariate — Function
constant_covariate(name::Symbol, values::AbstractVector; kwargs...)

Create a constant covariate. Counterpart of R's coCovar().

Example

using Siena
constant_covariate(:age, [20, 30, 40]).values      # [-10.0, 0.0, 10.0]
source

varying_covariate

Siena.varying_covariate — Function
varying_covariate(name::Symbol, values::Vector{<:AbstractVector}; kwargs...)

Create a varying covariate. Counterpart of R's varCovar().

Example

using Siena
varying_covariate(:mood, [[1, 2, 3], [2, 3, 4]]).values[2]       # centred wave-2 values
source

constantdyadcovariate

Siena.constant_dyad_covariate — Function
constant_dyad_covariate(name::Symbol, values::AbstractMatrix; kwargs...)

Create a constant dyadic covariate. Counterpart of R's coDyadCovar().

Example

using Siena
constant_dyad_covariate(:dist, [0 1 2; 1 0 1; 2 1 0]).mean      # 4/3
source

varyingdyadcovariate

Siena.varying_dyad_covariate — Function
varying_dyad_covariate(name::Symbol, values::Vector{<:AbstractMatrix}; kwargs...)

Create a varying dyadic covariate. Counterpart of R's varDyadCovar().

Example

using Siena
varying_dyad_covariate(:contact, [[0 1; 1 0], [0 2; 2 0]]).mean     # 1.5
source

Algorithm Configuration

SienaAlgorithm

Siena.SienaAlgorithm — Type
SienaAlgorithm

Configuration for the SAOM estimation algorithm.

Every field below is read by fit_siena and changes what the estimator actually does; the settings that were in effect for a fit are reported back on the SienaResult (n_simulations_run, n_threads_used, n_iterations).

Fields

  • n_subphases::Int: Number of subphases in phase 2
  • phase1_iterations::Int: Robbins-Monro iterations in phase 1 (also the number of iterations per phase-2 subphase)
  • phase3_iterations::Int: Simulations in phase 3
  • initial_gain::Float64: Initial gain parameter (a)
  • min_gain::Float64: Minimum gain parameter
  • max_iterations::Union{Int, Nothing}: Budget for the total number of Robbins-Monro iterations in phases 1 and 2. nothing (the default) means no budget, i.e. all phase1_iterations * (1 + n_subphases) iterations are run. When the budget is exhausted the remaining phase-1/phase-2 iterations are skipped, a warning is emitted, and the estimation proceeds to phase 3 (the estimates are then typically unconverged). Phase-3 simulations are not iterations and do not count against the budget.
  • convergence_threshold::Float64: Per-parameter convergence criterion — every convergence t-ratio must satisfy |t| < threshold (RSiena publication standard: 0.1)
  • rng::AbstractRNG: Random number generator; defaults to Random.default_rng(). A fit consumes this generator. Pass a fresh seeded generator to repeat a fit.
  • allow_unconverged::Bool: What happens when the final, independent phase-3 batch does not meet the convergence standard. true (the default, RSiena's behaviour) returns the fit with a warning; converged = false is then shown by show, listed by approximations, and the estimates should not be reported. false throws SienaConvergenceError, carrying the result.
  • refine_max::Int: Maximum Newton refinement updates after phase 2 (default 5; zero disables refinement). Each uses 2 * phase3_iterations new simulations. Phase 3 always uses a separate, independent batch for final diagnostics.
  • revalidate_max::Int: How often a failed phase-3 validation re-enters refinement (default 2): the failed batch drives one more Newton step and a fresh, independent phase-3 batch validates the new estimate. The reported diagnostics always come from a batch that was not used to choose the estimate.
  • model_type::Symbol: Which dependent variables co-evolve — :standard (the default: every dependent variable takes ministeps), :networkonly (only DependentNetwork variables take ministeps; behavior variables stay fixed at their period-start values, still readable by network effects) or :behavioronly (the mirror image: only DependentBehavior variables take ministeps; networks are frozen and exogenous). The effects of a frozen variable are dropped from the estimated parameter vector — a variable that never changes contributes a constant moment, so its parameters are unidentified (see simulated_variables and fit_siena)
  • conditional::Union{Bool, Nothing}: Conditional estimation (RSiena's cond): condition every simulated period on the observed amount of change of one dependent variable instead of on the unit time length (see fit_siena). nothing (the default) is RSiena's cond = NA: conditional when exactly one dependent variable is simulated (and the data have no composition change), unconditional otherwise
  • condvar::Union{Symbol, Nothing}: Name of the conditioning variable for conditional estimation (RSiena's condvarno); nothing (the default) uses the only dependent variable and errors if there are several
  • n_simulations::Int: Number of simulations averaged into the simulated moment vector of each Robbins-Monro iteration (phases 1 and 2). The default 1 is RSiena's behaviour; larger values reduce the Monte-Carlo noise of every update at a proportional cost.
  • threaded::Bool: Run the independent simulations (phase 3 and the derivative estimators) multi-threaded. true (the default) uses Threads.nthreads() threads; false runs them strictly serially on the calling thread. Results are identical either way — each simulation is driven by its own pre-drawn seed.
  • verbose::Bool: Print progress
  • derivative_sims::Int: Simulations behind the phase-1/phase-2 derivative matrix (the Robbins-Monro preconditioner; default 100), and per perturbation of the finite-difference derivative under derivative_method = :finite_difference
  • diagonalize::Float64: RSiena's diagonalize: the Robbins-Monro updates use $(1 - w) D + w\,\mathrm{diag}(D)$ (default 0.2, RSiena's value for MoM)
  • overall_convergence_threshold::Float64: Threshold for the overall maximum convergence ratio tconv.max (RSiena standard: 0.25)
  • derivative_method::Symbol: Estimator for the phase-3 derivative matrix used for standard errors — :score (score-function / likelihood-ratio estimator over all phase-3 simulations, as in RSiena; also for conditional estimation) or :finite_difference (central differences with common random numbers, for cross-checking)

Example

using Siena, Random
alg = SienaAlgorithm(rng=MersenneTwister(1), verbose=false, n_subphases=3)
alg.conditional === nothing        # RSiena's cond = NA
Not RSiena's modelType

model_type here selects the subset of dependent variables that co-evolve (:standard / :networkonly / :behavioronly), which is not what RSiena's modelType means. RSiena's modelType selects the kind of network model driving a ministep — 1 standard actor-oriented, 2 forcing, 3 initiative, 4 pairwise-forcing, ... . Siena.jl applies RSiena's default for each kind of network and nothing else: the standard actor-oriented ministep (type 1) for directed networks and the forcing model (type 2: unilateral initiative, reciprocal confirmation) for undirected ones (DependentNetwork(...; directed=false)). The other model types (initiative, pairwise, double-step, ...) are not implemented. The name is kept because it reads naturally in Julia, but a Siena.jl model_type value never corresponds to an RSiena modelType value.

source

siena_algorithm

Siena.siena_algorithm — Function
siena_algorithm(; kwargs...)

Create a SienaAlgorithm with default or specified parameters.

Counterpart of RSiena's sienaAlgorithmCreate(). The defaults follow RSiena where it matters for inference — conditional estimation for a single dependent variable (cond = NA), 4 subphases with the gain halved per subphase, the publication convergence standard (all |t| < 0.1, tconv.max < 0.25), and a returned (not thrown) unconverged fit. The schedule itself is simpler than RSiena's: a fixed phase1_iterations per subphase instead of RSiena's adaptive n2min/n2max, a first-subphase gain of initial_gain / 2, no diagonalisation or Dolby option, a finite-difference derivative as the phase-1/2 preconditioner, and capped Newton refinement before phase 3. Settings without an implementation here (maxlike, ...) are absent rather than silently ignored. Siena.jl's model_type is not RSiena's modelType (see the warning in SienaAlgorithm).

Example

using Siena, Random
alg = siena_algorithm(rng=MersenneTwister(42), conditional=false, verbose=false)
alg.conditional        # false: unconditional MoM, as RSiena's cond = FALSE
source

GainSequence

Siena.GainSequence — Type
GainSequence

Manages the gain parameter sequence for Robbins-Monro algorithm.

Example

using Siena
gs = GainSequence(0.2, 0.001)
next_gain!(gs), next_gain!(gs)      # (0.2, 0.1)
source

Gain Operations

Siena.next_gain! — Function
next_gain!(gs::GainSequence)

Get the next gain value and update the iteration counter.

Example

using Siena
gs = GainSequence(0.2, 0.05)
[next_gain!(gs) for _ in 1:5]        # 0.2, 0.1, 0.0667, 0.05, 0.05
source
Siena.reset_gain! — Function
reset_gain!(gs::GainSequence)

Reset the gain sequence.

Example

using Siena
gs = GainSequence(0.2, 0.05)
next_gain!(gs); next_gain!(gs)
reset_gain!(gs).current        # 0.2
source

EstimationPhase

Siena.EstimationPhase — Type
EstimationPhase

Current phase of the estimation algorithm.

Example

using Siena
PhaseState(SienaAlgorithm(verbose=false)).phase == PHASE_1      # true
source
Siena.PHASE_1 — Constant
PHASE_1

The first EstimationPhase: the derivative matrix is estimated at the initial values and a few rough Robbins-Monro updates follow.

Example

using Siena
PHASE_1 < PHASE_2 < PHASE_3          # true
source
Siena.PHASE_2 — Constant
PHASE_2

The second EstimationPhase: Robbins-Monro subphases with decreasing gain and Polyak-Ruppert averaging.

Example

using Siena
Int(PHASE_2)          # 1
source
Siena.PHASE_3 — Constant
PHASE_3

The third EstimationPhase: simulations at the final estimate for the convergence check and the standard errors.

Example

using Siena
string(PHASE_3)       # "PHASE_3"
source

PhaseState

Siena.PhaseState — Type
PhaseState

State of the current estimation phase.

Example

using Siena
ps = PhaseState(SienaAlgorithm(verbose=false))
ps.phase, ps.subphase         # (PHASE_1, 1)
source

ConvergenceStats

Siena.ConvergenceStats — Type
ConvergenceStats

Statistics for convergence checking.

Fields

  • t_ratios::Vector{Float64}: per-parameter convergence t-ratios
  • max_t_ratio::Float64: maximum absolute t-ratio
  • overall_convergence::Float64: root-mean-square of the t-ratios
  • tconv_max::Float64: overall maximum convergence ratio (RSiena's tconv.max) — the maximum convergence t-ratio over all linear combinations of the statistics, $\sqrt{\bar e' \Sigma^{-1} \bar e}$

Example

using Siena
cs = ConvergenceStats(2)
Siena.update_convergence!(cs, [0.05, -0.02], [1.0, 1.0])
cs.max_t_ratio        # 0.05
source

Internal Phase and Convergence Helpers

Siena.update_convergence! — Function
update_convergence!(cs::ConvergenceStats, deviations::Vector{Float64},
                   scale::Vector{Float64})

Update convergence statistics. deviations are the differences between mean simulated and target statistics; scale is the standard deviation of the simulated statistics (RSiena's convergence t-ratio denominator).

source
Siena.is_converged — Function
is_converged(cs::ConvergenceStats, threshold::Float64)
is_converged(cs::ConvergenceStats, threshold::Float64, overall_threshold::Float64)

Check if the algorithm has converged: every per-parameter |t-ratio| must be below threshold, and — in the three-argument form (the RSiena publication standard: 0.1 and 0.25) — the overall maximum convergence ratio tconv.max must be below overall_threshold.

source

Result Types

SienaResult

Siena.SienaResult — Type
SienaResult

Result of SAOM estimation.

Fields

  • data::SienaData: Independent snapshot of the fitted data for gof(result).
  • derivative_matrix::Matrix{Float64}: Raw final moment derivative, in parameter order.
  • phase3_cov::Matrix{Float64}: Final simulated statistic covariance, in parameter order.
  • condition_number::Float64: Two-norm condition number of the raw derivative matrix.
  • n_refinements::Int: Newton updates performed after Robbins-Monro.
  • convergence_threshold::Float64: Required per-parameter convergence threshold.
  • overall_convergence_threshold::Float64: Required overall convergence threshold.
  • effects::SienaEffects: The effects object that was estimated — with algorithm.model_type != :standard this holds only the effects of the simulated dependent variables (see restrict_effects), which is what θ is aligned with
  • parameter_names::Vector{String}: Names of the free parameters (θ order)
  • estimates::Vector{Float64}: Estimates of the full free-parameter vector
  • standard_errors::Vector{Float64}: Standard errors
  • t_ratios::Vector{Float64}: Convergence t-ratios (deviation / sd of simulated statistic)
  • covariance::Matrix{Float64}: Covariance matrix of the estimates
  • converged::Bool: Whether all per-parameter |t-ratios| are below the threshold (default 0.1) and the overall maximum convergence ratio is below its threshold (default 0.25), the RSiena publication standard
  • tconv_max::Float64: Overall maximum convergence ratio (RSiena's tconv.max)
  • diverged::Bool: Whether a parameter hit the divergence clamp during estimation (estimates are then unreliable)
  • n_iterations::Int: Number of Robbins-Monro iterations used (phases 1 and 2; capped by algorithm.max_iterations when that budget is set)
  • rate_estimates::Dict{Symbol, Vector{Float64}}: Basic rate estimates per variable and period
  • targets::Vector{Float64}: Observed target statistics
  • simulated_means::Vector{Float64}: Mean simulated statistics at the estimates (phase 3)
  • n_simulations_run::Int: Total number of period simulations actually performed over all phases (Robbins-Monro iterations, derivative estimation and phase 3)
  • n_threads_used::Int: Number of threads the independent simulations actually ran on — Threads.nthreads() with algorithm.threaded = true, and 1 with algorithm.threaded = false
  • model_type::Symbol: The algorithm.model_type the fit ran under (:standard, :networkonly or :behavioronly); simulations from the result (e.g. siena_gof) freeze the same dependent variables
  • conditional::Bool, condvar: Whether the fit was conditional, and on which variable
  • rate_standard_errors::Dict{Symbol, Vector{Float64}}: Standard errors of the basic rates per variable and period (for the conditioning variable, RSiena's simulation rate × sd of the stopping time)
  • n_validations::Int: Independent phase-3 batches run (1 + re-entries)
  • derivative_method::Symbol: :score or :finite_difference — how the derivative matrix behind the standard errors was estimated
  • score_test::Union{Nothing, SienaScoreTest}: Score-type tests of the effects included with fix=true, test=true (see SienaScoreTest)
  • phase3_period_stats, phase3_period_scores (simulations × parameters × periods) and period_targets (parameters × periods): the per-period phase-3 statistics, trajectory scores and targets, kept for siena_time_test

Example

using Siena, NetworkCore, Random
s50 = load_dataset(:s50)
data = siena_data()
add_dependent!(data, DependentNetwork(:friendship, s50.friendship))
effects = get_effects(data)
include_effects!(effects, :friendship, [:outdegree, :recip])
fit = fit_siena(data, effects; rng=MersenneTwister(2),
                algorithm=SienaAlgorithm(verbose=false, phase3_iterations=200))
fit.rate_estimates[:friendship]        # conditional rate estimates, one per period
source
Siena.SienaConvergenceError — Type
SienaConvergenceError <: Exception

The final independent simulation batch did not validate a Siena fit. It is raised only when the fit was asked to fail on non-convergence with SienaAlgorithm(allow_unconverged=false); by default (allow_unconverged=true, as in RSiena) an unconverged fit is returned with a warning and converged = false. The diagnostic SienaResult is available as error.result; it is not a converged estimate.

Example

using Siena, NetworkCore, Random
s50 = load_dataset(:s50)
data = siena_data()
add_dependent!(data, DependentNetwork(:friendship, s50.friendship))
effects = get_effects(data)
include_effects!(effects, :friendship, [:outdegree, :recip])
# An impossible convergence threshold forces the error.
alg = SienaAlgorithm(verbose=false, phase3_iterations=100, allow_unconverged=false,
                     convergence_threshold=1e-6, revalidate_max=0, refine_max=0)
err = try
    fit_siena(data, effects; algorithm=alg, rng=MersenneTwister(1)); nothing
catch e
    e
end
err isa SienaConvergenceError && !err.result.converged      # true
source
Siena.SienaScoreTest — Type
SienaScoreTest

Score-type tests (Schweinberger 2012) of effects held fixed at their initial value with include_effects!(...; fix=true, test=true) — RSiena's test=TRUE. Returned in result.score_test by fit_siena.

The tested statistics are simulated in phase 3 together with the estimated ones. With $e$ the deviations (simulated minus observed), $D$ the score-function derivative matrix and $Σ$ the covariance of the statistics, partitioned into the estimated (1) and tested (2) parts, the test uses the deviation of the tested statistics orthogonalised against the estimated ones, $o = e_2 - D_{21} D_{11}^{-1} e_1$, whose variance is $V = Σ_{22} - D_{21}D_{11}^{-1}Σ_{12} - Σ_{21}D_{11}^{-T}D_{21}' + D_{21}D_{11}^{-1}Σ_{11}D_{11}^{-T}D_{21}'$, and $o' V^{-1} o$ is referred to a chi-square distribution — RSiena's EvaluateTestStatistic.

Fields

  • names::Vector{String}: Short names of the tested effects
  • fixed_values::Vector{Float64}: The values they were held at
  • chisq::Float64, df::Int, p_value::Float64: The joint test
  • effect_chisq::Vector{Float64}, effect_p_values::Vector{Float64}: One-df tests of each effect alone (the other tested effects left out, as RSiena does)
  • one_sided::Vector{Float64}: Signed one-df statistics ($\approx N(0,1)$; positive when the parameter would be estimated above its fixed value)
  • one_step::Vector{Float64}: One-step estimates of the tested parameters

Example

using Siena, NetworkCore, Random
s50 = load_dataset(:s50)
data = siena_data()
add_dependent!(data, DependentNetwork(:friendship, s50.friendship))
effects = get_effects(data)
include_effects!(effects, :friendship, [:outdegree, :recip])
include_effects!(effects, :friendship, [:transTrip]; fix=true, test=true)
fit = fit_siena(data, effects; rng=MersenneTwister(3),
                algorithm=SienaAlgorithm(verbose=false, phase3_iterations=200))
fit.score_test.p_value < 0.05       # transitivity is strongly needed
source

SimulationResult

Siena.SimulationResult — Type
SimulationResult

Result of simulating a period.

Fields

  • final_state::NetworkState: snapshot of the state at the end of the period
  • n_network_changes::Dict{Symbol, Int}: number of tie changes per network
  • n_behavior_changes::Dict{Symbol, Int}: number of behavior changes per behavior

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
effects = get_effects(data)
include_effects!(effects, :advice, [:outdegree, :recip])
state, periods = simulate_saom(data, effects, [2.0, -1.0, 0.5]; rng=Siena.Random.Xoshiro(1))
periods[1] isa SimulationResult, periods[1].n_network_changes[:advice]
source

Effects Management Types

EffectEntry

Siena.EffectEntry — Type
EffectEntry

An entry in the effects table, combining an effect with its inclusion status and parameters.

Fields

  • effect::AbstractEffect: The effect itself
  • name::String: Display name
  • shortname::String: Short name for output
  • include::Bool: Whether effect is included in model
  • fix::Bool: Whether parameter is fixed
  • test::Bool: Whether to run a score-type test of the (fixed) value — RSiena's test=TRUE; only meaningful together with fix=true
  • initial_value::Float64: Initial parameter value
  • parameter::Int: Parameter group (for rate effects)

Example

using Siena
entry = EffectEntry(ReciprocityEffect(:advice); shortname="recip", include=true)
entry.include, entry.fix        # (true, false)
source

SienaEffects

Siena.SienaEffects — Type
SienaEffects

Collection of effects for SAOM estimation.

Fields

  • effects::Vector{EffectEntry}: All effect entries
  • variable_names::Vector{Symbol}: Names of dependent variables

Example

using Siena
w1 = [0 1 0; 0 0 1; 1 0 0]
w2 = [0 1 1; 0 0 1; 0 0 0]
data = siena_data()
add_dependent!(data, DependentNetwork(:advice, [w1, w2]))
effects = get_effects(data)
include_effects!(effects, :advice, [:outdegree, :recip])
length(get_included_effects(effects))      # the basic rate and 2 effects
source

GOF Types

SienaGOFResult

The detailed, RSiena-style result returned by siena_gof.

Siena.SienaGOFResult — Type
SienaGOFResult{S<:AbstractGOFStatistic}

Result of a siena_gof goodness of fit assessment for ONE statistic (RSiena-style, keeping the Mahalanobis machinery). Convertible to the ecosystem-wide GOFResult (from NetworkCore.jl) via GOFResult(result), which is also what the shared gof generic returns; display goes through the shared GOF table.

Fields

  • statistic::S: The GOF statistic used
  • labels::Vector{String}: Labels of the statistic's components
  • observed::Vector{Int}: Observed values (summed over periods)
  • simulated::Matrix{Int}: Simulated values (nsim × ncomponents)
  • p_values::Vector{Float64}: Monte-Carlo two-sided p-values per component, with the (1 + k)/(N + 1) estimator (never exactly 0)
  • mahalanobis::Float64: Mahalanobis distance of the observed vector
  • p_overall::Float64: Monte-Carlo p-value of the Mahalanobis distance
  • periods::Vector{Int}: The periods whose end states were compared (all of them, joined, by default — RSiena's join=TRUE)

Example

using Siena, NetworkCore, Random
s50 = load_dataset(:s50)
data = siena_data()
add_dependent!(data, DependentNetwork(:friendship, s50.friendship))
effects = get_effects(data)
include_effects!(effects, :friendship, [:outdegree, :recip, :transTrip])
fit = fit_siena(data, effects; rng=MersenneTwister(1),
                algorithm=SienaAlgorithm(verbose=false, phase3_iterations=200))
detail = siena_gof(fit, data, OutdegreeDistribution(:friendship); n_sim=50,
                   rng=Xoshiro(2))
detail.periods             # [1, 2]: both periods, joined
source

GOFResult

GOFResult is the ecosystem-wide GOF container from NetworkCore.jl (re-exported by Siena). It is returned by the shared gof generic, and any SienaGOFResult can be converted to it.

NetworkCore.GOFResult — Type
GOFResult(result::SienaGOFResult; model="SAOM") -> GOFResult

Convert an RSiena-style SienaGOFResult to the ecosystem-wide GOFResult (from NetworkCore.jl), carrying the Monte-Carlo p-value of the Mahalanobis distance as the overall p-value.

Example

using Siena, NetworkCore, Random
s50 = load_dataset(:s50)
data = siena_data()
add_dependent!(data, DependentNetwork(:friendship, s50.friendship))
effects = get_effects(data)
include_effects!(effects, :friendship, [:outdegree, :recip])
fit = fit_siena(data, effects; rng=MersenneTwister(1),
                algorithm=SienaAlgorithm(verbose=false, phase3_iterations=200))
detail = siena_gof(fit, data, TriadCensus(:friendship); n_sim=20, rng=Xoshiro(4))
GOFResult(detail).p_overall == detail.p_overall      # true
source

AbstractGOFStatistic

Siena.AbstractGOFStatistic — Type
AbstractGOFStatistic

Abstract type for goodness of fit statistics.

Example

using Siena
IndegreeDistribution(:friendship) isa AbstractGOFStatistic     # true
source

IndegreeDistribution

Siena.IndegreeDistribution — Type
IndegreeDistribution(variable; levls=0:8, cumulative=true) <: AbstractGOFStatistic

Indegree distribution, as RSiena's sienaGOF auxiliary statistic IndegreeDistribution: for every level $k$ in levls, the number of actors with indegree $\le k$ (cumulative=true, RSiena's default) or $= k$.

The levels are FIXED in advance and never derived from the observed network. Before 0.2 they defaulted to 0:maximum(observed indegree), which dropped simulated mass above the observed maximum and made the test statistic depend on the data; with the in-sample covariance the test then rejected a correct model 15.7 % of the time at the 5 % level.

Example

using Siena
IndegreeDistribution(:friendship).levls          # 0:8
IndegreeDistribution(:friendship; levls=0:4, cumulative=false)
source

OutdegreeDistribution

Siena.OutdegreeDistribution — Type
OutdegreeDistribution(variable; levls=0:8, cumulative=true) <: AbstractGOFStatistic

Outdegree distribution, as RSiena's OutdegreeDistribution (see IndegreeDistribution for the levels).

Example

using Siena
OutdegreeDistribution(:friendship; levls=0:10).levls     # 0:10
source

TriadCensus

Siena.TriadCensus — Type
TriadCensus(variable) <: AbstractGOFStatistic

Full 16-type Davis–Leinhardt triad census (003, 012, 102, 021D, 021U, 021C, 111D, 111U, 030T, 030C, 201, 120D, 120U, 120C, 210, 300), as RSiena's TriadCensus.

Example

using Siena
TriadCensus(:friendship).variable                # :friendship
source

GeodesicDistribution

Siena.GeodesicDistribution — Type
GeodesicDistribution(variable; max_dist=5, cumulative=true) <: AbstractGOFStatistic

Geodesic (shortest path) distribution, as RSiena's GeodesicDistribution: for $k = 1, …,$ max_dist, the number of ordered pairs at distance $\le k$ (cumulative=true, RSiena's default) or $= k$; the non-cumulative form adds the pairs that are farther apart or unreachable.

Example

using Siena
GeodesicDistribution(:friendship; max_dist=4).max_dist      # 4
source

BehaviorDistribution

Siena.BehaviorDistribution — Type
BehaviorDistribution(variable; levls=nothing, cumulative=true) <: AbstractGOFStatistic

Behaviour distribution, as RSiena's BehaviorDistribution: for every level of the behaviour's range (or of levls), the number of actors with a value $\le$ that level (cumulative=true) or $=$ it.

Example

using Siena
BehaviorDistribution(:alcohol; cumulative=false).cumulative      # false
source

NetworkCore.jl bridge

Siena.NetworkIntegration — Module
Siena.NetworkIntegration

The NetworkCore.jl bridge: constructors of DependentNetwork, ConstantDyadCovariate and VaryingDyadCovariate (and their RSiena-style aliases) from Network/BipartiteNetwork waves, honouring the ecosystem's missing-data and conversion contracts. Loaded with Siena; nothing in it needs to be called by its module name.

Example

using Siena, NetworkCore
waves = load_dataset(:s50).friendship
dep = DependentNetwork(:friendship, waves)        # through Siena.NetworkIntegration
n_waves(dep)                                      # 3
source