lmnet: Linear regression for network response

Description Usage Arguments Details Value References See Also Examples

View source: R/lmnet.R

Description

This function takes X and Y values and fits the multiple linear regression Y = X β + ε and returns standard errors.

Usage

1
2
3
lmnet(Y, X, directed = TRUE, tmax = 1, nodes = NULL, reweight = FALSE,
  type = "exchangeable", tol = 1e-06, maxit = 10000, ndstop = TRUE,
  verbose = FALSE)

Arguments

Y

Vector of relations to be regress, of length d. Column-wise vectorization of adjacency matrix without diagonal entries (self-loops).

X

Matrix of covariates to be regressed upon, including intercept if intercept is desired, must have d rows. Ordering of rows should match Y and optional input nodes.

directed

Optional logical indicator of whether input data is for a directed network, default is TRUE. Undirected data format is lower triangle of adjacencey matrix.

tmax

Optional numeric of third dimension of relational data array, default is 1, i.e. a relational matrix.

nodes

Optional d \times 2 matrix indicating the (directed) relation pairs to which each entry in Y and each row in X corresponds. If not input, complete network observation with column-wise vectorization of adjacency matrix without diagonal entries (self-loops) is assumed. The size d and directed must correspond to an appropriate network of size n.

reweight

Optional logical indicator of whether iteratively reweighted least squares should be used to compute estimate of β. Default is FALSE.

type

Optional character specifying degree of exchangeability of third dimension of array (when present, i.e. in temporal relational arrays). Default is exchangeable, and the remaining option is independent. Truncated inputs are accepted. See details below.

tol

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

maxit

Optional numeric, maximum number of iterations for iteratively reweighted least squares estimate of β. Default is maxit=1e4.

ndstop

Optional logical indicator of whether negative definite weighting matrix in iteratively reweighted least squares should stop the descent. Default is TRUE.

verbose

Optional logical indicator of whether information from iteratively reweighted least squares estimate of β should be printed. Default is FALSE.

Details

This function takes X and Y values and fits the multiple linear regression Y = X β + ε by ordinary least squares or iteratively reweighted least squares as indicated by the input. The covariance structure is exchangeable from that of Marrs et. al. (2017). The standard errors and test statistics are based on the same paper.

The three dimensional relational array case, i.e. temporal relational data, requires a specification of the type of exchangeability in this third dimension. We may assume that different time periods are independent. On the other hand, we might assume each repeated observation is exchangeable (for example decomposing trade networks into sectors of trade: goods vs. services). See Figure 6a of Marrs et. al. (2017) for the exchangeable case and the surrounding discussion for the independent case.

Value

fit

An lmnet object containing summary information.

References

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

See Also

vhat_exch, inputs_lmnet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(1)
n <- 10
d <- n*(n-1)
X <- cbind(1, rnorm(d), sample(c(0,1), d, replace=TRUE))
betatrue <- rep(1,3)
Y <- X %*% betatrue + rnorm(d)
fit <- lmnet(Y,X)
fit
fit2 <- lmnet(Y,X,reweight=TRUE)
fit2

netregR documentation built on May 1, 2019, 10:13 p.m.