ctStanDiscretePars: ctStanDiscretePars

View source: R/ctDiscretePars.R

ctStanDiscreteParsR Documentation

ctStanDiscretePars

Description

Calculate model implied regressions for a sequence of time intervals (if ct) or steps (if dt) based on a ctStanFit object, for specified subjects.

Usage

ctStanDiscretePars(
  ctstanfitobj,
  subjects = "popmean",
  times = seq(from = 0, to = 10, by = 0.1),
  nsamples = 100,
  observational = FALSE,
  standardise = FALSE,
  cov = FALSE,
  plot = FALSE,
  cores = 2,
  ...
)

Arguments

ctstanfitobj

model fit from ctStanFit

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, plots output using ctStanDiscreteParsPlot instead of returning output.

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 ctStanDiscreteParsPlot

Examples

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)

cdriveraus/ctsem documentation built on April 18, 2024, 5:24 a.m.