Learn R Programming

ctsem (version 2.5.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, returndifference = FALSE, probs = c(0.025, 0.5,
  0.975), whichTIpreds = 1, parmatrices = TRUE, whichpars = "all",
  nsamples = 200, timeinterval = 1, plot = FALSE, ...)

Arguments

fit

fit object from ctStanFit

returndifference

logical. If FALSE, absolute parameter values are returned. If TRUE, only the effect of the covariate (i.e. without the average value of the parameter) are returned. The former can be easier to interpret, but the latter are more likely to fit multiple plots together. Not used if parmatrices=TRUE.

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.

parmatrices

Logical. If TRUE (default), the ctStanParMatrices function is used to return an expanded range of possible matrices of interest.

whichpars

Integer vector specifying Which of the individually varying subject level parameters to compute effects on. Only used if parmatrices=FALSE . 'all' 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[fit$ctstanmodel$pars$indvarying,'param'].

nsamples

Positive integer specifying the maximum number of samples to use. Character string 'all' can also be used.

timeinterval

positive numeric indicating time interval to use for discrete time parameter matrices, if parmatrices=TRUE.

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
# NOT RUN {
ctStanTIpredeffects(ctstantestfit,plot=TRUE)
# }

Run the code above in your browser using DataLab