§4, (9), Appendix A.2 — cluster assignments, external cluster neighbours and the cluster DN estimator
DefinitionDiffNeighbors_Bias_Supplement_ClusterModeldifferences-in-neighborsnetwork-interferencep2o-batch-supp500p2o-gran-per-chapterp2o-plan-paperp2o-v1
Let assign each unit to a cluster label. Its nonempty fibres are the partition. A cluster assignment induces . Set
With the published weights and , Equation (9) is
The expectation uses the published finite Bernoulli expectation on : clusters are independent, while units in one cluster share treatment. Unused labels have no effect. In an empty population the estimator and ATE are zero.
The own cluster is excluded following p. 28, which resolves the ambiguity on p. 13. Including it would introduce bias even for constant outcomes. Each external cluster contributes once, while individual outcomes remain separate.
Definition code
import Mathlib
import Definitions.Def_DiffNeighbors_Bias_Model
noncomputable section
namespace DiffNeighbors.Bias.Supplement
variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ]
/-- A cluster map c : ι → κ encodes the partition by its nonempty fibres.
Each cluster receives one treatment; units inherit it (§4, p. 12).
Unused cluster labels are harmless independent Bernoulli coordinates. -/
def unitTreatment (c : ι → κ) (zc : κ → Bool) : ι → Bool := fun i => zc (c i)
/-- Clusters containing neighbours of i, EXCLUDING its own cluster.
This follows the explicit convention in Appendix A.2, p. 28. -/
def clusterNeighbors (G : SimpleGraph ι) [DecidableRel G.Adj] (c : ι → κ)
(i : ι) : Finset κ := ((G.neighborFinset i).image c).erase (c i)
/-- d_i^C, the number of neighbours in i's own cluster (p. 13). -/
def withinDegree (G : SimpleGraph ι) [DecidableRel G.Adj] (c : ι → κ) (i : ι) : ℕ :=
((G.neighborFinset i).filter (fun j => c j = c i)).card
/-- d_i - d_i^C, expressed as a cardinality to avoid truncated subtraction.
These are precisely the neighbours outside the unit's own cluster. -/
def outsideDegree (G : SimpleGraph ι) [DecidableRel G.Adj] (c : ι → κ) (i : ι) : ℕ :=
((G.neighborFinset i).filter (fun j => c j ≠ c i)).card
/-- The cluster DN estimator (9), p. 13, with the cluster-neighbour convention
of p. 28. eta, xi, and the normalization are the published base definitions.
The expectation is bernExp p on κ, i.e. independent cluster assignments,
NOT independent unit assignments. For an empty population the finite sum is 0. -/
def dnCluster (G : SimpleGraph ι) [DecidableRel G.Adj] (c : ι → κ) (p : ℝ)
(f : ι → (ι → Bool) → ℝ) (zc : κ → Bool) : ℝ :=
(Fintype.card ι : ℝ)⁻¹ * ∑ i,
(eta p (unitTreatment c zc) i + xi p (unitTreatment c zc) i *
∑ C ∈ clusterNeighbors G c i, eta p zc C) * f i (unitTreatment c zc)
end DiffNeighbors.Bias.Supplement
end
Source
Peng, Ye, Zheng, Differences-in-Neighbors for Network Interference in Experiments, arXiv:2503.02271v1, pp. 12–13, §4, (9); p. 28, Appendix A.2