Learn R Programming

ctsem (version 2.1.0)

ctStanTIpredeffects: Get time independent predictor effect estimates

Description

COmputes and plots combined effects and quantiles for effects of time independent predictors on subject level parameters of a ctStanFit object.

Usage

ctStanTIpredeffects(fit, probs = c(0.25, 0.5, 0.75), whichTIpreds = 1, whichpars = "all", plot = FALSE, ...)

Arguments

fit
fit object from ctStanFit
probs
numeric vector of quantile probabilities from 0 to 1. Specify 3 values if plotting, the 2nd will be drawn as a line with uncertainty polygon based on 1st and 3rd.
whichTIpreds
integer vector specifying which of the tipreds in the fit object you want to use to calculate effects. Unless quadratic / higher order versions of predictors have been included, selecting more than one probably doesn't make sense. If for instance a squared predictor has been included, then you can specify both the linear and squared version. The x axis of the plot (if generated) will be based off the first indexed predictor. To check what predictors are in the model, run fit$ctstanmodel$TIpredNames.
whichpars
Integer vector specifying Which of the individually varying subject level parameters to compute effects on. 'auto' uses all available, which is equivalent to 1:sum(fit$ctstanmodel$pars$indvarying). The integer corresponding to specific parameters can be found as follows, replacing fit as appropriate: fit$ctstanmodel$pars[sf$ctstanmodel$pars$indvarying,'param'].
plot
Logical. If TRUE, nothing is returned but instead ctPlotArray is used to plot the output instead.
...
arguments to pass to ctPlotArray for plotting.

Value

Either a three dimensional array of predictor effects, or nothing with a plot generated.

Examples

Run this code
ctStanTIpredeffects(ctstantestfit,plot=TRUE)
ctStanTIpredeffects(ctstantestfit,plot=TRUE,separate=TRUE)

Run the code above in your browser using DataLab