match_matrix: Identify a permutation that aligns rows of two matrices

Description Usage Arguments Details Value Examples

View source: R/reshape.R

Description

One way to get confidence intervals for mixtures on the simplex is to first specify the cluster labels for each component, and then study each of these histograms on their own. This is different from, say, smoothing the mixture distribution and identifying modes.

Usage

1

Arguments

X

[numeric matrix] A matrix whose rows we want to align with X.

Z

[numeric matrix] A matrix whose rows we want to align with Z.

Details

The approach taken here is to find the two rows with maximal correlation and put that in the required permutation. Then, remove those rows and repeat.

Value

pi_result [vector] A permutation such that X[pi_result, ] = Z (ideally).

Examples

1
2
3
4
5
X <- matrix(rnorm(100, mean = 4) ^ 2, 20, 5)
pi <- sample(1:20)
Z <- X[pi, ] + matrix(rnorm(100), 20, 5)
pi_hat <- match_matrix(X, Z)
cbind(pi_hat, pi)

krisrs1128/nmfSim documentation built on May 20, 2019, 1:30 p.m.