Perhaps the most common class of statistical models ecologists employ is the linear model. Linear models can be easily applied to predict the effect of one individual attribute on another (e.g., effect of node trait on node position in a network). However, the task is much more difficult when we want to predict the effect of some relational variable on network relations–e.g., how the similarity between two nodes affects the probability of an edge, or how network relations predict the transmission of pathogens. This is because relational data are not independent, so we require methods that can account for this non-independence.
The Mantel Test (Mantel 1967) has long been a useful approach for this type of data. The Mantel Test is a nonparametric matrix correlation test that uses permutations (node-permutations in this case) to get around the problem of non-independence. This test is widely available in several different R packages, for example those focused on community ecology (e.g., ‘ecodist’).
The Quadratic Assignment Procedure (QAP) is an extension of the Mantel Test in a regression framework, developed in the field of psychometrics. The Multiple Regression Quadratic Assignment Procedure (MRQAP) is an extension of this approach to allow for multiple covariate matrices (Krackhardt 1988). Essentially, MRQAP allows you to determine the influence of one matrix on another, controlling for the effects of one or more covariate matrices. There are several forms of MRQAP, but the most popular method is called the Double Semipartialling (DSP) method, developed by Dekker et al. (2007). This method permutes the matrix of residuals from the ordinary least regression of the dependent matrix on the independent matrices, to estimate error and calculate the effects.
MRQAP can be implemented in the R packages ‘sna’ (which is bundled inside ‘statnet’) and ‘asnipe’. There are slight differences between the outputs for the two functions, but the results are nearly the same. Here is a simple code just to illustrate how to implement these:
library(sna)
library(asnipe)
#generate 3 random adjacency matrices using the rgraph() function within sna
set.seed(2)
m1=rgraph(10, m=1, tprob=0.5, mode="graph")
m2=rgraph(10, m=1, tprob=0.5, mode="graph")
m3=rgraph(10, m=1, tprob=0.5, mode="graph")
#test the effect of m2 on m1, controlling for m3. sna package function.
netlm(m1, m2+m3, mode="graph", nullhyp="qap", test.statistic="t-value")
##
## OLS Network Model
##
## Coefficients:
## Estimate Pr(<=b) Pr(>=b) Pr(>=|b|)
## (intercept) 0.6245211 0.998 0.002 0.002
## x1 -0.0862069 0.177 0.828 0.365
##
## Residual standard error: 0.5044 on 43 degrees of freedom
## F-statistic: 0.6778 on 1 and 43 degrees of freedom, p-value: 0.4149
## Multiple R-squared: 0.01552 Adjusted R-squared: -0.007378
#test the effect of m2 on m1 controlling for m3, and effect of m3 on m1, controlling for m2. asnipe package function.
mrqap.dsp(m1~m2+m3, directed="undirected")
## MRQAP with Double-Semi-Partialing (DSP)
##
## Formula: m1 ~ m2 + m3
##
## Coefficients:
## Estimate P(β>=r) P(β<=r) P(|β|<=|r|)
## intercept 0.62001925 1.000 0.000 0.000
## m2 0.05813282 0.678 0.322 0.664
## m3 -0.23561116 0.064 0.936 0.123
##
## Residual standard error: 0.5002 on 42 degrees of freedom
## F-statistic: 1.202 on 2 and 42 degrees of freedom, p-value: 0.3106
## Multiple R-squared: 0.05416 Adjusted R-squared: 0.00912
## AIC: -40.77726
Next: 8. Diffusion in Networks