Analyzes the correlation between in-degree, out-degree, and time of adoption to identify whether opinion leaders were early adopters (supporters) or late adopters (opposers).

degree_adoption_diagnostic(
  graph,
  degree_strategy = c("mean", "first", "last"),
  bootstrap = TRUE,
  R = 1000,
  conf.level = 0.95,
  toa = NULL,
  t0 = NULL,
  t1 = NULL,
  name = NULL,
  behavior = NULL,
  combine = c("none", "pooled", "average", "earliest"),
  min_adopters = 3,
  valued = getOption("diffnet.valued", FALSE),
  ...
)

Arguments

graph

A `[diffnet()]` object or a graph data structure (classes include `array` (\(n\times n \times T\)), `dgCMatrix` (sparse), `igraph`, etc.; see [netdiffuseR-graphs]).

degree_strategy

Character scalar. How to aggregate degree measures across time periods: - `"mean"` (default): Average degree across all time periods - `"first"`: Degree in the first time period - `"last"`: Degree in the last time period

bootstrap

Logical scalar. Whether to compute bootstrap confidence intervals.

R

Integer scalar. Number of bootstrap replicates (default 1000).

conf.level

Numeric scalar. Confidence level for bootstrap intervals (default 0.95).

toa

Integer vector of length \(n\) (single behavior) or an \(n\times Q\) matrix (multi-behavior) with times of adoption. Required when `graph` is not a `diffnet`.

t0, t1

Optional integer scalars defining the first and last observed periods. If missing and `toa` is provided, `t0` defaults to 1 and `t1` to `max(toa, na.rm=TRUE)`.

name

Optional character scalars used only when coercing inputs into a `diffnet` object (passed to `new_diffnet`).

behavior

Which behaviors to include when `toa` is a matrix (multi-diffusion). Can be `NULL` (all), a numeric index vector, or a character vector matching `colnames(toa)`.

combine

Character scalar. How to combine multiple behaviors when `toa` is a matrix: - `"none"` (analyze each behavior separately) - `"pooled"` (stack rows across behaviors) - `"average"` (per-actor mean of TOA across selected behaviors) - `"earliest"` (per-actor minimum TOA) Ignored for single-behavior.

min_adopters

Integer scalar. Minimum number of adopters required to compute correlations for any analysis cell (default 3).

valued

Logical scalar. Whether to use edge weights in degree calculations.

...

Additional arguments passed on when coercing to `diffnet`.

Value

When analyzing a single behavior (or when `combine!="none"`), a list with:

correlations

Named numeric vector with correlations between in-degree/out-degree and time of adoption

bootstrap

List with bootstrap results when `bootstrap = TRUE`, otherwise `NULL`

call

The matched call

degree_strategy

The degree aggregation strategy used

sample_size

Number of rows included in the analysis (adopter rows)

combine

`NULL` for single-behavior; otherwise the combination rule used.

When `combine="none"` with multiple behaviors, returns the same structure, except: - `correlations` is a \(2\times Q^*\) matrix with rows `c("indegree_toa","outdegree_toa")` and one column per analyzed behavior. - `bootstrap` is a named list with one entry per behavior (each like the single-behavior case), or `NULL` if `bootstrap=FALSE`. - `sample_size` is an integer vector named by behavior. - `combine` is `"none"`.

Details

This diagnostic function computes correlations between degree centrality measures (in-degree and out-degree) and time of adoption. Positive correlations suggest that central actors (opinion leaders) adopted early, while negative correlations suggest they adopted late.

When `bootstrap = TRUE`, the function uses the `boot` package to compute bootstrap confidence intervals for the correlations.

When `toa` is a matrix (multi-diffusion), degree vectors are computed once and reused; the time of adoption is combined according to `combine`: - `"none"`: computes separate results per behavior (see Value). - `"pooled"`: stacks (actor, behavior) rows for adopters and runs a single analysis. - `"average"`: one row per actor using the mean TOA of adopted behaviors. - `"earliest"`: one row per actor using the minimum TOA of adopted behaviors.

Examples

# Basic usage with Korean Family Planning data
data(kfamilyDiffNet)
result_basics <- degree_adoption_diagnostic(kfamilyDiffNet, bootstrap = FALSE)
print(result_basics)
#> Degree and Time of Adoption Diagnostic
#> ======================================
#> 
#> Degree aggregation strategy: mean 
#> Sample size (adopters only): 1047 
#> Correlations:
#>   In-degree  - Time of Adoption: -0.067
#>   Out-degree - Time of Adoption: -0.008
#> 
#> Interpretation:
#>   In-degree: Weak relationship between in-degree and adoption timing:
#>              |r| ≤ 0.1; no CI.
#>   Out-degree: Weak relationship between out-degree and adoption timing:
#>              |r| ≤ 0.1; no CI.

# With bootstrap confidence intervals
result_boot <- degree_adoption_diagnostic(kfamilyDiffNet)
print(result_boot)
#> Degree and Time of Adoption Diagnostic
#> ======================================
#> 
#> Degree aggregation strategy: mean 
#> Sample size (adopters only): 1047 
#> Correlations:
#>   In-degree  - Time of Adoption: -0.067
#>   Out-degree - Time of Adoption: -0.008
#> 
#> Interpretation:
#>   In-degree: Weak relationship between in-degree and adoption timing;  statistically supported:
#>              |r| ≤ 0.1; CI (95.0%) excludes 0.
#>   Out-degree: Weak relationship between out-degree and adoption timing; NOT statistically supported:
#>              |r| ≤ 0.1; CI (95.0%) includes 0.

# Different degree aggregation strategies
result_first <- degree_adoption_diagnostic(kfamilyDiffNet, degree_strategy = "first")
result_last  <- degree_adoption_diagnostic(kfamilyDiffNet, degree_strategy = "last")

# Multi-diffusion (toy) ----------------------------------------------------
set.seed(999)
n <- 40; t <- 5; q <- 2
garr <- rgraph_ws(n, t, p=.3)
diffnet_multi <- rdiffnet(seed.graph = garr, t = t, seed.p.adopt = rep(list(0.1), q))
#> Message: Multi-diffusion behavior simulation selected. Number of behaviors:  2
#> Message: Object -seed.nodes- converted to a -list-.All behaviors will have the same -random- seed nodes.
#> Message: Name of 1 behavior provided, but 2 are needed. Names generalized to 'behavior'_1, 'behavior'_2, etc.
#> Warning: Coercing -toa- into integer.

# pooled (one combined analysis)
degree_adoption_diagnostic(diffnet_multi, combine = "pooled", bootstrap = FALSE)
#> Degree and Time of Adoption Diagnostic
#> ======================================
#> 
#> Degree aggregation strategy: mean 
#> Behavior combination: pooled (stacked rows) 
#> 
#> Sample size (adopters only): 45 
#> Correlations:
#>   In-degree  - Time of Adoption: 0.015
#>   Out-degree - Time of Adoption: 0.196
#> 
#> Interpretation:
#>   In-degree: Weak relationship between in-degree and adoption timing:
#>              |r| ≤ 0.1; no CI.
#>   Out-degree: Central actors (high out-degree) tended to adopt early (supporters):
#>              |r| > 0.1; no CI.

# per-behavior (matrix of correlations; one column per behavior)
degree_adoption_diagnostic(diffnet_multi, combine = "none", bootstrap = FALSE)
#> Degree and Time of Adoption Diagnostic
#> ======================================
#> 
#> Degree aggregation strategy: mean 
#> Behavior combination: none (per-behavior) 
#> 
#> Sample sizes (adopters only):
#>     - B1: 26
#>     - B2: 19
#> 
#> Correlations:
#>   In-degree - Time of Adoption:
#>     [B1]: -0.119
#>     [B2]: 0.254
#>   Out-degree - Time of Adoption:
#>     [B1]: 0.442
#>     [B2]: -0.190
#> 
#> Interpretation:
#>   [B1]
#>   In-degree: Central actors (high in-degree) tended to adopt late (opposers):
#>              |r| > 0.1; no CI.
#>   Out-degree: Central actors (high out-degree) tended to adopt early (supporters):
#>              |r| > 0.1; no CI.
#>   [B2]
#>   In-degree: Central actors (high in-degree) tended to adopt early (supporters):
#>              |r| > 0.1; no CI.
#>   Out-degree: Central actors (high out-degree) tended to adopt late (opposers):
#>              |r| > 0.1; no CI.