This repository supports the paper "Stochastic Gradient Descent Methods and Uncertainty Quantification in Extended CLSNA Models".
-
simulation/
: This directory includesmain.ipynb
andsimulate_congress.ipynb
. Themain.ipynb
notebook serves as the entry point for simulations with synthetic data. It simulates a dynamic network from the CLSNA model with a fixed number of members and fits the extended CLSNA model to the simulated data for inference. Thesimulate_congress.ipynb
simulates a dynamic network with changing membership and fit the extended CLSNA model to the simulated data for inference. -
X/207/
: Contains the207.ipynb
file, which is the primary script for analyzing Twitter congressional hashtag networks with 207 nodes. These nodes represent members who were consistently present throughout the study period. -
X/505/
: Contains the505.ipynb
file, analyzing the same Twitter congressional hashtag networks, but includes all nodes recorded during the study. -
X/yearly/
: This directory contains raw network data files namedaggregated_network_hashtag_intersection_year***.csv
. Additionally, thenetwork_features.csv
file provides metadata about the actors in the network. -
X/compare/
: The entry point here iscompare.ipynb
, which plots the trajectory of the mean latent positions of the members of each party, comparing the model fitting result from the reduced dataset in207.ipynb
and the full dataset in505.ipynb
.
Each notebook (main.ipynb
, simulate_congress.ipynb
, 207.ipynb
, and 505.ipynb
) can be executed from top to bottom. They call helper functions and classes from utils.py
and congress_utils.py
. Each notebook follows a unified structure with three primary steps:
-
Initial CLSNA Model Fit: Start with a CLSNA model with a higher-dimensional space than the intended dimension. The model is then fitted, utilizing the first
p
principal components of the fitted latent position as the initial values for the next step. -
Point Estimation: A model with the targeted dimension is fitted. The outputs are point estimations for model parameters.
-
Variance/Covariance Estimation: Perform variance/covariance estimation for the parameters of interest.
Each step is unified under an SGD approach and utilizes a unified nn.module
class from the PyTorch autodifferentiation library, defined in utils.py
and congress_utils.py
.
To report bugs encountered while running the code, please contact Hancong Pan at [email protected].