# Virtual class "TopicModel"

### Description

Fitted topic model.

### Objects from the Class

Objects of class `"LDA"`

are returned by `LDA()`

and
of class `"CTM"`

by `CTM()`

.

### Slots

Class `"TopicModel"`

contains

`call`

:Object of class

`"call"`

.`Dim`

:Object of class

`"integer"`

; number of documents and terms.`control`

:Object of class

`"TopicModelcontrol"`

; options used for estimating the topic model.`k`

:Object of class

`"integer"`

; number of topics.`terms`

:Vector containing the term names.

`documents`

:Vector containing the document names.

`beta`

:Object of class

`"matrix"`

; logarithmized parameters of the word distribution for each topic.`gamma`

:Object of class

`"matrix"`

; parameters of the posterior topic distribution for each document.`iter`

:Object of class

`"integer"`

; the number of iterations made.`logLiks`

:Object of class

`"numeric"`

; the vector of kept intermediate log-likelihood values of the corpus. See`loglikelihood`

how the log-likelihood is determined.`n`

:Object of class

`"integer"`

; number of words in the data used.`wordassignments`

:Object of class

`"simple_triplet_matrix"`

; most probable topic for each observed word in each document.

Class `"VEM"`

contains

`loglikelihood`

:Object of class

`"numeric"`

; the log-likelihood of each document given the parameters for the topic distribution and for the word distribution of each topic is approximated using the variational parameters and underestimates the log-likelihood by the Kullback-Leibler divergence between the variational posterior probability and the true posterior probability.

Class `"LDA"`

extends class `"TopicModel"`

and has the additional
slots

`loglikelihood`

:Object of class

`"numeric"`

; the posterior likelihood of the corpus conditional on the topic assignments is returned.`alpha`

:Object of class

`"numeric"`

; parameter of the Dirichlet distribution for topics over documents.

Class `"LDA_Gibbs"`

extends class `"LDA"`

and has
the additional slots

`seed`

:Either

`NULL`

or object of class`"simple_triplet_matrix"`

; parameter for the prior distribution of the word distribution for topics if seeded.`z`

:Object of class

`"integer"`

; topic assignments of words ordered by terms with suitable repetition within documents.

Class `"CTM"`

extends class `"TopicModel"`

and has the additional
slots

`mu`

:Object of class

`"numeric"`

; mean of the topic distribution on the logit scale.`Sigma`

:Object of class

`"matrix"`

; variance-covariance matrix of topics on the logit scale.

Class `"CTM_VEM"`

extends classes `"CTM"`

and
`"VEM"`

and has the additional
slots

`nusqared`

:Object of class

`"matrix"`

; variance of the variational distribution on the parameter mu.

### Author(s)

Bettina Gruen