This function creates the design matrix for a latent network structure using a balanced panel
netdat(datf, Y, X, Wi, W =NULL, panvar, tvar, factors, scaling =TRUE, unicons =TRUE)
Arguments
datf: the entire data frame of balanced panel with NT rows of unit-time observations
Y: dependent variable in the data frame datf
X: the covariate(s) generating spillovers
Wi: other unit-varying (can be time-invariant) control variables
W: global variables. these are only time varying but are common to all units. eg. GDP for individual/state-level data. Note that W has to be a vector of length T so cannot be in the data frame datf
panvar: the panel variable eg. unique person/firm identifiers
tvar: time variable, eg. years
factors: a vector of characters of factors in the data
scaling: a logical indicating whether non-discrete covariates should be scaled by their standard deviations
unicons: a logical indicating whether to include unit-specific constant term