View source: R/ctDiscretePars.R
ctStanDiscretePars | R Documentation |
Calculate model implied regressions for a sequence of time intervals (if ct) or steps (if dt) based on a ctStanFit object, for specified subjects. Wrap with print() when used inside for loops!
ctStanDiscretePars(
ctstanfitobj,
subjects = "popmean",
times = seq(from = 0, to = 10, by = 0.1),
nsamples = 200,
observational = FALSE,
standardise = FALSE,
cov = FALSE,
plot = FALSE,
cores = 2,
...
)
ctstanfitobj |
model fit from |
subjects |
Either 'popmean', to use the population mean parameter, or a vector of integers denoting which subjects. |
times |
Numeric vector of positive values, discrete time parameters will be calculated for each. If the fit object is a discrete time model, these should be positive integers. |
nsamples |
Number of samples from the stanfit to use for plotting. Higher values will increase smoothness / accuracy, at cost of plotting speed. Values greater than the total number of samples will be set to total samples. |
observational |
Logical. If TRUE, outputs expected change in processes *conditional on observing* a 1 unit change in each – this change is correlated according to the DIFFUSION matrix. If FALSE, outputs expected regression values – also interpretable as an independent 1 unit change on each process, giving the expected response under a 1 unit experimental impulse. |
standardise |
Logical. If TRUE, output is standardised according to expected total within subject variance, given by the asymDIFFUSIONcov matrix. |
cov |
Logical. If TRUE, covariances are returned instead of regression coefficients. |
plot |
Logical. If TRUE, ggplots output using |
cores |
Number of cpu cores to use for computing subject matrices. If subject matrices were saved during fiting, not used. |
... |
additional plotting arguments to control |
If plot=TRUE, the function will return a ggplot2 object (and hence needs to be printed if intended to display within a loop). This can be modified by the various ggplot2 functions, or displayed using print(x).
data.table::setDTthreads(1) #ignore this line
ctStanDiscretePars(ctstantestfit,times=seq(.5,4,.1),
plot=TRUE,indices='CR')
#modify plot
require(ggplot2)
g=ctStanDiscretePars(ctstantestfit,times=seq(.5,4,.1),
plot=TRUE,indices='CR')
g= g+ labs(title='Cross effects')
print(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.