topicQuality: Plots semantic coherence and exclusivity for each topic.

View source: R/topicQuality.R

topicQualityR Documentation

Plots semantic coherence and exclusivity for each topic.

Description

Plots semantic coherence and exclusivity for each topic. Does not support models with content covariates.

Usage

topicQuality(
  model,
  documents,
  xlab = "Semantic Coherence",
  ylab = "Exclusivity",
  labels = 1:ncol(model$theta),
  M = 10,
  ...
)

Arguments

model

Output from stm, or a selected model from selectModel.

documents

The documents (see stm for format).

xlab

Character string that is x axis title. This should be semantic coherence.

ylab

Character string that is y axis title. This should be exclusivity.

labels

Vector of number corresponding to topic numbers.

M

Number of words to use in semantic coherence and exclusivity calculations

...

Other plotting parameters from igraph.

Details

Each model has semantic coherence and exclusivity values associated with each topic. This function plots these values and labels each with its topic number.

Examples


## Not run: 

  #Semantic Coherence calculations require the original documents so we need
  #to reconstruct them here.
  temp<-textProcessor(documents=gadarian$open.ended.response,metadata=gadarian)
  meta<-temp$meta
  vocab<-temp$vocab
  docs<-temp$documents
  out <- prepDocuments(docs, vocab, meta)
  docs<-out$documents
  vocab<-out$vocab
  meta <-out$meta
  topicQuality(model=gadarianFit, documents=docs)

## End(Not run)

bstewart/stm documentation built on Jan. 3, 2024, 6:58 p.m.