stm v1.3.5


Monthly downloads



Estimation of the Structural Topic Model

The Structural Topic Model (STM) allows researchers to estimate topic models with document-level covariates. The package also includes tools for model selection, visualization, and estimation of topic-covariate regressions. Methods developed in Roberts et al (2014) <doi:10.1111/ajps.12103> and Roberts et al (2016) <doi:10.1080/01621459.2016.1141684>. Vignette is Roberts et al (2019) <doi:10.18637/jss.v091.i02>.

Functions in stm

Name Description
asSTMCorpus STM Corpus Coercion
manyTopics Performs model selection across separate STM's that each assume different numbers of topics.
gadarian Gadarian and Albertson data
textProcessor Process a vector of raw texts
readCorpus Read in a corpus file.
js.estimate A James-Stein Estimator Shrinking to a Uniform Distribution
readLdac Read in a .ldac Formatted File
multiSTM Analyze Stability of Local STM Mode
exclusivity Exclusivity
make.heldout Heldout Likelihood by Document Completion
poliblog5k CMU 2008 Political Blog Corpus
findThoughts Find Thoughts
plot.searchK Plots diagnostic values resulting from searchK
plot.topicCorr Plot a topic correlation graph
plot.STMpermute Plot an STM permutation test.
fitNewDocuments Fit New Documents
plot.estimateEffect Plot effect of covariates on topics
findTopic Find topics that contain user specified words.
labelTopics Label topics
make.dt Make a data.table of topic proportions.
plotTopicLoess Plot some effects with loess
plotRemoved Plot documents, words and tokens removed at various word thresholds
prepDocuments Prepare documents for analysis with stm
stm-package Structural Topic Model
selectModel Assists the user in selecting the best STM model.
plotQuote Plots strings
plot.STM Functions for plotting STM objects
plot.MultimodDiagnostic Plotting Method for Multimodality Diagnostic Objects
plotModels Plots semantic coherence and exclusivity for high likelihood models outputted from selectModel.
semanticCoherence Semantic Coherence
sageLabels Displays verbose labels that describe topics and topic-covariate groups in depth.
stm Variational EM for the Structural Topic Model
topicLasso Plot predictions using topics
topicCorr Estimate topic correlation
makeDesignMatrix Make a Design Matrix
rmvnorm Draw from a Multivariate Normal
summary.STM Summary Function for the STM objects
thetaPosterior Draw from Theta Posterior
s Make a B-spline Basis Function
permutationTest Permutation test of a binary covariate.
writeLdac Write a .ldac file
optimizeDocument Optimize Document
toLDAvisJson Wrapper to create Json mapping for LDAvis. This can be useful in indirect render e.g. Shiny Dashboards
toLDAvis Wrapper to launch LDAvis topic browser.
summary.estimateEffect Summary for estimateEffect
topicQuality Plots semantic coherence and exclusivity for each topic.
searchK Computes diagnostic values for models with different values of K (number of topics).
unpack.glmnet Unpack a glmnet object
estimateEffect Estimates regressions using an STM object
checkResiduals Residual dispersion test for topic number
cloud Plot a wordcloud
calcscore Calculate Score Words
checkBeta Looks for words that load exclusively onto a topic
calcfrex Calculate FREX (FRequency and EXclusivity) Words
convertCorpus Convert stm formatted documents to another format
alignCorpus Align the vocabulary of a new corpus to an old corpus
calclift Calculate Lift Words
No Results!

Vignettes of stm

No Results!

Last month downloads


LinkingTo Rcpp, RcppArmadillo
Encoding UTF-8
LazyData yes
License MIT + file LICENSE
RoxygenNote 6.1.1
Language en-US
NeedsCompilation yes
Packaged 2019-12-17 01:09:31 UTC; brandonstewart
Repository CRAN
Date/Publication 2019-12-17 12:50:02 UTC

Include our badge in your README