topics_by_doc_date: Extract topic likelihoods per document for an STM topic model

Description Usage Arguments Value

View source: R/topic-extract.R

Description

topics_by_doc_date retrieves the likelihoods that a document is generated from a topic (gamma in the passed topic STM model). Related functions and examples in this package interpret this likelihood effectively as a topic share.

Usage

1
2
topics_by_doc_date(topicModel, termsDfm, textData, documentIdColumn,
  dateColumn)

Arguments

topicModel

an stm topic model fit to the document-feature-matrix provided in the termsDfm argument

termsDfm

a document-feature-matrix of type quanteda::dfm that was used to fit the provided topicModel (see terms_dfm).

textData

a dataframe containing the original text source reduced to the document-feature-matrix provided in the termsDfm argument

documentIdColumn

the column name in textData specifying a unique identifier for a document

dateColumn

the column name in textData containing a publication date associated with a document identified by a unique identifier in documentIdColumn

Value

a dataframe with topic shares/likelihoods per document, where:

document

a unique identifier for a document

occur

a publication date associated with document

topic_id

a numeric identifier of a topic

gamma

the likelihood that document is generated from the topic with topic_id; the analyses in this package interprete this likelihood as the share of this topic in this document.


sdaume/topicsplorrr documentation built on Dec. 22, 2021, 11:11 p.m.