invert_exchangeable_matrix: Invert an exchangeable matrix

Description Usage Arguments Details Value References See Also Examples

View source: R/matrix_ops.R

Description

Invert an exchangeable matrix

Usage

1
invert_exchangeable_matrix(n, phi, directed = TRUE)

Arguments

n

Number of actors in the network, scalar numeric.

phi

Appropriate-length vector of parameters, must be length 5 or 6 for directed=TRUE or length 2 or 3 for directed=FALSE.

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.

Details

This function inverts a covariance matrix of the exchangeable class in a manner much faster than the direct inverse, and the computational cost does not scale with n. See Marrs et. al. (2017). This approach will only work for complete networks.

Value

out

Parameters of inverted matrix of exchangeable class.

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

rphi, build_exchangeable_matrix

Examples

1
2
3
4
5
n <- 10
phi <- rphi(n, seed=1)
p <- invert_exchangeable_matrix(n, phi)
I1 <- build_exchangeable_matrix(n, phi) %*% build_exchangeable_matrix(n, p)
range(I1 -  diag(n*(n-1)))   # it works

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