Learn R Programming

frechet (version 0.3.0)

NetANOVA: Fréchet ANOVA for Networks

Description

Fréchet analysis of variance for graph Laplacian matrices, covariance matrices, or correlation matrices with respect to the Frobenius distance.

Usage

NetANOVA(Ly = NULL, group = NULL, optns = list())

Value

A NetANOVA object --- a list containing the following fields:

pvalAsy

A scalar holding the asymptotic \(p\)-value.

pvalBoot

A scalar holding the bootstrap \(p\)-value. Returned if optns$boot is TRUE.

optns

The control options used.

Arguments

Ly

A list (length n) of m by m matrices or a m by m by n array where Ly[, , i] contains an m by m matrix, which can be either graph Laplacian matrices or covariance matrices or correlation matrices.

group

A vector containing the group memberships of the corresponding matrices in Ly.

optns

A list of control parameters specified by list(name = value). See `Details`.

Details

Available control options are:

boot

Logical, also compute bootstrap \(p\)-value if TRUE. Default is FALSE.

R

The number of bootstrap replicates. Only used when boot is TRUE. Default is 1000.

References

  • Dubey, P. and Müller, H.G., 2019. Fréchet analysis of variance for random objects. Biometrika, 106(4), pp.803-821.

Examples

Run this code
# \donttest{
set.seed(1)
n1 <- 100
n2 <- 100
gamma1 <- 2
gamma2 <- 3
Y1 <- lapply(1:n1, function(i) {
  igraph::laplacian_matrix(igraph::sample_pa(n = 10, power = gamma1, 
                                             directed = FALSE), 
                           sparse = FALSE)
})
Y2 <- lapply(1:n2, function(i) {
  igraph::laplacian_matrix(igraph::sample_pa(n = 10, power = gamma2, 
                                             directed = FALSE), 
                           sparse = FALSE)
})
Ly <- c(Y1, Y2)
group <- c(rep(1, n1), rep(2, n2))
res <- NetANOVA(Ly, group, optns = list(boot = TRUE))
res$pvalAsy # returns asymptotic pvalue
res$pvalBoot # returns bootstrap pvalue
# }

Run the code above in your browser using DataLab