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
tnaobject or amatrixof weights.- ...
Ignored.
- y
A
tnaobject or amatrixof weights.- scaling
A
characterstring 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: Alistcontaining the scaled matrices of the inputtnaobjects or the scaled inputs themselves in the case of matrices.difference_matrix: Amatrixof differencesx - y.edge_metrics: Adata.frameof edge-level metrics about the differences.summary_metrics: Adata.frameof summary metrics of the differences across all edges.network_metrics: Adata.frameof network metrics for bothxandy.centrality_differences: Adata.frameof differences in centrality measures computes fromxandy.centrality_correlations: Anumericvector of correlations of the centrality measures betweenxandy.
See also
Model comparison functions
compare.group_tna(),
compare_sequences(),
plot.tna_comparison(),
plot.tna_sequence_comparison(),
plot_compare(),
plot_compare.group_tna(),
print.tna_comparison(),
print.tna_sequence_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)
