Skip to contents

This function computes the Fréchet variance around a specified network from an observed sample of network-valued random variables according to a specified distance. In most cases, the user is willing to compute the sample variance, in which case the Fréchet variance has to be evaluated w.r.t. the sample Fréchet mean. In this case, it is important that the user indicates the same distance as the one (s)he used to separately compute the sample Fréchet mean. This function can also be used as is as the function to be minimized in order to find the Fréchet mean for a given distance.

Usage

var_nvd(x, x0, weights = rep(1, length(x)), distance = "frobenius")

Arguments

x

An nvd object listing a sample of networks.

x0

A network already in matrix representation around which to calculate variance (usually the Fréchet mean but not necessarily). Note that the chosen matrix representation is extracted from this parameter.

weights

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

distance

A string specifying the distance to be used. Possible choices are: hamming, frobenius, spectral or root-euclidean. Default is frobenius. When the Fréchet mean is used as x0 parameter, the distance should match the one used to compute the mean. This is not currently checked.

Value

A positive scalar value evaluating the amount of variability of the sample around the specified network.

Examples

gnp_params <- list(p = 1/3)
x <- nvd(model = "gnp", n = 10L, model_params = gnp_params)
m <- mean(x)
var_nvd(x = x, x0 = m, distance = "frobenius")
#> [1] 120.3