Nothing
bcMCA <- function(data, class, excl = NULL, row.w = NULL, ncp = 5) {
if(is.null(row.w)) row.w <- rep(1, nrow(data))
if(any(sapply(data, FUN = function(x) !is.factor(x)))) stop("variables in data should all be factors")
if(!is.factor(class)) stop("class should be a factor")
if(is.character(excl)) excl <- which(getindexcat(data) %in% excl)
n <- sum(row.w)
nk <- tapply(row.w, class, sum)
pk <- as.vector(nk / n)
disj <- dichotom(data, out = "numeric")
if(!is.null(excl)) disj <- disj[,-excl]
centers <- sweep(t(as.matrix(dichotom(class)))%*%diag(row.w)%*%as.matrix(disj), 1, nk, "/")
centers <- data.frame(centers)
row.names(centers) <- levels(class)
names(centers) <- names(disj)
df <- rbind.data.frame(centers, disj)
res <- FactoMineR::CA(df,
row.w = as.vector(pk),
row.sup = (nlevels(class)+1):nrow(df),
ncp = ncp,
graph = FALSE)
mca <- FactoMineR::CA(dichotom(data, out = "numeric"),
row.w = row.w,
ncp = ncp,
graph = FALSE,
excl = excl)
res$ratio <- sum(res$eig[,"eigenvalue"]) / sum(mca$eig[,"eigenvalue"])
class(res) <- c("CA", "bcMCA", "list")
return(res)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.