# qaptest

From sna v2.6
0th

Percentile

##### Perform Quadratic Assignment Procedure (QAP) Hypothesis Tests for Graph-Level Statistics

qaptest tests an arbitrary graph-level statistic (computed on dat by FUN) against a QAP null hypothesis, via Monte Carlo simulation of likelihood quantiles. Note that fair amount of flexibility is possible regarding QAP tests on functions of such statistics (see an equivalent discussion with respect to CUG null hypothesis tests in Anderson et al. (1999)). See below for more details.

Keywords
htest, math, graphs
##### Usage
qaptest(dat, FUN, reps=1000, ...)
##### Arguments
dat

graphs to be analyzed. Though one could in principle use a single graph, this is rarely if ever sensible in a QAP-test context.

FUN

function to generate the test statistic. FUN must accept dat and the specified g arguments, and should return a real number.

reps

integer indicating the number of draws to use for quantile estimation. Note that, as for all Monte Carlo procedures, convergence is slower for more extreme quantiles. By default, reps=1000.

additional arguments to FUN.

##### Details

The null hypothesis of the QAP test is that the observed graph-level statistic on graphs $$G_1,G_2,\dots$$ was drawn from the distribution of said statistic evaluated (uniformly) on the set of all relabelings of $$G_1,G_2,\dots$$. Pragmatically, this test is performed by repeatedly (randomly) relabeling the input graphs, recalculating the test statistic, and then evaluating the fraction of draws greater than or equal to (and less than or equal to) the observed value. This accumulated fraction approximates the integral of the distribution of the test statistic over the set of unlabeled input graphs.

The qaptest procedure returns a qaptest object containing the estimated likelihood (distribution of the test statistic under the null hypothesis), the observed value of the test statistic on the input data, and the one-tailed p-values (estimated quantiles) associated with said observation. As usual, the (upper tail) null hypothesis is rejected for significance level alpha if p>=observation is less than alpha (or p<=observation, for the lower tail); if the hypothesis is undirected, then one rejects if either p<=observation or p>=observation is less then alpha/2. Standard caveats regarding the use of null hypothesis testing procedures are relevant here: in particular, bear in mind that a significant result does not necessarily imply that the likelihood ratio of the null model and the alternative hypothesis favors the latter.

In interpreting a QAP test, it is important to bear in mind the nature of the QAP null hypothesis. The QAP test should not be interpreted as evaluating underlying structural differences; indeed, QAP is more accurately understood as testing differences induced by a particular vertex labeling controlling for underlying structure. Where there is substantial automorphism in the underling structures, QAP will tend to given non-significant results. (In fact, it is impossible to obtain a one-tailed significance level in excess of $$\max_{g \in \{G,H\}} \frac{|Aut(g)|}{|Perm(g)|}$$ when using a QAP test on a bivariate graph statistic $$f(G,H)$$, where Aut(g) and Perm(g) are the automorphism and permutation groups on g, respectively. This follows from the fact that all members of Aut(g) will induce the same values of $$f()$$.) By turns, significance under QAP does not necessarily imply that the observed structural relationship is unusual relative to what one would expect from typical structures with (for instance) the sizes and densities of the graphs in question. In contexts in which one's research question implies a particular labeling of vertices (e.g., "within this group of individuals, do friends also tend to give advice to one another"), QAP can be a very useful way of ruling out spurious structural influences (e.g., some respondents tend to indiscriminately nominate many people (without regard to whom), resulting in a structural similarity which has nothing to do with the identities of those involved). Where one's question does not imply a labeled relationship (e.g., is the shape of this group's friendship network similar to that of its advice network), the QAP null hypothesis is inappropriate.

##### Value

An object of class qaptest, containing

testval

The observed value of the test statistic.

dist

A vector containing the Monte Carlo draws.

pgreq

The proportion of draws which were greater than or equal to the observed value.

pleeq

The proportion of draws which were less than or equal to the observed value.

##### References

Anderson, B.S.; Butts, C.T.; and Carley, K.M. (1999). The Interaction of Size and Density with Graph-Level Indices.'' Social Networks, 21(3), 239-267.

Hubert, L.J., and Arabie, P. (1989). Combinatorial Data Analysis: Confirmatory Comparisons Between Sets of Matrices.'' Applied Stochastic Models and Data Analysis, 5, 273-325.

Krackhardt, D. (1987). QAP Partialling as a Test of Spuriousness.'' Social Networks, 9 171-186.

Krackhardt, D. (1988). Predicting With Networks: Nonparametric Multiple Regression Analyses of Dyadic Data.'' Social Networks, 10, 359-382.

cugtest

• qaptest
##### Examples
# NOT RUN {
#Generate three graphs
g<-array(dim=c(3,10,10))
g[1,,]<-rgraph(10)
g[2,,]<-rgraph(10,tprob=g[1,,]*0.8)
g[3,,]<-1; g[3,1,2]<-0              #This is nearly a clique

#Perform qap tests of graph correlation
q.12<-qaptest(g,gcor,g1=1,g2=2)
q.13<-qaptest(g,gcor,g1=1,g2=3)

#Examine the results
summary(q.12)
plot(q.12)
summary(q.13)
plot(q.13)
# }

Documentation reproduced from package sna, version 2.6, License: GPL (>= 2)

### Community examples

Looks like there are no examples yet.