gof_stats {multigraphr}R Documentation

Exact probability distributions and moments of goodness of fit statistics

Description

Goodness of fit between two specified edge multiplicity sequences (e.g. observed vs. expected). Pearson (S) and information divergence (A) tests statistics are used and the exact distribution of these statistics, their asymptotic chi^2-distributions, and their first two central moments are calculated using this function. Only practical for small multigraphs.

Usage

gof_stats(m, dof, m.seq, prob.mg, Q.seq)

Arguments

m

integer giving number of edges in multigraph.

dof

integer giving degrees of freedom of test performed.

m.seq

matrix of integers, each row representing the edge multiplicity sequence of a multigraph (which correspond to observed values).

prob.mg

numerical vector representing a given probability distribution of multigraphs/edge multiplicity sequences in m.seq.

Q.seq

a numeric vector representing the hypothetical edge assignment probabilities to all possible vertex pair sites (from which expected values are calculate).

Details

The tests are performed using goodness-of-fit measures between two edge multiplicity sequences (e.g. observed vs. expected).

Test statistics of Pearson type (S) and of information divergence (A) type are used and summary of tests given these two statistics are given as output. The adjusted statistics and chi^2-distributions are useful for better power calculations.

Value

test.summary

Expected value and variances of test statistics (stat), critical values (cv) according to asymptotic chi^2-distribution and according to cdf's of test statistics, significance level (alpha) according to asymptotic chi^2 distribution, power of tests (P(stat>cv)), critical values and power according to the distributions of test statistics (cv(stat) and P(Stat>cv(Stat))).

degrees.of.freedom

Degrees of freedom for tests performed.

probS

Probability distributions of Pearson statistic S.

probA

Probability distributions of information divergence statistic A.

adjusted.stats

Expected values and variances for adjusted test statistics, preferred adjusted statistics.

adjusted.chi2

Degrees of freedom for adjusted chi^2-distribution.

power.apx

Power approximations according to adjusted statistics.

Author(s)

Termeh Shafie

References

Shafie, T. (2015). A Multigraph Approach to Social Network Analysis. Journal of Social Structure, 16.

Shafie, T. (2016). Analyzing Local and Global Properties of Multigraphs. The Journal of Mathematical Sociology, 40(4), 239-264.

See Also

gof_sim,get_edge_assignment_probs, nsumk

Examples

# Generate a set of edge multiplicity sequences (random multigraphs) and
# its probability distribution using rsm_model() with degree sequence [4,4,6,6]
rsm <- rsm_model(deg.seq = c(4,4,6,6))
mg <- as.matrix(rsm$m.seq)
mg.p <- rsm$prob.dists[, 1]

# Generate edge assignment probabilities from which the second set of
# edge multiplicity sequences is generated from using the iea_model()
deg.f <- (4*5)/2 - 1
eap <- get_edge_assignment_probs(m = 10,
                   deg.seq = c(4,4,6,6), model = 'IEAS')

# Perform the test
test <- gof_stats(m = 10, dof = deg.f,
                   m.seq = mg, prob.mg = mg.p, eap)


[Package multigraphr version 0.2.0 Index]