Learn R Programming

stm (version 1.3.7)

Estimation of the Structural Topic Model

Description

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) and Roberts et. al. (2016) . Vignette is Roberts et. al. (2019) .

Copy Link

Version

Install

install.packages('stm')

Monthly Downloads

3,905

Version

1.3.7

License

MIT + file LICENSE

Maintainer

Last Published

December 1st, 2023

Functions in stm (1.3.7)

calcfrex

Calculate FREX (FRequency and EXclusivity) Words
calclift

Calculate Lift Words
convertCorpus

Convert stm formatted documents to another format
estimateEffect

Estimates regressions using an STM object
alignCorpus

Align the vocabulary of a new corpus to an old corpus
asSTMCorpus

STM Corpus Coercion
make.heldout

Heldout Likelihood by Document Completion
findTopic

Find topics that contain user specified words.
gadarian

Gadarian and Albertson data
js.estimate

A James-Stein Estimator Shrinking to a Uniform Distribution
plot.MultimodDiagnostic

Plotting Method for Multimodality Diagnostic Objects
exclusivity

Exclusivity
makeDesignMatrix

Make a Design Matrix
findThoughts

Find Thoughts
fitNewDocuments

Fit New Documents
plot.STM

Functions for plotting STM objects
calcscore

Calculate Score Words
plotRemoved

Plot documents, words and tokens removed at various word thresholds
plot.searchK

Plots diagnostic values resulting from searchK
plot.topicCorr

Plot a topic correlation graph
plotTopicLoess

Plot some effects with loess
poliblog5k

CMU 2008 Political Blog Corpus
prepDocuments

Prepare documents for analysis with stm
summary.STM

Summary Function for the STM objects
stm-package

Structural Topic Model
checkBeta

Looks for words that load exclusively onto a topic
summary.estimateEffect

Summary for estimateEffect
stm

Variational EM for the Structural Topic Model
manyTopics

Performs model selection across separate STM's that each assume different numbers of topics.
multiSTM

Analyze Stability of Local STM Mode
textProcessor

Process a vector of raw texts
writeLdac

Write a .ldac file
checkResiduals

Residual dispersion test for topic number
cloud

Plot a wordcloud
thetaPosterior

Draw from Theta Posterior
readCorpus

Read in a corpus file.
topicQuality

Plots semantic coherence and exclusivity for each topic.
labelTopics

Label topics
unpack.glmnet

Unpack a glmnet object
make.dt

Make a data.table of topic proportions.
optimizeDocument

Optimize Document
readLdac

Read in a .ldac Formatted File
permutationTest

Permutation test of a binary covariate.
plotModels

Plots semantic coherence and exclusivity for high likelihood models outputted from selectModel.
plotQuote

Plots strings
plot.STMpermute

Plot an STM permutation test.
plot.estimateEffect

Plot effect of covariates on topics
rmvnorm

Draw from a Multivariate Normal
sageLabels

Displays verbose labels that describe topics and topic-covariate groups in depth.
searchK

Computes diagnostic values for models with different values of K (number of topics).
s

Make a B-spline Basis Function
selectModel

Assists the user in selecting the best STM model.
semanticCoherence

Semantic Coherence
topicCorr

Estimate topic correlation
topicLasso

Plot predictions using topics
toLDAvis

Wrapper to launch LDAvis topic browser.
toLDAvisJson

Wrapper to create Json mapping for LDAvis. This can be useful in indirect render e.g. Shiny Dashboards