Two-Mode Effects
Effects on a two-mode (bipartite) dependent network, where senders and receivers are drawn from different node sets.
See the Effects API Reference for the type hierarchy and the effect interface these all implement.
Two-Mode Network Effects
TwoModeEffect
Siena.TwoModeEffect — Type
TwoModeEffect <: NetworkEffectAbstract type for two-mode network effects.
Example
using Siena
FourCyclesEffect(:attends) isa TwoModeEffect # trueTwoModeOutdegreeEffect
Siena.TwoModeOutdegreeEffect — Type
TwoModeOutdegreeEffect <: TwoModeEffectOutdegree (number of events attended): $s_i = x_{i+}$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeOutdegreeEffect(:attends), state, data)TwoModeIndegreeEffect
Siena.TwoModeIndegreeEffect — Type
TwoModeIndegreeEffect <: TwoModeEffectEvent popularity: $s_i = \sum_e x_{ie} f(x_{+e})$ with $f$ identity or sqrt.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeIndegreeEffect(:attends), state, data)FourCyclesEffect
Siena.FourCyclesEffect — Type
FourCyclesEffect <: TwoModeEffectFour-cycles of a two-mode network: $s_i = \sum_{o \ne i} \binom{s_{io}}{2}$ where $s_{io}$ is the number of shared events of actors $i$ and $o$; the change statistic of a tie is the number of four-cycles it closes. RSiena: cycle4 (internal parameter 1) for bipartite networks; the target statistic is the number of four-cycles (half the actor sum), as RSiena's. Its short name was fourCycles before 0.2 (still accepted by include_effects!).
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(FourCyclesEffect(:attends), state, data)SharedEventsEffect
Siena.SharedEventsEffect — Type
SharedEventsEffect <: TwoModeEffectTotal shared events with other actors: $s_i = \sum_{o \ne i} f(s_{io})$ with $f$ identity or sqrt.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(SharedEventsEffect(:attends), state, data)GWESPTwoModeEffect
Siena.GWESPTwoModeEffect — Type
GWESPTwoModeEffect <: TwoModeEffectGeometrically weighted shared events: $s_i = \sum_{o \ne i} (1 - (1 - e^{-\alpha})^{s_{io}})$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(GWESPTwoModeEffect(:attends), state, data)TwoModeEgoEffect
Siena.TwoModeEgoEffect — Type
TwoModeEgoEffect <: TwoModeEffectActor covariate effect on event attendance: $s_i = v_i x_{i+}$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeEgoEffect(:attends, :age), state, data)TwoModeEventEffect
Siena.TwoModeEventEffect — Type
TwoModeEventEffect <: TwoModeEffectEvent attribute effect: $s_i = \sum_e x_{ie} w_{ie}$ using a dyadic covariate whose rows are actors and columns are events.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeEventEffect(:attends, :fee), state, data)TwoModeSameEffect
Siena.TwoModeSameEffect — Type
TwoModeSameEffect <: TwoModeEffectAttendance with same-covariate others: $s_i = \sum_e x_{ie} \#\{o \ne i : x_{oe} = 1, |v_i - v_o| < 0.5\}$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeSameEffect(:attends, :age), state, data)TwoModeSimilarityEffect
Siena.TwoModeSimilarityEffect — Type
TwoModeSimilarityEffect <: TwoModeEffectCovariate similarity with co-attendees: $s_i = \sum_e x_{ie} \sum_{o \ne i} x_{oe} \, \text{sim}_{io}$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeSimilarityEffect(:attends, :age), state, data)TwoModeActivityEffect
Siena.TwoModeActivityEffect — Type
TwoModeActivityEffect <: TwoModeEffectCo-attendee activity: $s_i = \sum_e x_{ie} \sum_{o \ne i} x_{oe} f(x_{o+})$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeActivityEffect(:attends), state, data)TwoModePopularityAltEffect
Siena.TwoModePopularityAltEffect — Type
TwoModePopularityAltEffect <: TwoModeEffectActors with high outdegree attend popular events: $s_i = x_{i+} \sum_e x_{ie} (x_{+e} - 1)$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModePopularityAltEffect(:attends), state, data)TwoModeTransitiveClosureEffect
Siena.TwoModeTransitiveClosureEffect — Type
TwoModeTransitiveClosureEffect <: TwoModeEffectClosure of four-paths: $s_i = \sum_{o \ne i} s_{io} (s_{io} - 1)$ (twice the four-cycle count).
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeTransitiveClosureEffect(:attends), state, data)TwoModeActorAssortativityEffect
Siena.TwoModeActorAssortativityEffect — Type
TwoModeActorAssortativityEffect <: TwoModeEffectOutdegree assortativity with co-attendees: $s_i = \sum_e x_{ie} \sum_{o \ne i} x_{oe} \, x_{i+} x_{o+}$.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeActorAssortativityEffect(:attends), state, data)TwoModeWithinEffect
Siena.TwoModeWithinEffect — Type
TwoModeWithinEffect <: TwoModeEffectAttendance of events within the actor's own setting: $s_i = \sum_e x_{ie} I(|v_i - w_{ie}| < 0.5)$ where $v$ is the actor setting covariate and $w$ is a dyadic covariate whose $(i, e)$ entry gives the setting of event $e$ (typically constant across rows). Both are compared as given: the covariates' centring is undone, so actor and event settings use the same codes. A Siena.jl effect with no RSiena counterpart.
Example
using Siena
x1 = [1 0 1 0; 0 1 1 0; 1 1 0 0; 0 0 1 1; 1 0 0 1]
x2 = [1 1 1 0; 0 1 1 0; 1 1 0 1; 0 0 1 1; 0 0 1 1]
data = siena_data()
add_nodeset!(data, NodeSet(5))
add_nodeset!(data, NodeSet(4; id=:events))
add_dependent!(data, DependentNetwork(:attends, [x1, x2]; type=:twomode, nodeset2=:events))
add_covariate!(data, ConstantCovariate(:age, [20, 30, 40, 50, 60]))
add_covariate!(data, ConstantCovariate(:club, [1, 1, 2, 2, 1]))
add_covariate!(data, ConstantDyadCovariate(:fee, [Float64(e) for i in 1:5, e in 1:4];
nodeset2=:events))
add_covariate!(data, ConstantDyadCovariate(:eventclub, [Float64(1 + (e > 2)) for i in 1:5, e in 1:4];
nodeset2=:events))
state = initialize!(NetworkState(), data, 2; period=1)
compute_statistic(TwoModeWithinEffect(:attends, :club, :eventclub), state, data)