Various distances, measures of dissimilarity and similarity, correlations and other metrics are computed to compare the models. Optionally, the weight matrices of the models can be scaled before comparison. The resulting object can be used to produce heatmap plots and scatterplots to further illustrate the differences.
Usage
compare(x, ...)
# S3 method for class 'tna'
compare(x, y, scaling = "none", ...)
# S3 method for class 'matrix'
compare(x, y, scaling = "none", ...)
Arguments
- x
A
tna
object or amatrix
of weights.- ...
Ignored.
- y
A
tna
object or amatrix
of weights.- scaling
A
character
string naming a scaling method to apply to the weights before comparing them. The supported options are:"none"
: No scaling is performed. The weights are used as is."minmax"
: Performs min-max normalization, i.e., the minimum value is subtracted and the differences are scaled by the range."rank"
: Applies min-max normalization to the ranks of the weights (computed withties.method = "average"
)."zscore"
: Computes the standard score, i.e. the mean weight is subtracted and the differences are scaled by the standard deviation."robust"
: Computes the robust z-score, i.e. the median weight is subtracted and the differences are scaled by the median absolute deviation (using stats::mad)."log"
: Simply the natural logarithm of the weights."log1p"
: As above, but adds 1 to the values before taking the logarithm. Useful for scenarios with zero weights."softmax"
: Performs softmax normalization."quantile"
: Uses the empirical quantiles of the weights via stats::ecdf.
Value
A tna_comparison
object, which is a list
containing the
following elements:
matrices
: Alist
containing the scaled matrices of the inputtna
objects or the scaled inputs themselves in the case of matrices.difference_matrix
: Amatrix
of differencesx - y
.edge_metrics
: Adata.frame
of edge-level metrics about the differences.summary_metrics
: Adata.frame
of summary metrics of the differences across all edges.network_metrics
: Adata.frame
of network metrics for bothx
andy
.centrality_differences
: Adata.frame
of differences in centrality measures computes fromx
andy
.centrality_correlations
: Anumeric
vector of correlations of the centrality measures betweenx
andy
.
See also
Model comparison functions
compare.group_tna()
,
plot.tna_comparison()
,
plot_compare()
,
plot_compare.group_tna()
,
print.tna_comparison()
Examples
# Comparing TNA models
model_x <- tna(group_regulation[1:200, ])
model_y <- tna(group_regulation[1001:1200, ])
comp1 <- compare(model_x, model_y)
# Comparing matrices
mat_x <- model_x$weights
mat_y <- model_y$weights
comp2 <- compare(mat_x, mat_y)
# Comparing a matrix to a TNA model
comp3 <- compare(mat_x, model_y)