*! version 1.0.1 27may2026

Title

dnqr_simulate -- Monte Carlo data simulator for NQAR / DNQR

Syntax

dnqr_simulate , n(#) t(#) [options]

Required
n(#) cross-sectional dimension

t(#) time-series dimension (after burn-in)

Network
wtype(string) powerlaw (default), block, dyad or asym

wparam(#) topology parameter (default 2.5)

wname(string) name under which to store the network matrix (default Wsim)

mata store the network as a Mata matrix instead of a Stata matrix

Parameters
burnin(#) burn-in length (default 50)

errordist(string) innovation: normal (default), t or chi

errordf(#) degrees of freedom (for t / chi); default 5

gamma1(#) contemporaneous network coefficient (default 0.20)

gamma2(#) lagged-network coefficient (default 0.30)

gamma3(#) own-lag coefficient (default 0.30)

z(#) number of time-invariant nodal covariates to add (default 0)

factors(#) number of time-varying common factors (default 0)

seed(#) RNG seed (default 1234)

Output
clear drop all variables before writing the simulated data

genvar(string) name of the dependent variable (default y)

idvar(string) name of the panel id (default id)

timevar(string) name of the time variable (default t)

Description

dnqr_simulate generates an N x T panel that follows the DNQR data
generating process:

Yit = gamma1 sum_j w_{ij} Yjt +
gamma2 sum_j w_{ij} Y_{j,t-1} +
gamma3 Y_{i,t-1} +
Zi'beta_z + sum_k F_{tk} beta_f +
epsilonit

where the network W is drawn from one of four common topologies (power
law, block, dyad-symmetric or simple asymmetric). The user controls the
innovation distribution (normal, Student-t or centred chi^2)
and the true parameter vector. After burn-in, the simulator writes the
long-form panel to the current dataset, xtsets it and stores the
network matrix under a user-chosen name (Stata or Mata) ready for
nqar / dnqr.

Options

n(#) and t(#) set the panel dimensions.

wtype() selects the network topology. See
Network generators below.

wparam(#) a scalar parameter of the chosen generator:

powerlaw: the tail exponent (smaller = denser);

block: the number of blocks;

dyad: the dyadic edge density (fraction of all pairs);

asym: half-width of the adjacency band.

wname() the name under which the network is stored. Pair
with mata to receive a Mata matrix.

burnin(#) discards the first # simulated time periods.

errordist() and errordf(#) control the innovation
distribution.

gamma1 gamma2 gamma3 set the true coefficients used by the
DGP.

z(#) adds # time-invariant nodal covariates named
Z1, Z2, ...; similarly factors(#) adds F1, F2, ...
common factors.

seed(#) sets the Mata random-number seed.

clear drops all variables before writing simulated data.

Examples

. * 1. small Monte Carlo replication

. dnqr_simulate, n(60) t(40) gamma1(0.25) z(2) factors(2) clear wname(W)

. dnqr y, network(W) rowstd q(0.1 0.5 0.9) z(Z1 Z2) factors(F1 F2)

. * 2. heavy-tailed innovations and block network

. dnqr_simulate, n(100) t(60) wtype(block) wparam(5) errordist(t) errordf(5) clear wname(W)

. * 3. store W as a Mata matrix and call dnqr with -mata-

. dnqr_simulate, n(80) t(40) wname(Wm) mata clear

. dnqr y, network(Wm) mata rowstd q(0.1 0.5 0.9)

Returned results

r(N) cross-section size

r(T) time-series length

r(Wd) network density (share of nonzero entries off-diagonal)

r(wname) name under which W is stored

Also see

Package TOC: dnqrlib

Estimators: nqar, dnqr

Plotting / impulse: dnqr_plot, dnqr_impulse

Author: Dr Merwan Roudane -
merwanroudane920@gmail.com