cugtest
tests an arbitrary GLI (computed on dat
by FUN
) against a conditional uniform graph null hypothesis, via Monte Carlo simulation. Some variation in the nature of the conditioning is available; currently, conditioning only on size, conditioning jointly on size and estimated tie probability (via expected density), and conditioning jointly on size and (bootstrapped) edge value distributions are implemented. Note that fair amount of flexibility is possible regarding CUG tests on functions of GLIs (Anderson et al., 1999). See below for more details.
cugtest(dat, FUN, reps=1000, gmode="digraph", cmode="density", diag=FALSE, g1=1, g2=2, ...)
FUN
must accept dat
and the specified g
arguments, and should return a real number. reps==1000
. gmode
is set to "digraph" by default. cmode
is set to "density", then the density of the graph in question is used to determine the tie probabilities of the Bernoulli graph draws (which are also conditioned on |V(G)|). Ifcmode=="ties"
, then draws are bootstrapped from the distribution of edge values within the data matrices. If cmode="order"
, then draws are uniform over all graphs of the same order (size) as the graphs within the input stack. By default, cmode
is set to "density"
.diag
is FALSE
by default. g1==1
. FUN
can ignore this, if one wishes to test the GLI value of a single graph, but it should recognize the argument.) By default, g2==2
. FUN
. cugtest
, containingcug.test
for CUG tests with exact conditioning.) Since theoretical results regarding functions of arbitrary GLIs on the space of graphs are not available, the standard approach to CUG testing is to approximate the quantiles of the observed statistic associated with the null hypothesis using Monte Carlo methods. This is the technique utilized by cugtest
, which takes appropriately conditioned draws from the set of graphs and computes on them the GLI specified in FUN
, thereby accumulating an approximation to the true quantiles.The cugtest
procedure returns a cugtest
object containing the estimated distribution of the test GLI under the null hypothesis, the observed GLI value of the 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).="" standard="" caveats="" regarding="" use="" of="" null="" hypothesis="" testing="" procedures="" are="" relevant="" here:="" in="" particular,="" bear="" mind="" that="" a="" significant="" result="" does="" not="" necessarily="" imply="" likelihood="" ratio="" model="" and="" alternative="" favors="" latter.<="" p="">
Informative and aesthetically pleasing portrayals of cugtest
objects are available via the print.cugtest
and summary.cugtest
methods. The plot.cugtest
method displays the estimated distribution, with a reference line signifying the observed value.
cug.test
, qaptest
, gliop
#Draw two random graphs, with different tie probabilities
dat<-rgraph(20,2,tprob=c(0.2,0.8))
#Is their correlation higher than would be expected, conditioning
#only on size?
cug<-cugtest(dat,gcor,cmode="order")
summary(cug)
#Now, let's try conditioning on density as well.
cug<-cugtest(dat,gcor)
summary(cug)
Run the code above in your browser using DataLab