Learn R Programming

netdiffuseR (version 1.24.0)

degree_adoption_diagnostic: Degree and Time of Adoption Diagnostic

Description

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).

Usage

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),
  ...
)

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"`.

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`.

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.

See Also

`[dgr()]`, `[diffreg()]`, `[exposure()]`

Other statistics: bass, classify_adopters(), cumulative_adopt_count(), dgr(), ego_variance(), exposure(), hazard_rate(), infection(), moran(), struct_equiv(), threshold(), vertex_covariate_dist()

Examples

Run this code
# Basic usage with Korean Family Planning data
data(kfamilyDiffNet)
result_basics <- degree_adoption_diagnostic(kfamilyDiffNet, bootstrap = FALSE)
print(result_basics)

# With bootstrap confidence intervals
result_boot <- degree_adoption_diagnostic(kfamilyDiffNet)
print(result_boot)

# 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))

# pooled (one combined analysis)
degree_adoption_diagnostic(diffnet_multi, combine = "pooled", bootstrap = FALSE)

# per-behavior (matrix of correlations; one column per behavior)
degree_adoption_diagnostic(diffnet_multi, combine = "none", bootstrap = FALSE)

Run the code above in your browser using DataLab