nacf {sna} | R Documentation |
Sample Network Covariance and Correlation Functions
Description
nacf
computes the sample network covariance/correlation function for a specified variable on a given input network. Moran's and Geary's
statistics at multiple orders may be computed as well.
Usage
nacf(net, y, lag.max = NULL, type = c("correlation", "covariance",
"moran", "geary"), neighborhood.type = c("in", "out", "total"),
partial.neighborhood = TRUE, mode = "digraph", diag = FALSE,
thresh = 0, demean = TRUE)
Arguments
net |
one or more graphs. |
y |
a numerical vector, of length equal to the order of |
lag.max |
optionally, the maximum geodesic lag at which to compute dependence (defaults to order |
type |
the type of dependence statistic to be computed. |
neighborhood.type |
the type of neighborhood to be employed when assessing dependence (as per |
partial.neighborhood |
logical; should partial (rather than cumulative) neighborhoods be employed at higher orders? |
mode |
|
diag |
logical; does the diagonal of |
thresh |
threshold at which to dichotomize |
demean |
logical; demean |
Details
nacf
computes dependence statistics for the vector y
on network net
, for neighborhoods of various orders. Specifically, let be the
th order adjacency matrix of
net
. The sample network autocovariance of on
is then given by
where . Similarly, the sample network autocorrelation in the above case is
, where
is the variance of
. Moran's
and Geary's
statistics are defined in the usual fashion as
and
respectively, where is the order of
and
is the mean of
.
The adjacency matrix associated with the th order neighborhood is defined as the identity matrix for order 0, and otherwise depends on the type of neighborhood involved. For input graph
, let the base relation,
, be given by the underlying graph of
(i.e.,
) if total neighborhoods are sought, the transpose of
if incoming neighborhoods are sought, or
otherwise. The partial neighborhood structure of order
on
is then defined to be the digraph on
whose edge set consists of the ordered pairs
having geodesic distance
in
. The corresponding cumulative neighborhood is formed by the ordered pairs having geodesic distance less than or equal to
in
. For purposes of
nacf
, these neighborhoods are calculated using neighborhood
, with the specified parameters (including dichotomization at thresh
).
The return value for nacf
is the selected dependence statistic, calculated for each neighborhood structure from order 0 (the identity) through order lag.max
(or , if
lag.max==NULL
). This vector can be used much like the conventional autocorrelation function, to identify dependencies at various lags. This may, in turn, suggest a starting point for modeling via routines such as lnam
.
Value
A vector containing the dependence statistics (ascending from order 0).
Author(s)
Carter T. Butts buttsc@uci.edu
References
Geary, R.C. (1954). “The Contiguity Ratio and Statistical Mapping.” The Incorporated Statistician, 5: 115-145.
Moran, P.A.P. (1950). “Notes on Continuous Stochastic Phenomena.” Biometrika, 37: 17-23.
See Also
geodist
, gapply
, neighborhood
, lnam
, acf
Examples
#Create a random graph, and an autocorrelated variable
g<-rgraph(50,tp=4/49)
y<-qr.solve(diag(50)-0.8*g,rnorm(50,0,0.05))
#Examine the network autocorrelation function
nacf(g,y) #Partial neighborhoods
nacf(g,y,partial.neighborhood=FALSE) #Cumulative neighborhoods
#Repeat, using Moran's I on the underlying graph
nacf(g,y,type="moran")
nacf(g,y,partial.neighborhood=FALSE,type="moran")