frobenius: Frobenius Norm (Similarity)

View source: R/frobenius.R

frobeniusR Documentation

Frobenius Norm (Similarity)

Description

Computes the Frobenius Norm (Ulitzsch et al., 2023)

Usage

frobenius(network1, network2)

Arguments

network1

Matrix or data frame. Network to be compared

network2

Matrix or data frame. Second network to be compared

Value

Returns Frobenius Norm

Author(s)

Hudson Golino <hfg9s at virginia.edu> & Alexander P. Christensen <alexander.christensen at Vanderbilt.Edu>

References

Simulation Study
Ulitzsch, E., Khanna, S., Rhemtulla, M., & Domingue, B. W. (2023). A graph theory based similarity metric enables comparison of subpopulation psychometric networks Psychological Methods.

Examples

# Obtain wmt2 data
wmt <- wmt2[,7:24]

# Set seed (for reproducibility)
set.seed(1234)

# Split data
split1 <- sample(
  1:nrow(wmt), floor(nrow(wmt) / 2)
)
split2 <- setdiff(1:nrow(wmt), split1)

# Obtain split data
data1 <- wmt[split1,]
data2 <- wmt[split2,]

# Perform EBICglasso
glas1 <- EBICglasso.qgraph(data1)
glas2 <- EBICglasso.qgraph(data2)

# Frobenius norm
frobenius(glas1, glas2)
# 0.7070395


hfgolino/EGA documentation built on Nov. 11, 2024, 9:28 p.m.