Computes variance of *Y* at ego level

1 | ```
ego_variance(graph, Y, funname, all = FALSE)
``` |

`graph` |
A matrix of size |

`Y` |
A numeric vector of length |

`funname` |
Character scalar. Comparison to make (see |

`all` |
Logical scalar. When |

For each vertex *i* the variance is computed as follows

*
(sum_j a(ij))^(-1) * ∑_j a(ij) * [f(y(i),y(j)) - f(i)]^2
*

Where *a(ij)* is the ij-th element of `graph`

, *f* is
the function specified in `funname`

, and, if `all=FALSE`

*f(i)=∑_j a(ij)f(y(i), y(j))^2/∑_j a(ij)*,
otherwise *f(i)=f(j)=(1/n^2)∑_(i,j) f(y_i,y_j)*

This is an auxiliary function for `struct_test`

. The idea is
to compute an adjusted measure of disimilarity between vertices, so the
closest in terms of *f* is *i* to its neighbors, the smaller the
relative variance.

A numeric vector of length *n*.

Other statistics: `classify_adopters`

,
`cumulative_adopt_count`

, `dgr`

,
`exposure`

, `hazard_rate`

,
`infection`

, `moran`

,
`struct_equiv`

, `threshold`

,
`vertex_covariate_dist`

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.