This function estimates the adjacency matrix \mathbf{A} of all pairwise equivalent FLC distributions given the states s_1, …, s_K. See Details below.
1 2 
states 
vector of length N with entry i being the label k = 1, …, K of PLC i 
FLCs 
N \times n_f matrix of FLCs (only
necessary if 
pdfs.FLC 
N \times K matrix of all K
stateconditional FLC densities evaluated at each FLC
\ell^{+}_i, i=1, …, N (only necessary if

alpha 
significance level for testing. Default:

distance 
either a KolmogorovSmirnov test
( Default: 
A K \times K adjacency matrix with a trimmed
version of exp(distance) or pvalues. If
alpha!=NULL
then it returns the thresholded
0/1 matrix. However, here 1 stands for
equivalent, i.e. not rejecting. The matrix is obtained by
checking for pval>alpha
(rather than the usual
pval<alpha
).
The (i,j)th element of the adjacency matrix is defined as
\mathbf{A}_{ij} = distance(P(X \mid s_i), P(X \mid s_j)) = distance(f, g),
where
distance
is either
in the function space of pdfs f and g, or
for H_0: f=g, e.g. a
KolmogorovSmirnov test (distance="KS"
).
Again we use a functional programming approach and allow
the user to specify any valid distance/similarity
function distance = function(f, g) return(...)
.
If distance="KS"
the adjacency matrix contains
pvalues of a KolmogorovSmirnov test or the thresholded
versions (if alpha!=NULL
)  see Return for
details.
Otherwise distance
is an R function that takes as
an input two vectors f
and g
(e.g. the
wKDE
estimates for two states), and returns
a nonnegative, real number to estimate their distance.
Default is the L_1 distance distance =
function(f, g) return(mean(abs(fg)))
.
1 2 3 4 5 6 7 8 9 10 11  WW < matrix(runif(10000), ncol = 10)
WW < normalize(WW)
temp_flcs < cbind(rnorm(nrow(WW)))
temp_pdfs.FLC < estimate_LC_pdfs(temp_flcs, WW)
AA_ks < estimate_state_adj_matrix(states = weight_matrix2states(WW), FLCs = temp_flcs,
distance = "KS")
AA_L1 < estimate_state_adj_matrix(pdfs.FLC = temp_pdfs.FLC)
par(mfrow = c(1, 2), mar = c(1, 1, 2, 1))
image2(AA_ks, zlim = c(0, 1), legend = FALSE, main = "KolmogorovSmirnov")
image2(AA_L1, legend = FALSE, main = "L1 distance")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.