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)

Arguments

diff_model1, diff_model2

diff_model objects

diff_model

A diff_model object is returned by play_diffusion() or as_diffusion() and contains a single empirical or simulated diffusion.

diff_models

A diff_models object is returned by play_diffusions() and contains a series of diffusion simulations.

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, tests

Examples

 # test_distribution(play_diffusion(ison_networkers), 
 #                   play_diffusion(ison_networkers, thresholds = 75))
  # 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)