Learn R Programming

PReMiuM (version 3.0.24)

calcOptimalClustering: Calculation of the optimal clustering

Description

Calculates the optimal clustering.

Usage

calcOptimalClustering(disSimObj, maxNClusters=NULL, useLS=F)

Arguments

disSimObj
A dissimilarity matrix (in vector format, as the output of the function calcDissimilarityMatrix(), and as described in ?calcDissimilarityMatrix) or a list of dissimilarity matrix, to combine the output of several runs of the MCMC.
maxNClusters
Set the maximum number of clusters allowed. This is set to the maximum number explored.
useLS
This is set to FALSE by default. If it is set to TRUE then the least-squares method is used for the calculation of the optimal clustering, as described in Molitor et al (2010). Note that this is set to TRUE by default if disSimObj$onlyLS is set to TRUE.

Value

  • the output is a list with the following elements. This is an object of type clusObj.
  • clusObjRunInfoObjDetails on this run. An object of type runInfoObj.
  • clusterSizesCluster sizes.
  • clusteringPredThe predicted cluster memberships for the predicted scenarios.
  • clusObjDisSimMatDissimilarity matrix.
  • clusteringCluster memberships.
  • nClustersOptimal number of clusters.
  • avgSilhouetteWidthAverage silhouette width when using medoids method for clustering.

Authors

David Hastie, Department of Epidemiology and Biostatistics, Imperial College London, UK

Silvia Liverani, Department of Epidemiology and Biostatistics, Imperial College London and MRC Biostatistics Unit, Cambridge, UK

Maintainer: Silvia Liverani

References

Liverani, S., Hastie, D. I., Azizi, L., Papathomas, M. and Richardson, S. (2013) PReMiuM: An R package for Profile Regression Mixture Models using Dirichlet Processes. Submitted. Available at http://uk.arxiv.org/abs/1303.2836

Examples

Run this code
generateDataList <- clusSummaryBernoulliDiscrete()
inputs <- generateSampleDataFile(generateDataList)
runInfoObj<-profRegr(yModel=inputs$yModel, xModel=inputs$xModel, 
    nSweeps=10, nBurn=20, data=inputs$inputData, output="output", 
    covNames=inputs$covNames, nClusInit=15)

dissimObj<-calcDissimilarityMatrix(runInfoObj)
clusObj<-calcOptimalClustering(dissimObj)

Run the code above in your browser using DataLab