Learn R Programming

lame (version 1.3.4)

gof_temporal: Posterior-predictive temporal-trend test

Description

For a fitted lame object, computes a network statistic (density, reciprocity, or transitivity) at each observed period, fits a least-squares linear trend on period index, and compares the observed slope to slopes from posterior-predictive replicates. The two-sided value is p_pp = 2 * min(p_up, 1 - p_up), which runs from 0 (observed slope in the extreme tail) to 1 (observed slope dead-centre). A static fit on truly trending data yields p_pp near 0; a dynamic fit that captures the trend yields p_pp near 1.

Usage

gof_temporal(
  fit,
  stat = c("auto", "density", "mean", "reciprocity", "transitivity"),
  n_rep = 500,
  seed = NULL
)

Value

A list with

  • stat (chosen statistic name),

  • slope_obs (observed slope of stat on period index),

  • slope_rep (length-n_rep vector of replicate slopes),

  • p_pp (two-sided posterior-predictive p-value),

  • stat_obs_by_t, stat_rep_by_t (per-period statistics)

Arguments

fit

A fitted lame object.

stat

One of "auto" (default; picks "reciprocity" for unipartite directed fits with \(T \ge 3\) and family normal / poisson, where "density" is constant and uninformative; otherwise "density"), "density", "mean" (mean of off-diagonal Y; the right "density" analogue for continuous outcomes), "reciprocity", "transitivity".

n_rep

Number of posterior-predictive replicates to draw (each replicate is a full \(T\)-period network from simulate(fit)).

seed

Optional RNG seed.

Examples

Run this code
# \donttest{
data(YX_bin_list)
fit <- lame(YX_bin_list$Y, YX_bin_list$X, family = "binary", R = 0,
            dynamic_beta = "dyad",
            nscan = 60, burn = 15, odens = 5, verbose = FALSE)
gof_temporal(fit, stat = "density", n_rep = 50)
# }

Run the code above in your browser using DataLab