Skip to contents

This function computes the sample Fréchet mean from an observed sample of network-valued random variables according to a specified matrix representation. It currently only supports the Euclidean geometry i.e. the sample Fréchet mean is obtained as the argmin of the sum of squared Frobenius distances.

Usage

# S3 method for nvd
mean(x, weights = rep(1, length(x)), representation = "adjacency", ...)

Arguments

x

An nvd object.

weights

A numeric vector specifying weights for each observation (default: equally weighted).

representation

A string specifying the graph representation to be used. Choices are adjacency, laplacian, modularity, graphon. Default is adjacency.

...

Other argument to be parsed to the mean function.

Value

The mean network in the chosen matrix representation assuming Euclidean geometry for now.

Examples

gnp_params <- list(p = 1/3)
x <- nvd(model = "gnp", n = 10L, model_params = gnp_params)
mean(x)
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,]  0.0  0.4  0.2  0.5  0.5  0.3  0.4  0.2  0.4   0.5   0.4   0.3   0.4
#>  [2,]  0.4  0.0  0.4  0.2  0.4  0.3  0.3  0.0  0.3   0.5   0.2   0.5   0.5
#>  [3,]  0.2  0.4  0.0  0.4  0.5  0.6  0.4  0.3  0.1   0.4   0.3   0.5   0.2
#>  [4,]  0.5  0.2  0.4  0.0  0.4  0.5  0.1  0.7  0.3   0.3   0.3   0.2   0.3
#>  [5,]  0.5  0.4  0.5  0.4  0.0  0.5  0.3  0.3  0.3   0.3   0.3   0.2   0.4
#>  [6,]  0.3  0.3  0.6  0.5  0.5  0.0  0.1  0.3  0.3   0.4   0.4   0.6   0.3
#>  [7,]  0.4  0.3  0.4  0.1  0.3  0.1  0.0  0.2  0.3   0.1   0.4   0.5   0.2
#>  [8,]  0.2  0.0  0.3  0.7  0.3  0.3  0.2  0.0  0.3   0.1   0.5   0.3   0.4
#>  [9,]  0.4  0.3  0.1  0.3  0.3  0.3  0.3  0.3  0.0   0.4   0.5   0.4   0.2
#> [10,]  0.5  0.5  0.4  0.3  0.3  0.4  0.1  0.1  0.4   0.0   0.3   0.3   0.5
#> [11,]  0.4  0.2  0.3  0.3  0.3  0.4  0.4  0.5  0.5   0.3   0.0   0.2   0.4
#> [12,]  0.3  0.5  0.5  0.2  0.2  0.6  0.5  0.3  0.4   0.3   0.2   0.0   0.2
#> [13,]  0.4  0.5  0.2  0.3  0.4  0.3  0.2  0.4  0.2   0.5   0.4   0.2   0.0
#> [14,]  0.3  0.4  0.2  0.5  0.3  0.4  0.3  0.3  0.4   0.2   0.2   0.3   0.3
#> [15,]  0.6  0.2  0.3  0.3  0.3  0.5  0.3  0.4  0.5   0.7   0.4   0.1   0.4
#> [16,]  0.5  0.2  0.2  0.5  0.3  0.2  0.0  0.4  0.1   0.3   0.2   0.5   0.2
#> [17,]  0.2  0.3  0.3  0.6  0.2  0.3  0.4  0.2  0.4   0.4   0.4   0.1   0.6
#> [18,]  0.5  0.2  0.2  0.4  0.3  0.5  0.1  0.5  0.1   0.6   0.5   0.3   0.4
#> [19,]  0.3  0.3  0.3  0.1  0.3  0.4  0.0  0.4  0.4   0.2   0.5   0.4   0.4
#> [20,]  0.4  0.4  0.2  0.3  0.6  0.3  0.5  0.5  0.6   0.2   0.4   0.5   0.3
#> [21,]  0.4  0.5  0.6  0.3  0.0  0.2  0.6  0.1  0.3   0.0   0.4   0.3   0.3
#> [22,]  0.4  0.3  0.3  0.2  0.3  0.2  0.3  0.5  0.3   0.3   0.5   0.6   0.0
#> [23,]  0.5  0.2  0.3  0.4  0.2  0.6  0.3  0.5  0.3   0.4   0.2   0.3   0.1
#> [24,]  0.2  0.1  0.2  0.6  0.5  0.3  0.5  0.3  0.5   0.3   0.2   0.4   0.1
#> [25,]  0.1  0.6  0.3  0.2  0.4  0.3  0.4  0.3  0.3   0.3   0.4   0.2   0.3
#>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
#>  [1,]   0.3   0.6   0.5   0.2   0.5   0.3   0.4   0.4   0.4   0.5   0.2   0.1
#>  [2,]   0.4   0.2   0.2   0.3   0.2   0.3   0.4   0.5   0.3   0.2   0.1   0.6
#>  [3,]   0.2   0.3   0.2   0.3   0.2   0.3   0.2   0.6   0.3   0.3   0.2   0.3
#>  [4,]   0.5   0.3   0.5   0.6   0.4   0.1   0.3   0.3   0.2   0.4   0.6   0.2
#>  [5,]   0.3   0.3   0.3   0.2   0.3   0.3   0.6   0.0   0.3   0.2   0.5   0.4
#>  [6,]   0.4   0.5   0.2   0.3   0.5   0.4   0.3   0.2   0.2   0.6   0.3   0.3
#>  [7,]   0.3   0.3   0.0   0.4   0.1   0.0   0.5   0.6   0.3   0.3   0.5   0.4
#>  [8,]   0.3   0.4   0.4   0.2   0.5   0.4   0.5   0.1   0.5   0.5   0.3   0.3
#>  [9,]   0.4   0.5   0.1   0.4   0.1   0.4   0.6   0.3   0.3   0.3   0.5   0.3
#> [10,]   0.2   0.7   0.3   0.4   0.6   0.2   0.2   0.0   0.3   0.4   0.3   0.3
#> [11,]   0.2   0.4   0.2   0.4   0.5   0.5   0.4   0.4   0.5   0.2   0.2   0.4
#> [12,]   0.3   0.1   0.5   0.1   0.3   0.4   0.5   0.3   0.6   0.3   0.4   0.2
#> [13,]   0.3   0.4   0.2   0.6   0.4   0.4   0.3   0.3   0.0   0.1   0.1   0.3
#> [14,]   0.0   0.4   0.1   0.2   0.2   0.1   0.2   0.1   0.4   0.4   0.2   0.4
#> [15,]   0.4   0.0   0.2   0.5   0.3   0.5   0.6   0.3   0.3   0.5   0.1   0.2
#> [16,]   0.1   0.2   0.0   0.4   0.5   0.5   0.3   0.5   0.3   0.2   0.4   0.1
#> [17,]   0.2   0.5   0.4   0.0   0.4   0.2   0.1   0.1   0.6   0.5   0.4   0.3
#> [18,]   0.2   0.3   0.5   0.4   0.0   0.3   0.2   0.3   0.4   0.2   0.2   0.3
#> [19,]   0.1   0.5   0.5   0.2   0.3   0.0   0.5   0.4   0.5   0.1   0.4   0.1
#> [20,]   0.2   0.6   0.3   0.1   0.2   0.5   0.0   0.5   0.4   0.2   0.5   0.1
#> [21,]   0.1   0.3   0.5   0.1   0.3   0.4   0.5   0.0   0.4   0.4   0.4   0.4
#> [22,]   0.4   0.3   0.3   0.6   0.4   0.5   0.4   0.4   0.0   0.2   0.1   0.5
#> [23,]   0.4   0.5   0.2   0.5   0.2   0.1   0.2   0.4   0.2   0.0   0.2   0.3
#> [24,]   0.2   0.1   0.4   0.4   0.2   0.4   0.5   0.4   0.1   0.2   0.0   0.3
#> [25,]   0.4   0.2   0.1   0.3   0.3   0.1   0.1   0.4   0.5   0.3   0.3   0.0
#> attr(,"representation")
#> [1] "adjacency"