This function takes \(X\) and \(Y\) values and fits the multiple linear regression \(Y = X \beta + \epsilon\) and returns standard errors.
lmnet(Y, X, directed = TRUE, tmax = 1, nodes = NULL, reweight = FALSE,
type = "exchangeable", tol = 1e-06, maxit = 10000, ndstop = TRUE,
verbose = FALSE)
Vector of relations to be regress, of length \(d\). Column-wise vectorization of adjacency matrix without diagonal entries (self-loops).
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
.
Optional logical indicator of whether input data is for a directed network, default is TRUE
. Undirected data format is lower triangle of adjacencey matrix.
Optional numeric of third dimension of relational data array, default is 1
, i.e. a relational matrix.
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\).
Optional logical indicator of whether iteratively reweighted least squares should be used to compute estimate of \(\beta\). Default is FALSE
.
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.
Optional numeric, tolerance of stopping criteria of iteratively reweighted least squares estimate of \(\beta\). Default is tol=1e-6
.
Optional numeric, maximum number of iterations for iteratively reweighted least squares estimate of \(\beta\). Default is maxit=1e4
.
Optional logical indicator of whether negative definite weighting matrix in iteratively reweighted least squares should stop the descent. Default is TRUE
.
Optional logical indicator of whether information from iteratively reweighted least squares estimate of \(\beta\) should be printed. Default is FALSE
.
An lmnet
object containing summary information.
This function takes \(X\) and \(Y\) values and fits the multiple linear regression \(Y = X \beta + \epsilon\) 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.
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.
# NOT RUN {
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
# }
Run the code above in your browser using DataLab