This is the main interface function for the LDATS application
of Bayesian change point Time Series analyses (Christensen et al.
2018), which extends the model of Western and Kleykamp (2004;
see also Ruggieri 2013) to multinomial (proportional) response data using
softmax regression (Ripley 1996, Venables and Ripley 2002, Bishop 2006)
using a generalized linear modeling approach (McCullagh and Nelder 1989).
The models are fit using parallel tempering Markov Chain Monte Carlo
(ptMCMC) methods (Earl and Deem 2005) to locate change points and
neural networks (Ripley 1996, Venables and Ripley 2002, Bishop 2006) to
estimate regressors.
check_TS_inputs
checks that the inputs to
TS
are of proper classes for a full analysis.
TS(data, formula = gamma ~ 1, nchangepoints = 0, timename = "time", weights = NULL, control = list()) check_TS_inputs(data, formula = gamma ~ 1, nchangepoints = 0, timename = "time", weights = NULL, control = list())
data |
|
---|---|
formula |
|
nchangepoints |
|
timename |
|
weights | Optional class |
control | A |
TS
: TS_fit
-class list containing the following
elements, many of
which are hidden for print
ing, but are accessible:
data
input to the function.
formula
input to the function.
nchangepoints
input to the function.
weights
input to the function.
control
input to the function.
Iteration-by-iteration
logLik values for the
full time series fit by multinom_TS
.
Iteration-by-iteration change point estimates from
est_changepoints
.
Iteration-by-iteration marginal regressor estimates from
est_regressors
, which have been
unconditioned with respect to the change point locations.
ptMCMC diagnostics,
see diagnose_ptMCMC
Summary table describing rhos
(the change
point locations),
see summarize_rhos
.
Variance-covariance matrix for the estimates of
rhos
(the change point locations), see
measure_rho_vcov
.
Summary table describing ets
(the
regressors),
see summarize_etas
.
Variance-covariance matrix for the estimates of
etas
(the regressors), see
measure_eta_vcov
.
Across-iteration average of log-likelihoods
(lls
).
Total number of parameters in the full model, including the change point locations and regressors.
Penalized negative log-likelihood, based on
logLik
and nparams
.
check_TS_inputs
: An error message is thrown if any input
is not proper, else NULL
.
Bishop, C. M. 2006. Pattern Recognition and Machine Learning. Springer, New York, NY, USA.
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.
Earl, D. J. and M. W. Deem. 2005. Parallel tempering: theory, applications, and new perspectives. Physical Chemistry Chemical Physics 7: 3910-3916. link.
McCullagh, P. and J. A. Nelder. 1989. Generalized Linear Models. 2nd Edition. Chapman and Hall, New York, NY, USA.
Ripley, B. D. 1996. Pattern Recognition and Neural Networks. Cambridge University Press, Cambridge, UK.
Ruggieri, E. 2013. A Bayesian approach to detecting change points in climactic records. International Journal of Climatology 33:520-528. link.
Venables, W. N. and B. D. Ripley. 2002. Modern and Applied Statistics with S. Fourth Edition. Springer, New York, NY, USA.
Western, B. and M. Kleykamp. 2004. A Bayesian change point model for historical time series analysis. Political Analysis 12:354-374. link.
data(rodents) document_term_table <- rodents$document_term_table document_covariate_table <- rodents$document_covariate_table LDA_models <- LDA_set(document_term_table, topics = 2)[[1]] data <- document_covariate_table data$gamma <- LDA_models@gamma weights <- document_weights(document_term_table) # \donttest{ TSmod <- TS(data, gamma ~ 1, nchangepoints = 1, "newmoon", weights) # } check_TS_inputs(data, timename = "newmoon")