ClusterDetection: Clustering steps to detect responses with mutual dependencies

View source: R/ClusterDetection.R

ClusterDetectionR Documentation

Clustering steps to detect responses with mutual dependencies

Description

Clustering steps to detect responses with mutual dependencies

Usage

ClusterDetection(mat)

Arguments

mat

a matrice of loadings of size J (number of factors) times K (number of responses)

Value

cluster

a vector of integers indicating the cluster to which each response is allocated

mds

a matrix whose rows give the coordinates of the points chosen to represent the dissimilarities

Examples

# load sample data
data <- genus
# get variable names from dataset
n <- names(data)
ny <- n[grep("^gen",n)]
nx1 <- n[grep("^evi",n)]
nx2 <- n[grep("^pluvio",n)]
na <- c("geology", "altitude", "forest", "lon", "lat")
# build multivariate formula
form <- multivariateFormula(Y = ny, X = list(nx1, nx2), A = na)
# define family
fam <- rep("poisson", length(ny))
# run function
H <- c(2,2)
J <- 2
met <- methodSR(l=4, s=0.5)
res <- FactorSCGLR(formula=form, data=data, H=H, J=J,
                   family=fam, method=met, offset = data$surface)

# Detect the clusters
cluster <- ClusterDetection(res$B)

julien-gibaud/FactorsSCGLR documentation built on March 27, 2024, 8:17 a.m.