| bada | R Documentation |
A component technique that maximizes the between group variance over a set of variables.
bada( Y, X, S = rep(1, nrow(X)), ncomp = length(levels(as.factor(Y))) - 1, preproc = center(), A = NULL, M = NULL, ... )
Y |
dependent |
X |
the data matrix with |
S |
an integer |
ncomp |
number of components to estimate |
preproc |
pre-processing function, defaults to |
A |
the column constraints |
M |
the row constraints |
... |
arguments to pass through |
The S argument can be used to model multi-level structure. If S is included, then pre-processing is applied
separately to each unique value of S. This has the effect, for example when preproc = center of removing subject-specific
means before computing the barycetners.
Abdi, H., Williams, L. J., & Bera, M. (2017). Barycentric discriminant analysis. Encyclopedia of Social Network Analysis and Mining, 1-20.
X <- matrix(rnorm(100*1000), 100, 1000)
Y <- factor(rep(letters[1:4], length.out=100))
S <- factor(rep(1:10, each=10))
bres <- bada(Y, X, S, ncomp=3)
project(bres, X[S==1,])
## no strata
bres <- bada(Y, X, ncomp=3)
xbar <- matrix(rnorm(4*1000), 4, 1000)
Y <- factor(rep(letters[1:4], length.out=100))
X <- do.call(rbind, lapply(as.character(Y), function(y) { switch(y,
"a" = xbar[1,] + rnorm(1000)*5,
"b" = xbar[2,] + rnorm(1000)*5,
"c" = xbar[3,] + rnorm(1000)*5,
"d" = xbar[4,] + rnorm(1000)*5)
}
))
bres2 <- bada(Y, X, S, ncomp=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.