View source: R/ClusterDetection.R
ClusterDetection | R Documentation |
Clustering steps to detect responses with mutual dependencies
ClusterDetection(mat)
mat |
a matrice of loadings of size J (number of factors) times K (number of responses) |
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 |
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.