Learn R Programming

keyATM (version 0.5.3)

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

398

Version

0.5.3

License

GPL-3

Maintainer

Shusei Eshima

Last Published

March 30th, 2025

Functions in keyATM (0.5.3)

keyATM_fit_LDAHMM

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

Show a diagnosis plot of log-likelihood and perplexity
multiPGreg

Run multinomial regression with Polya-Gamma augmentation
plot.strata_doctopic

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

Show the top documents for each topic
top_topics

Show the top topics for each document
plot_topicprop

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

Predict topic proportions for the covariate keyATM
read_keywords

Convert a quanteda dictionary to keywords
read_dfm_cpp

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

Save a figure
semantic_coherence

Semantic Coherence: Mimno et al. (2011)
word_in_doc

Checking if a word is in a document
make_wsz_cpp

Initialize assignments
keyATMvb_fit

Fit a keyATM model with Collapsed Variational Bayes
keyATM_fit_LDAcov

Run the Collapsed Gibbs sampler for weighted LDA with covariates
top_words

Show the top words for each topic
values_fig

Get values used to create a figure
plot_pi

Show a diagnosis plot of pi
plot_timetrend

Plot time trend
visualize_keywords

Visualize keywords
weightedLDA

Weighted LDA main function
by_strata_TopicWord

Estimate subsetted topic-word distribution
calc_PGtheta_R

Calculate the probability for Polya-Gamma Covariate Model
keyATM-package

Keyword Assisted Topic Models
covariates_info

Show covariates information
keyATM

keyATM main function
by_strata_DocTopic

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

Return covariates used in the iteration
keyATM_read

Read texts
keyATMvb

keyATM with Collapsed Variational Bayes
keyATM_initialize

Initialize a keyATM model
keyATM_fit_LDA

Run the Collapsed Gibbs sampler for weighted LDA
keyATM_data_bills

Bills data
keyATM_fit_HMM

Run the Collapsed Gibbs sampler for the keyATM Dynamic
keyATM_fit_base

Run the Collapsed Gibbs sampler for the keyATM Base
keyATM_output

Create an output object
keyATMvb_call

Run the Variational Bayes for the keyATM models
keyATM_fit_covPG

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

Show a diagnosis plot of alpha
keyATM_fit_cov

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