View source: R/degree_adoption_diagnostic.R
| degree_adoption_diagnostic | R Documentation |
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),
...
)
graph |
A '[diffnet()]' object or a graph data structure (classes include
'array' ( |
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 |
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'. |
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.
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"'.
'[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()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.