plot.TS_fit {LDATS}R Documentation

Plot an LDATS TS model

Description

Generalization of the plot function to work on fitted TS model objects (class TS_fit) returned from TS.

Usage

## S3 method for class 'TS_fit'
plot(
  x,
  ...,
  plot_type = "summary",
  interactive = FALSE,
  cols = set_TS_summary_plot_cols(),
  bin_width = 1,
  xname = NULL,
  border = NA,
  selection = "median",
  LDATS = FALSE
)

Arguments

x

A TS_fit object of a multinomial time series model fit by TS.

...

Additional arguments to be passed to subfunctions. Not currently used, just retained for alignment with plot.

plot_type

"diagnostic" or "summary".

interactive

logical input, should be codeTRUE unless testing.

cols

list of elements used to define the colors for the two panels of the summary plot, as generated simply using set_TS_summary_plot_cols. cols has two elements rho and gamma, each corresponding to the related panel, and each containing default values for entries named cols, option, and alpha. See set_gamma_colors and set_rho_hist_colors for details on usage.

bin_width

Width of the bins used in the histograms of the summary time series plot, in units of the x-axis (the time variable used to fit the model).

xname

Label for the x-axis in the summary time series plot. Defaults to NULL, which results in usage of the timename element of the control list (held incontrol$TS_control$timename). To have no label printed, set xname = "".

border

Border for the histogram, default is NA.

selection

Indicator of the change points to use in the time series summary plot. Currently only defined for "median" and "mode".

LDATS

logical indicating if the plot is part of a larger LDATS plot output.

Value

NULL.

Examples


  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)
  TSmod <- TS(data, gamma ~ 1, nchangepoints = 1, "newmoon", weights)
  plot(TSmod)



[Package LDATS version 0.3.0 Index]