fit_ctm: Fit CTM (Correlated topic model)

View source: R/fit_stm.R

fit_ctmR Documentation

Fit CTM (Correlated topic model)

Description

Estimate a CTM topic model.

Usage

fit_ctm(pooled_dfm, n_topics = 2L, ...)

Arguments

pooled_dfm

Object of class dfm (see dfm) containing (pooled) Tweets.

n_topics

Integer with number of topics

...

Additional arguments passed to stm.

Value

Object of class stm

See Also

stm

Examples

## Not run: 

library(Twitmo)

# load tweets (included in package)
mytweets <- load_tweets(system.file("extdata", "tweets_20191027-141233.json", package = "Twitmo"))

# Pool tweets into longer pseudo-documents
pool <- pool_tweets(data = mytweets)
pooled_dfm <- pool$document_term_matrix

# fit your CTM with 7 topics
ctm_model <- fit_ctm(pooled_dfm, n_topics = 7)

## End(Not run)


abuchmueller/Twitmo documentation built on Sept. 14, 2022, 8:06 p.m.