| LDA_TS {LDATS} | R Documentation |
Run a full set of Latent Dirichlet Allocations and Time Series models
Description
Conduct a complete LDATS analysis (Christensen
et al. 2018), including running a suite of Latent Dirichlet
Allocation (LDA) models (Blei et al. 2003, Grun and Hornik 2011)
via LDA_set, selecting LDA model(s) via
select_LDA, running a complete set of Bayesian Time Series
(TS) models (Western and Kleykamp 2004) via TS_on_LDA on
the chosen LDA model(s), and selecting the best TS model via
select_TS.
conform_LDA_TS_data converts the data input to
match internal and sub-function specifications.
check_LDA_TS_inputs checks that the inputs to
LDA_TS are of proper classes for a full analysis.
Usage
LDA_TS(
data,
topics = 2,
nseeds = 1,
formulas = ~1,
nchangepoints = 0,
timename = "time",
weights = TRUE,
control = list()
)
conform_LDA_TS_data(data, quiet = FALSE)
check_LDA_TS_inputs(
data = NULL,
topics = 2,
nseeds = 1,
formulas = ~1,
nchangepoints = 0,
timename = "time",
weights = TRUE,
control = list()
)
Arguments
data |
Either a document term table or a list including at least
a document term table (with the word "term" in the name of the element)
and optionally also a document covariate table (with the word
"covariate" in the name of the element).
|
topics |
Vector of the number of topics to evaluate for each model.
Must be conformable to |
nseeds |
|
formulas |
Vector of |
nchangepoints |
Vector of |
timename |
|
weights |
Optional input for overriding standard weighting for
documents in the time series. Defaults to |
control |
A |
quiet |
|
Value
LDA_TS: a class LDA_TS list object including all
fitted LDA and TS models and selected models specifically as elements
"LDA models" (from LDA_set),
"Selected LDA model" (from select_LDA),
"TS models" (from TS_on_LDA), and
"Selected TS model" (from select_TS).
conform_LDA_TS_data: a data list that is ready for analyses
using the stage-specific functions.
check_LDA_TS_inputs: an error message is thrown if any input is
improper, otherwise NULL.
References
Blei, D. M., A. Y. Ng, and M. I. Jordan. 2003. Latent Dirichlet Allocation. Journal of Machine Learning Research 3:993-1022. link.
Christensen, E., D. J. Harris, and S. K. M. Ernest. 2018. Long-term community change through multiple rapid transitions in a desert rodent community. Ecology 99:1523-1529. link.
Grun B. and K. Hornik. 2011. topicmodels: An R Package for Fitting Topic Models. Journal of Statistical Software 40:13. link.
Western, B. and M. Kleykamp. 2004. A Bayesian change point model for historical time series analysis. Political Analysis 12:354-374. link.
Examples
data(rodents)
mod <- LDA_TS(data = rodents, topics = 2, nseeds = 1, formulas = ~1,
nchangepoints = 1, timename = "newmoon")
conform_LDA_TS_data(rodents)
check_LDA_TS_inputs(rodents, timename = "newmoon")