Structural Topic Model
Also known as: STM, Structural topic modeling, Covariate-aware topic model, Topic model with metadata
The Structural Topic Model (STM) is a text-as-data method that discovers latent themes in a corpus while letting document metadata — party, time, gender, treatment condition — shape those themes. Introduced by Roberts, Stewart, Tingley and colleagues in 2014, it generalizes correlated topic modeling so that topic prevalence (how much a document is about a topic) and topic content (the words used to express a topic) can both depend on covariates. The result is a single model that simultaneously estimates topics and how their use varies across known groups, with uncertainty.
Key highlights
- Incorporates document metadata directly, so topic prevalence and content covary with party, time, or treatment within a single coherent model.
- Returns covariate effects with uncertainty via effect estimation, supporting inferential rather than merely descriptive claims about themes.
- Allows topics to correlate (logistic-normal prior), which is more realistic for political text than LDA's independence assumption.
- Backed by a mature, well-documented R package (stm) with tools for model selection, labeling, visualization, and example retrieval.
Intuition
This section is available to Pro members. Upgrade to Pro
How it works
This section is available to Pro members. Upgrade to Pro
When to use it
Use STM when you have a corpus and document-level metadata and your research question is explicitly about how themes relate to that metadata — how topic emphasis differs by party, evolves over time, or responds to an experimental treatment. It is well suited to open-ended survey responses, legislative or media text, and any setting where you want topics and covariate effects estimated jointly with uncertainty. It is less appropriate when you have no meaningful covariates (a plain LDA or correlated topic model suffices), when you need a known dimension rather than emergent topics (text scaling fits better), or when the corpus is too small for stable topic estimation. As with all unsupervised methods, the topics require human validation.
Strengths & limitations
- Incorporates document metadata directly, so topic prevalence and content covary with party, time, or treatment within a single coherent model.
- Returns covariate effects with uncertainty via effect estimation, supporting inferential rather than merely descriptive claims about themes.
- Allows topics to correlate (logistic-normal prior), which is more realistic for political text than LDA's independence assumption.
- Backed by a mature, well-documented R package (stm) with tools for model selection, labeling, visualization, and example retrieval.
- Topics are still unsupervised and require human reading and validation; the model does not certify that a topic measures the intended construct.
- Results are sensitive to the number of topics K, to initialization, and to preprocessing, so the solution is not unique.
- Variational inference yields an approximation to the posterior, and reported uncertainty can understate true uncertainty.
- Adding content covariates greatly increases the parameter space and can make topics harder to estimate and interpret.
Common pitfalls
This section is available to Pro members. Upgrade to Pro
Applications
This section is available to Pro members. Upgrade to Pro
Frequently asked
How is STM different from plain LDA?
LDA assumes every document draws its topic proportions from a single shared Dirichlet prior and treats topics as independent, ignoring any metadata. STM replaces that fixed prior with a logistic-normal distribution whose mean depends on document-level covariates, lets topics correlate, and can additionally make a topic's vocabulary depend on covariates. So where LDA gives you topics and then leaves you to compare them across groups by hand afterward, STM estimates the topics and the covariate relationships jointly and reports those relationships with uncertainty. When you have no covariates, STM reduces to a correlated topic model close to LDA in spirit; see lda-topic-model and topic-modeling for the unconditioned versions.
What is the difference between prevalence and content covariates?
Prevalence covariates affect how much each document is about each topic — they shift the expected topic proportions, answering questions like 'do Republicans talk about this topic more than Democrats?' Content covariates affect the words used to express a topic — they let the same topic be discussed with different vocabulary across groups, answering 'do the two parties use different language when discussing the same topic?' You can specify either, both, or neither; content covariates are more demanding to estimate and are used more sparingly.
How do I choose the number of topics K?
There is no single correct K. The stm package provides searchK to compare candidate values on diagnostics such as held-out likelihood, semantic coherence, and exclusivity, but these are aids, not arbiters. Best practice is to combine the diagnostics with substantive reading of the top words and representative documents at several K values, choosing a model whose topics are coherent, distinct, and useful for the research question. K is a modeling choice to be justified and checked, not a parameter the data fixes on their own.
Sources
- 1.Roberts, M. E., Stewart, B. M., Tingley, D., Lucas, C., Leder-Luis, J., Gadarian, S. K., Albertson, B., & Rand, D. G. (2014). Structural Topic Models for Open-Ended Survey Responses. American Journal of Political Science, 58(4), 1064–1082.
- 2.Roberts, M. E., Stewart, B. M., & Tingley, D. (2019). stm: An R Package for Structural Topic Models. Journal of Statistical Software, 91(2), 1–40.
- 3.Grimmer, J., & Stewart, B. M. (2013). Text as Data: The Promise and Pitfalls of Automatic Content Analysis Methods for Political Texts. Political Analysis, 21(3), 267–297.
You have read it. What now?
Cite this page
ScholarGate. (2026, June 22). Structural Topic Model. ScholarGate. https://scholargate.app/political-science/structural-topic-model