*! version 1.0.0	01Aug2018
help netreg

Title

netreg -- linear regression of a network response with the exchangeable assumption

Syntax

netreg
varlist
[if]
[in]
[, undirected withnode reweight tol(real) maxit(#) n_total(#) cilevel(#)]

undirect Optional indicator of whether input data is for a directed network. The default is directed network.
Undirected data format is lower triangle of adjacency matrix.

withnode Optional indicator of whether the (directed) relation pairs to which each entry in Y and each row in X corresponds
is included in the dataset.( the dataset¡¯s last two rows should be integers).

reweight Optional indicator of whether iteratively
reweighted least squares should be used to compute estimate of coefficients.

tol Optional numeric, tolerance of stopping criteria of iteratively
reweighted least squares estimate of coefficients. Default is tol=1e-6.

maxit Optional integer,
maximum number of iterations for iteratively reweighted least squares estimate of coefficients. Default is maxit=50.

n_total Optional numeric, actor size of the network. At least one of n_total or withnode option should be clarified.

cilevel Optional integer. Confidence level of confidence interval being displayed at the result.The default is 95.

Description

netreg provides methods for performing a regression of a network response, where each data point represents an edge on a network or covariates of interest.
It takes advantage of the exchangeable assumption for residuals, and this assumption dramatically simplified the covariance matrix of residuals.
With this new assumption, we can provide a better estimation for the coefficients¡¯ covariance matrix, resulting in an accurate confidence interval for coefficients.
Also, applying exchangeable assumption enables the iteratively reweighted least squares method for better estimation. For more details, see Marrs (2017). This package is also available in R, you can search netregR in R for this package.

By default, data should be arranged column-wise. There are two possible ways to input the varlist:

For the first way, users can clarify the size of actors as n_total in the function and exclude withnode option.
With this setting, complete network observation of adjacency matrix without diagonal entries (self-loops) is assumed.
The function will take the first item of the varlist as the response for each edge.
The rest items in the varlist will be the covariates for corresponding edges.

In the second method, users can clarify withnode option in the function.
With this setting, the first item of varlist will be taken as responses for edges.
The last two items indicate the (directed) relation pairs to which each entry in the varlist corresponds.
The rest items in the varlist represent the covariates of each edge.
Make sure that the last two rows are integers. Otherwise, stata will pop out errors.

The undirect option is for undirected net.
When undirected option being included, this function will automatically consider each edge of this network is undirected.
When one edge corresponds to two data, this function will take the data that first comes out.

The reweight option indicates that iteratively reweighted least squares should be used to compute an estimate of coefficients.
When reweight option is included, users can also declare the tol and maxit option.
The tol is the tolerance of stopping criteria of the iteratively reweighted least squares method.
Here the definition of tolerance is dimensionless, i.e. change of coefficients over the length of coefficients.
The maxit is the maximum number of iterations for iteratively reweighted least squares estimate.

It needs notice that, since the distribution of coefficients is just asymptotically normal, the confidence interval is constructed with normal distribution.

Examples

Here is an example of network linear regression with exchangeable assumption. Data used here is a wolf data from Junk, (1987). It is now available on the author's github website.
One can visit https://github.com/DayouLuo1995/NetregStata/blob/master/wolf.dta for the test data.

. use wolf.dta

. netreg wolf age_diff same_sex wolf1 wolf2,withnode

This is a simple linear regression. The exchangeable assumption is used to construct confidence intervals for coefficients.

. netreg wolf age_diff same_sex,n_total(16)

Also you can give the size of actors in the network and omit relation pairs (wolf1 wolf2). netreg will automatically assume that the data set is complete and is arranged in required order.
However, commands with relation pairs are recommanded because if and in options are avaliable with nodes included.

. netreg wolf age_diff same_sex wolf1 wolf2 , withnode reweight

Here netreg takes advantage of an iteration regression method. For more information, see Marrs (2017).

. use wolf_undirected.dta

. netreg wolf age_diff same_sex wolf1 wolf2, undirect reweight n_total(16)

Iteratively reweighted least squares method for undirected network. The data is avaliable at https://github.com/DayouLuo1995/NetregStata/blob/master/wolf_undirected.dta

Saved results

Scalars

e(N) sample size

Macros

e(depvar) dependent variable

e(cmd) netreg

e(properties) b V

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimators

Function

e(sample) marks estimation sample

References

Marrs, F. W., McCormick, T. H., & Fosdick, B. K. (2017). Standard errors for regression on relational data with exchangeable errors. arXiv preprint arXiv:1701.05530.

Author

Dayou Luo

dayoul@uw.edu