tests {migraph} | R Documentation |
Conditional uniform graph and permutation tests
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. -
test_gof()
performs a chi-squared test on the squared Mahalanobis distance between a diff_model and diff_models objects.
Usage
test_random(
.data,
FUN,
...,
times = 1000,
strategy = "sequential",
verbose = FALSE
)
test_permutation(
.data,
FUN,
...,
times = 1000,
strategy = "sequential",
verbose = FALSE
)
test_gof(diff_model, diff_models)
Arguments
.data |
An object of a
|
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, |
strategy |
If |
verbose |
Whether the function should report on its progress.
By default FALSE.
See |
diff_model |
A diff_model object is returned by
|
diff_models |
A diff_models object is returned by
|
Mahalanobis distance
test_gof()
takes a single diff_model object,
which may be a single empirical or simulated diffusion,
and a diff_models object containing many simulations.
Note that currently only the goodness of fit of the
It returns a tibble (compatible with broom::glance()
) that includes
the Mahalanobis distance statistic
between the observed and simulated distributions.
It also includes a p-value summarising a chi-squared test on this statistic,
listing also the degrees of freedom and number of observations.
If the p-value is less than the convention 0.05,
then one can argue that the first diffusion is not well captured by
See Also
Other models:
regression
Examples
marvel_friends <- to_unsigned(ison_marvel_relationships)
marvel_friends <- to_giant(marvel_friends) %>%
to_subgraph(PowerOrigin == "Human")
(cugtest <- test_random(marvel_friends, network_heterophily, attribute = "Attractive",
times = 200))
plot(cugtest)
(qaptest <- test_permutation(marvel_friends,
network_heterophily, attribute = "Attractive",
times = 200))
plot(qaptest)
# Playing a reasonably quick diffusion
x <- play_diffusion(generate_random(15), transmissibility = 0.7)
# Playing a slower diffusion
y <- play_diffusions(generate_random(15), transmissibility = 0.1, times = 40)
plot(x)
plot(y)
test_gof(x, y)