Learn R Programming

⚠️There's a newer version (1.3.7) of this package.Take me there.

stm (version 1.3.6.1)

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

4,213

Version

1.3.6.1

License

MIT + file LICENSE

Maintainer

Brandon Stewart

Last Published

August 21st, 2023

Functions in stm (1.3.6.1)

makeDesignMatrix

Make a Design Matrix
optimizeDocument

Optimize Document
findThoughts

Find Thoughts
plot.STM

Functions for plotting STM objects
plot.MultimodDiagnostic

Plotting Method for Multimodality Diagnostic Objects
fitNewDocuments

Fit New Documents
plot.searchK

Plots diagnostic values resulting from searchK
plot.topicCorr

Plot a topic correlation graph
poliblog5k

CMU 2008 Political Blog Corpus
permutationTest

Permutation test of a binary covariate.
prepDocuments

Prepare documents for analysis with stm
s

Make a B-spline Basis Function
rmvnorm

Draw from a Multivariate Normal
plot.STMpermute

Plot an STM permutation test.
gadarian

Gadarian and Albertson data
manyTopics

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

Read in a .ldac Formatted File
js.estimate

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

Plot effect of covariates on topics
readCorpus

Read in a corpus file.
multiSTM

Analyze Stability of Local STM Mode
plotQuote

Plots strings
plotModels

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

Plot some effects with loess
plotRemoved

Plot documents, words and tokens removed at various word thresholds
stm-package

Structural Topic Model
selectModel

Assists the user in selecting the best STM model.
summary.estimateEffect

Summary for estimateEffect
summary.STM

Summary Function for the STM objects
stm

Variational EM for the Structural Topic Model
textProcessor

Process a vector of raw texts
semanticCoherence

Semantic Coherence
thetaPosterior

Draw from Theta Posterior
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).
toLDAvis

Wrapper to launch LDAvis topic browser.
writeLdac

Write a .ldac file
toLDAvisJson

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

Plot predictions using topics
topicCorr

Estimate topic correlation
unpack.glmnet

Unpack a glmnet object
topicQuality

Plots semantic coherence and exclusivity for each topic.
calcfrex

Calculate FREX (FRequency and EXclusivity) Words
checkResiduals

Residual dispersion test for topic number
convertCorpus

Convert stm formatted documents to another format
calcscore

Calculate Score Words
checkBeta

Looks for words that load exclusively onto a topic
cloud

Plot a wordcloud
make.heldout

Heldout Likelihood by Document Completion
alignCorpus

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

Exclusivity
calclift

Calculate Lift Words
estimateEffect

Estimates regressions using an STM object
findTopic

Find topics that contain user specified words.
asSTMCorpus

STM Corpus Coercion
labelTopics

Label topics
make.dt

Make a data.table of topic proportions.