The function takes either an edgelist or an adjacency matrix and returns an adjacency matrix with the reciprocity change statistic. This reciprocity matrix can then be used as a predictor in the gHypEG regression.

reciprocity_stat(graph, nodes = NULL, zero_values = NULL)

Arguments

graph

A graph adjacency matrix or an edgelist. The edgelist needs to have 3 columns: a sender vector, a target vector and an edgecount vector.

nodes

optional character/factor vector. If an edgelist is provided, you have to provide a list of unique identifiers of your nodes in the graph. This is because in the edgelist, isolates are usually not recorded. If you do not specify isolates in your nodes object, they are excluded from the analysis (falsifies data).

zero_values

optional numeric value. Use this to substitute zero-values in your reciprocity change statistic matrix. Zero values in the predictors are recognized in the gHypEG regression as structural zeros. To ensure this does not happen, please recode your zero-values in all your predictors, ideally using a dummy variable fitting an optimal value for the zeroes.

Value

Reciprocity change statistic matrix.

Author

LB, GC

Examples

recip_stat <- reciprocity_stat(adj_karate)
recip_stat_dummy <- get_zero_dummy(recip_stat, name = 'reciprocity')
nrm(w=recip_stat_dummy, adj_karate, directed = FALSE, selfloops = FALSE)
#> Call:
#> nrm.default(w = recip_stat_dummy, adj = adj_karate, directed = FALSE, 
#>     selfloops = FALSE)
#> 
#> Coefficients:
#>                     Estimate   Std.Err t value Pr(>t)
#> reciprocity          0.13130   0.16883  0.7777 0.4367
#> reciprocity_zeroes -19.55967 852.48448  0.0229 0.9817
#> 
#> R2:
#>  McFadden R2 Cox Snell R2 
#>    0.5312417    0.9007760