This function computes FAVA in sliding window slices of a dataset.
Usage
window_fava(
relab_matrix,
window_size,
window_step = 1,
group = NULL,
index = NULL,
time = NULL,
w = NULL,
S = NULL,
K = NULL,
normalized = FALSE,
alpha = 0.5
)
Arguments
- relab_matrix
A matrix or data frame with rows containing non-negative entries that sum to 1. Each row represents a sample, each column represents a category, and each entry represents the abundance of that category in the sample. If
relab_matrix
contains any metadata, it must be on the left-hand side of the matrix, the rightK
entries of each row must sum to 1, andK
must be specified. Otherwise, all entries of each row must sum to 1.- window_size
An integer number specifying the number of samples per window.
- window_step
Optional; an integer specifying the distance between the first entry of adjacent windows. Default is
window_step=1
.- group
Optional; a string specifying the name of the column that describes which group each row (sample) belongs to. Use if
relab_matrix
is a single matrix containing multiple groups of samples you wish to compare.- index
Optional; a string specifying the name of the column in
relab_matrix
containing an index for each sample. For example, ifrelab_matrix
contains time series data,index
would be the column containing the time of each sample. Ifindex
is not specified buttime
is,time
is by default used as the index.- time
Optional; a string specifying the name of the column that describes the sampling time for each row. Include if you wish to weight FAVA by the distance between samples.
- w
Optional; a vector of length
I
with non-negative entries that sum to 1. Entryw[i]
represents the weight placed on rowi
in the computation of the mean abundance of each category across rows. The default value isw = rep(1/nrow(relab_matrix), nrow(relab_matrix))
.- S
Optional; a K x K similarity matrix with diagonal elements equal to 1 and off-diagonal elements between 0 and 1. Entry
S[i,k]
fori!=k
is the similarity between category andi
and categoryk
, equaling 1 if the categories are to be treated as identical and equaling 0 if they are to be treated as totally dissimilar. The default value isS = diag(ncol(relab_matrix))
.- K
Optional; an integer specifying the number of categories in the data. Default is
K=ncol(relab_matrix)
.- normalized
Optional; should normalized FAVA be used? Default is
normalized = FALSE
; usenormalized = TRUE
to compute normalized FAVA. FAVA can only be normalized if it is not weighted.- alpha
Optional; number between 0 and 1 specifying the opacity of the horizontal lines plotted. Default is
alpha = 0.5
.