Stand-alone estimation of exchangeable variance matrix based on residuals and design matrix.
vnet(e = NULL, X = NULL, directed = TRUE, nodes = NULL,
type = "exchangeable", tmax = 1, fit = NULL)
Optional vector of residuals, of length \(d\). Column-wise unfolding of adjacency matrix without diagonal entries (self-loops).
Optional matrix of covariates from regression, must have \(d\) rows.
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 \(d \times 2\) matrix indicating the (directed) relation pairs to which each entry in \(e\) and each row in \(X\) corresponds. If not input, complete network observation is assumed and the size \(d\) and directed
must correspond to an appropriate network of size \(n\).
Optional string indicating whether the `meat' in the sandwich variance estimator is estimated using exchangeable theory (see Marrs et. al. (2017)) or using dyadic clustering (Fafchamps and Gubert (2007)).
Optional numeric of third dimension of relational data array, default is 1
, i.e. a relational matrix. Currently only accepts tmax = 1
.
Optional fitted model object. One of either fit
or the pair (e, X)
must be specified. Defaults to fit
if both entered. Designed around `lmnet' class but may work for others, such as `lm'
A an object of class vhat
containing summary information:
Estimated variance-covariance matrix of cofficient estimates \(\hat{\beta}\).
Vector of variance-covariance parameter estimates.
Logical of whether variance-covariance matrix was corrected from negative definite to positive semi-definite.
See inputs.
See inputs.
This function takes \(X\) and \(e\) values computes the variance-covariance matrix of \(\hat{\beta}\) that resulted in the residuals \(e = Y - X \hat{\beta}\) assuming that the errors are exchangeable, as based on Marrs et. al. (2017) when type = "exchangeable"
. When type = "dyadic clustering"
, the theory from Fafchamps and Gubert (2007) is implemented.
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.
Fafchamps, M., & Gubert, F. (2007). Risk sharing and network formation. American Economic Review, 97(2), 75-79.
# NOT RUN {
set.seed(1)
n <- 10
d <- n*(n-1)
X <- cbind(1, rnorm(d), sample(c(0,1), d, replace=TRUE))
e <- rnorm(d)
vnet(e=e,X=X)
# }
Run the code above in your browser using DataLab