tests: Tests of network measures

testsR Documentation

Tests of network measures

Description

These functions conduct tests of any network-level statistic:

  • test_random() performs a conditional uniform graph (CUG) test of a measure against a distribution of measures on random networks of the same dimensions.

  • test_permutation() performs a quadratic assignment procedure (QAP) test of a measure against a distribution of measures on permutations of the original network.

Usage

test_random(
  .data,
  FUN,
  ...,
  times = 1000,
  strategy = "sequential",
  verbose = FALSE
)

test_permutation(
  .data,
  FUN,
  ...,
  times = 1000,
  strategy = "sequential",
  verbose = FALSE
)

Arguments

.data

A manynet-consistent network. See e.g. manynet::as_tidygraph() for more details.

FUN

A graph-level statistic function to test.

...

Additional arguments to be passed on to FUN, e.g. the name of the attribute.

times

Integer indicating number of simulations used for quantile estimation. (Relevant to the null hypothesis test only - the analysis itself is unaffected by this parameter.) Note that, as for all Monte Carlo procedures, convergence is slower for more extreme quantiles. By default, times=1000. 1,000 - 10,000 repetitions recommended for publication-ready results.

strategy

If {furrr} is installed, then multiple cores can be used to accelerate the function. By default "sequential", but if multiple cores available, then "multisession" or "multicore" may be useful. Generally this is useful only when times > 1000. See {furrr} for more.

verbose

Whether the function should report on its progress. By default FALSE. See {progressr} for more.

See Also

Other models: regression, test_distributions

Examples

marvel_friends <- to_unsigned(ison_marvel_relationships)
marvel_friends <- to_giant(marvel_friends) %>% 
  to_subgraph(PowerOrigin == "Human")
# (cugtest <- test_random(marvel_friends, manynet::net_heterophily, attribute = "Attractive",
#   times = 200))
# plot(cugtest)
# (qaptest <- test_permutation(marvel_friends, 
#                 manynet::net_heterophily, attribute = "Attractive",
#                 times = 200))
# plot(qaptest)

migraph documentation built on Sept. 12, 2024, 7:39 a.m.