stmCorrViz
. Most users will not need to call this directly.
stmJSON(mod, documents_raw=NULL, documents_matrix=NULL, title="STM Model", clustering_threshold=1.5, labels_number=7, verbose)
STM
fitted model from the stm package.
prepDocuments
function.
hclust
function.The function finds all binary splits in the middle of the clustering tree whose clustering height measure is below the threshold specified in the clustering_threshold
argument. All these splits are marked as aggregation points. The routine retrieves the merge matrix from the output of hclust
, and produces a new merge list by deleting all the splits performed at aggregation points along the tree. While the hclust
merge matrix only contains binary splits, the new merge list can contain non-binary cluster splits.
The merge list is transformed into a structure of nested lists with a recursive function call. Each level of this nested structure corresponds to a node in the hierarchical representation of the STM model. The data structure is eventually transformed into a JSON object by using the jsonlite package.
New beta matrices and top words are computed for each of the topic clusters according to their membership, by marginalizing over content covariates. The clusters are labeled accordingly.
stmCorrViz