Learn R Programming

keyATM (version 0.5.5)

Keyword Assisted Topic Models

Description

Fits keyword assisted topic models (keyATM) using collapsed Gibbs samplers. The keyATM combines the latent dirichlet allocation (LDA) models with a small number of keywords selected by researchers in order to improve the interpretability and topic classification of the LDA. The keyATM can also incorporate covariates and directly model time trends. The keyATM is proposed in Eshima, Imai, and Sasaki (2024) .

Copy Link

Version

Install

install.packages('keyATM')

Monthly Downloads

523

Version

0.5.5

License

GPL-3

Maintainer

Shusei Eshima

Last Published

January 17th, 2026

Functions in keyATM (0.5.5)

plot_pi

Show a diagnosis plot of pi
keyATMvb_fit

Fit a keyATM model with Collapsed Variational Bayes
top_topics

Show the top topics for each document
keyATM_fit_covPG

Run the Collapsed Gibbs sampler for the keyATM covariates (Polya-Gamma)
plot_modelfit

Show a diagnosis plot of log-likelihood and perplexity
plot_alpha

Show a diagnosis plot of alpha
top_words

Show the top words for each topic
keyATM_initialize

Initialize a keyATM model
save_fig

Save a figure
semantic_coherence

Semantic Coherence: Mimno et al. (2011)
refine_keywords

Refine keywords
plot.strata_doctopic

Plot document-topic distribution by strata (for covariate models)
top_docs

Show the top documents for each topic
multiPGreg

Run multinomial regression with Polya-Gamma augmentation
plot_timetrend

Plot time trend
plot_topicprop

Show the expected proportion of the corpus belonging to each topic
predict.keyATM_output

Predict topic proportions for the covariate keyATM
values_fig

Get values used to create a figure
make_wsz_cpp

Initialize assignments
weightedLDA

Weighted LDA main function
read_keywords

Convert a quanteda dictionary to keywords
visualize_keywords

Visualize keywords
read_dfm_cpp

Read files from the quanteda dfm (this is the same as dgCMatrix)
word_in_doc

Checking if a word is in a document
by_strata_TopicWord

Estimate subsetted topic-word distribution
keyATM-package

Keyword Assisted Topic Models
by_strata_DocTopic

Estimate document-topic distribution by strata (for covariate models)
calc_PGtheta_R

Calculate the probability for Polya-Gamma Covariate Model
covariates_get

Return covariates used in the iteration
keyATM

keyATM main function
covariates_info

Show covariates information
keyATM_read

Read texts
keyATMvb

keyATM with Collapsed Variational Bayes
keyATM_output

Create an output object
keyATM_fit_cov

Run the Collapsed Gibbs sampler for the keyATM covariates (Dir-Multi)
keyATM_fit_LDA

Run the Collapsed Gibbs sampler for weighted LDA
keyATM_data_bills

Bills data
keyATMvb_call

Run the Variational Bayes for the keyATM models
keyATM_fit_LDAcov

Run the Collapsed Gibbs sampler for weighted LDA with covariates
keyATM_fit_HMM

Run the Collapsed Gibbs sampler for the keyATM Dynamic
keyATM_fit_LDAHMM

Run the Collapsed Gibbs sampler for the weighted LDA with HMM model
keyATM_fit_base

Run the Collapsed Gibbs sampler for the keyATM Base