# struct_equiv: Structural Equivalence In netdiffuseR: Analysis of Diffusion and Contagion Processes on Networks

## Description

Computes structural equivalence between ego and alter in a network

## Usage

 ```1 2 3 4``` ```struct_equiv(graph, v = 1, inf.replace = 0, groupvar = NULL, ...) ## S3 method for class 'diffnet_se' print(x, ...) ```

## Arguments

 `graph` Any class of accepted graph format (see `netdiffuseR-graphs`). `v` Numeric scalar. Cohesion constant (see details). `inf.replace` Deprecated. `groupvar` Either a character scalar (if `graph` is diffnet), or a vector of size n. `...` Further arguments to be passed to `approx_geodesic` (not valid for the print method). `x` A `diffnet_se` class object.

## Details

Structure equivalence is computed as presented in Valente (1995), and Burt (1987), in particular

SE(ij) = [dmax(i) - d(ji)]^v/[∑_k (dmax(i) - d(ki))^v]

with the summation over k!=i, and d(ji), Eucledian distance in terms of geodesics, is defined as

d(ji) = [(z(ji) - z(ij))^2 + ∑_k (z(jk) - z(ik))^2 + ∑_k (z_(ki) - z_(kj))^2]^(1/2)

with z(ij) as the geodesic (shortest path) from i to j, and dmax(i) equal to largest Euclidean distance between i and any other vertex in the network. All summations are made over k!={i,j}

Here, the value of v is interpreted as cohesion level. The higher its value, the higher will be the influence that the closests alters will have over ego (see Burt's paper in the reference).

Structural equivalence can be computed either for the entire graph or by groups of vertices. When, for example, the user knows before hand that the vertices are distributed accross separated communities, he can make this explicit to the function and provide a `groupvar` variable that accounts for this. Hence, when `groupvar` is not `NULL` the algorithm will compute structural equivalence within communities as marked by `groupvar`.

## Value

If `graph` is a static graph, a list with the following elements:

 `SE` Matrix of size n * n with Structural equivalence `d` Matrix of size n * n Euclidean distances `gdist` Matrix of size n * n Normalized geodesic distance

In the case of dynamic graph, is a list of size `t` in which each element contains a list as described before. When `groupvar` is specified, the resulting matrices will be of class `dgCMatrix`, otherwise will be of class `matrix`.

## Author(s)

George G. Vega Yon & Thomas W. Valente

## References

Burt, R. S. (1987). "Social Contagion and Innovation: Cohesion versus Structural Equivalence". American Journal of Sociology, 92(6), 1287–1335. http://doi.org/10.1086/228667

Valente, T. W. (1995). "Network models of the diffusion of innovations" (2nd ed.). Cresskill N.J.: Hampton Press.

Other statistics: `bass`, `classify_adopters`, `cumulative_adopt_count`, `dgr`, `ego_variance`, `exposure`, `hazard_rate`, `infection`, `moran`, `threshold`, `vertex_covariate_dist`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23``` ```# Computing structural equivalence for the fakedata ------------------------- data(fakesurvey) # Coercing it into a diffnet object fakediffnet <- survey_to_diffnet( fakesurvey, "id", c("net1", "net2", "net3"), "toa", "group" ) # Computing structural equivalence without specifying group se_all <- struct_equiv(fakediffnet) # Notice that pairs of individuals from different communities have # non-zero values se_all se_all[[1]]\$SE # ... Now specifying a groupvar se_group <- struct_equiv(fakediffnet, groupvar="group") # Notice that pairs of individuals from different communities have # only zero values. se_group se_group[[1]]\$SE ```