Package: stm 1.3.7

Brandon Stewart

stm: 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>.

Authors:Margaret Roberts [aut], Brandon Stewart [aut, cre], Dustin Tingley [aut], Kenneth Benoit [ctb]

stm_1.3.7.tar.gz
stm_1.3.7.tar.gz(r-4.5-noble)stm_1.3.7.tar.gz(r-4.4-noble)
stm_1.3.7.tgz(r-4.4-emscripten)stm_1.3.7.tgz(r-4.3-emscripten)
stm.pdf |stm.html
stm/json (API)
NEWS

# Install 'stm' in R:
install.packages('stm', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/bstewart/stm/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:

6.85 score 1 stars 6 packages 1.5k scripts 2.6k downloads 12 mentions 49 exports 32 dependencies

Last updated 11 months agofrom:888505c087. Checks:OK: 1 NOTE: 1. Indexed: no.

TargetResultDate
Doc / VignettesOKSep 28 2024
R-4.5-linux-x86_64NOTESep 28 2024

Exports:alignCorpusasSTMCorpuscalcfrexcalcliftcalcscorecheckBetacheckResidualscloudconvertCorpusestimateEffecteval.heldoutexclusivityfindThoughtsfindTopicfitNewDocumentsjs.estimatelabelTopicsmake.dtmake.heldoutmakeDesignMatrixmanyTopicsmultiSTMoptimizeDocumentpermutationTestplot.estimateEffectplot.searchKplot.STMplot.topicCorrplotModelsplotQuoteplotRemovedplotTopicLoessprepDocumentsreadCorpusreadLdacssageLabelssearchKselectModelsemanticCoherencestmtextProcessorthetaPosteriortoLDAvistoLDAvisJsontopicCorrtopicLassotopicQualitywriteLdac

Dependencies:clicodetoolsdata.tablefastmatchforeachglmnetglueISOcodesiteratorsjsonlitelatticeldalifecyclemagrittrMatrixmatrixStatsquadprogquantedaRcppRcppArmadilloRcppEigenrlangshapeslamSnowballCstopwordsstringistringrsurvivalvctrsxml2yaml

Using stm

Rendered fromstmVignette.Rnwusingutils::Sweaveon Sep 28 2024.

Last update: 2020-09-18
Started: 2014-02-28

Readme and manuals

Help Manual

Help pageTopics
Structural Topic Modelstm-package
Align the vocabulary of a new corpus to an old corpusalignCorpus
STM Corpus CoercionasSTMCorpus
Looks for words that load exclusively onto a topiccheckBeta
Residual dispersion test for topic numbercheckResiduals
Plot a wordcloudcloud
Convert 'stm' formatted documents to another formatconvertCorpus
Estimates regressions using an STM objectestimateEffect
Find ThoughtsfindThoughts plot.findThoughts print.findThoughts
Find topics that contain user specified words.findTopic
Fit New DocumentsfitNewDocuments
Gadarian and Albertson datagadarian gadarianFit
Label topicslabelTopics print.labelTopics
Make a 'data.table' of topic proportions.make.dt
Heldout Likelihood by Document Completioneval.heldout make.heldout
Performs model selection across separate STM's that each assume different numbers of topics.manyTopics
Analyze Stability of Local STM ModemultiSTM print.MultimodDiagnostic
Optimize DocumentoptimizeDocument
Permutation test of a binary covariate.permutationTest
Plot effect of covariates on topicsplot.estimateEffect
Plotting Method for Multimodality Diagnostic Objectsplot.MultimodDiagnostic
Plots diagnostic values resulting from searchKplot.searchK
Functions for plotting STM objectsplot.STM
Plot an STM permutation test.plot.STMpermute
Plot a topic correlation graphplot.topicCorr
Plots semantic coherence and exclusivity for high likelihood models outputted from selectModel.plotModels
Plots stringsplotQuote
Plot documents, words and tokens removed at various word thresholdsplotRemoved
Plot some effects with loessplotTopicLoess
CMU 2008 Political Blog Corpuspoliblog5k poliblog5k.docs poliblog5k.meta poliblog5k.voc
Prepare documents for analysis with 'stm'prepDocuments
Read in a corpus file.readCorpus
Read in a .ldac Formatted FilereadLdac
Make a B-spline Basis Functions
Displays verbose labels that describe topics and topic-covariate groups in depth.print.sageLabels sageLabels
Computes diagnostic values for models with different values of K (number of topics).searchK
Assists the user in selecting the best STM model.selectModel
Variational EM for the Structural Topic Modelstm
Summary for estimateEffectprint.summary.estimateEffect summary.estimateEffect
Summary Function for the STM objectsprint.STM summary.STM
Process a vector of raw textshead.textProcessor print.textProcessor summary.textProcessor textProcessor
Draw from Theta PosteriorthetaPosterior
Wrapper to launch LDAvis topic browser.toLDAvis
Wrapper to create Json mapping for LDAvis. This can be useful in indirect render e.g. Shiny DashboardstoLDAvisJson
Estimate topic correlationtopicCorr
Plot predictions using topicstopicLasso
Plots semantic coherence and exclusivity for each topic.topicQuality
Write a .ldac filewriteLdac