These functions conduct tests of distributions:
test_distribution() performs a two-sample Kolmogorov-Smirnov test on
whether two "diff_model" objects are drawn from the same distribution.
test_fit() performs a chi-squared test on the squared Mahalanobis distance
between a diff_model and diff_models objects.
test_distribution(diff_model1, diff_model2)
test_fit(diff_model, diff_models)diff_model objects
A diff_model object is returned by
play_diffusion() or as_diffusion() and contains
a single empirical or simulated diffusion.
A diff_models object is returned by
play_diffusions() and contains a series of diffusion simulations.
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
Other models:
regression,
tests
test_distribution(as_diffusion(play_diffusion(ison_networkers)),
as_diffusion(play_diffusion(ison_networkers, thresholds = 75)))
#> # A tibble: 1 × 3
#> statistic p.value nobs
#> <dbl> <dbl> <int>
#> 1 0.667 1 1
# 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_fit(x, y)