prep_TS_data | R Documentation |
Append the estimated topic proportions from a fitted LDA model
to the document covariate table to create the data structure needed for
TS
.
prep_TS_data(document_covariate_table, LDA_models, mods, i = 1)
document_covariate_table |
Document covariate table (rows: documents,
columns: time index and covariate options). Every model needs a
covariate to describe the time value for each document (in whatever
units and whose name in the table is input in |
LDA_models |
List of LDA models (class |
mods |
The |
i |
|
Class data.frame
object including [1] the time variable
(indicated in control
), [2] the predictor variables (required by
formula
) and [3], the multinomial response variable (indicated
in formula
), ready for input into TS
.
data(rodents)
document_term_table <- rodents$document_term_table
document_covariate_table <- rodents$document_covariate_table
LDAs <- LDA_set(document_term_table, topics = 2:3, nseeds = 2)
LDA_models <- select_LDA(LDAs)
weights <- document_weights(document_term_table)
formulas <- c(~ 1, ~ newmoon)
mods <- expand_TS(LDA_models, formulas = ~1, nchangepoints = 0)
data1 <- prep_TS_data(document_covariate_table, LDA_models, mods)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.