# Understanding avg_neighbour_corr

Hi,

I'm trying to understand what is computed in graph_tool.correlations.
avg_neighbour_corr
but I couldn't figured out yet.

Take for example the minimal example below:

attachment.html (2.74 KB)

From the docs I'd expect h[0][1] == np.mean(w) (which is the case) and h[1][1] == np.std(w) (which is not the case).

As it is written in the documentation, the second value computed is the
standard deviation of the _mean_, not the standard deviation of the
_population_, which is what you are computing. The standard deviation of
the mean is: std(w) / sqrt(len(w))

In fact, I got to this issue trying to implement the analogous
function to graph_tool.correlations.avg_neighbour_corr but looking at
*in_neighbours* instead of *out_neighbours*

This is trivial, just compute the avg_neighbour_corr with the reversed
graph:

avg_neighbour_corr(GraphView(g, reversed=True), "in", "out")

Best,
Tiago

Hi,

> From the docs I'd expect h[0][1] == np.mean(w) (which is the case) and
h[1][1] == np.std(w) (which is not the case).

As it is written in the documentation, the second value computed is the
standard deviation of the _mean_, not the standard deviation of the
_population_, which is what you are computing. The standard deviation of
the mean is: std(w) / sqrt(len(w))

thanks! I missed that

> In fact, I got to this issue trying to implement the analogous
> function to graph_tool.correlations.avg_neighbour_corr but looking at
> *in_neighbours* instead of *out_neighbours*

This is trivial, just compute the avg_neighbour_corr with the reversed
graph:

avg_neighbour_corr(GraphView(g, reversed=True), "in", "out")

sweet! I'm just starting with graph-tool and I didn't get to know the whole
api yet.

Regards,

attachment.html (2.52 KB)