View source: R/ctDiscretePars.R
ctStanDiscreteParsPlot | R Documentation |
Plots model implied regression strengths at specified times for continuous time models fit with ctStanFit.
ctStanDiscreteParsPlot(
x,
indices = "all",
quantiles = c(0.025, 0.5, 0.975),
latentNames = "auto",
ylab = "Coefficient",
xlab = "Time interval",
ylim = NA,
facets = NA,
splitSubjects = TRUE,
colour = "Effect",
title = "Temporal regressions | independent shock of 1.0",
polygonalpha = 0.1,
ggcode = NA
)
x |
list object returned from |
indices |
Either a string specifying type of plot to create, or an n by 2 matrix specifying which indices of the output matrix to plot. 'AR' specifies all diagonals, for discrete time autoregression parameters. 'CR' specifies all off-diagonals,for discrete time cross regression parameters. 'all' plots all AR and CR effects at once. |
quantiles |
numeric vector of length 3, with values between 0 and 1, specifying which quantiles to plot. The default plots 95% credible intervals and the posterior median at 50%. |
latentNames |
Vector of character strings denoting names for the latent variables. 'auto' just uses eta1 eta2 etc. |
ylab |
y label. |
xlab |
x label. |
ylim |
Custom ylim. |
facets |
May be 'Subject' or 'Effect'. |
splitSubjects |
if TRUE, subjects are plotted separately, if FALSE they are combined. |
colour |
Character string denoting how colour varies. 'Effect' or 'Subject'. |
title |
Character string. |
polygonalpha |
Numeric between 0 and 1 to multiply the alpha of the fill. |
ggcode |
if TRUE, returns a list containing the data.table to plot, and a character string that can be evaluated (with the necessary arguments such as ylab etc filled in). For modifying plots. |
A ggplot2 object. This can be modified by the various ggplot2 functions, or displayed using print(x).
data.table::setDTthreads(1) #ignore this line
x <- ctStanDiscretePars(ctstantestfit)
ctStanDiscreteParsPlot(x, indices='CR')
#to modify plot:
g <- ctStanDiscreteParsPlot(x, indices='CR') +
ggplot2::labs(title='My ggplot modification')
print(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.