face2face.statistics.network_quantities.variance_std_network¶
-
face2face.statistics.network_quantities.
variance_std_network
(network)¶ Calculate variance and standard deviation
Calculating the variance and the standard deviation of the degrees of a given network
\[\sigma^2 = \frac{1}{n} \sum_{i=1}^{n} (x_i - \bar{x})\]\[\sigma = \sqrt{\sigma^2} = \sqrt{\frac{1}{n-1} \sum_{i=1}^{n} (x_i - \bar{x})^2}\]- Parameters
network (networkx Graph) – A graph with a specified degree sequence. Nodes are labeled based on the imported data set.
- Returns
var (float) – Contains the variance of the network degree
std (float) – Contains the standard deviation of the network degree
Examples
>>> attr_list = ["ID", "Age", "Sex"] >>> test_df = Data(path_tij="face2face/data/Test/tij_test.dat", separator_tij="\t", >>> path_meta="face2face/data/Test/meta_test.dat", separator_meta="\t", >>> meta_attr_list=attr_list) >>> test_network = create_network_from_data(test_df) >>> variance, standard_deviation = variance_std_network(test_network) >>> print(variance) 0.2 >>> print(standard_deviation) 0.4472135954999579