ctmaPlotCtsemMod: ctmaPlotCtsemMod

View source: R/ctmaPlotCtsemMod.R

ctmaPlotCtsemModR Documentation

ctmaPlotCtsemMod

Description

Plots moderator models using ctsem fit objects

Usage

ctmaPlotCtsemMod(
  ctStanFitObject = NULL,
  fitSummary = NULL,
  activeDirectory = NULL,
  TIpred.pos = 1,
  saveFilePrefix = "Moderator Plot ",
  scaleTime = 1,
  mod.sd.to.plot = -1:1,
  digits = 4,
  timeUnit = "not specified",
  timeRange = NULL,
  mod.type = "cont",
  no.mod.cats = NULL,
  n.x.labels = NULL,
  plot = TRUE,
  plot.xMin = 0,
  plot.xMax = NULL,
  plot.yMin = -1,
  plot.yMax = 1,
  plot..type = "l",
  plot.lty = 1,
  plot.col = "grey",
  plot.lwd = 1.5,
  dot.plot.type = "b",
  dot.plot.col = "black",
  dot.plot.lwd = 0.5,
  dot.plot.lty = 3,
  dot.plot.pch = 16,
  dot.plot.cex = 3
)

Arguments

ctStanFitObject

The fit object with moderator (TIpred) effects to be plotted

fitSummary

Mainl ofr debugging purpose. Saves computation time if provided in addition to the fit object

activeDirectory

defines the active directory (where to save plots)

TIpred.pos

the Tipred that represents the moderator. Could be more than one in case of dummy variables made from categorical moderators (e.g., TIpred.pos = c(3,4))

saveFilePrefix

Prefix used for saving plots

scaleTime

Factor to increase or decrease the time scale (e.g., 1/12 if estimates were based on yearly intervals and figure should show monthly intervals)

mod.sd.to.plot

The standard deviation vlaues (default -1, 0, +1) for which the drift effects are plotted

digits

number of digits used for rounding

timeUnit

Label for the x-axis

timeRange

time range across which drift effects are plotted

mod.type

Could be either "cont" or "cat"

no.mod.cats

Need to be specified if type = "cat". The number of categories should usually be equal the number of dummy variables used to represent the categorical moderator + 1.

n.x.labels

How many values to be used for indicating time points on the x-axis (0 is automatically added and should not be counted)

plot

plots figures if TRUE (default) otherwise only return moderated drift matrices

plot.xMin

default = 0

plot.xMax

default = NULL

plot.yMin

default = -1

plot.yMax

default = 1

plot..type

default = "l", # 2 dots .. are correct

plot.lty

default = 1

plot.col

default = "grey"

plot.lwd

default = 1.5

dot.plot.type

default = "b" for the dots indicating the moderator values

dot.plot.col

default ="black" for the dots indicating the moderator values

dot.plot.lwd

default = .5 for the dots indicating the moderator values

dot.plot.lty

default = 3 for the dots indicating the moderator values

dot.plot.pch

default = 16 for the dots indicating the moderator values

dot.plot.cex

default = 3 for the dots indicating the moderator values

Value

writes png figures to disc using the path specified in the activeDirectory arguments.

Examples

#Plot a categorical moderator
## Not run: 
ctmaPlotCtsemMod(ctStanFitObject = ctsemFit,
                 activeDirectory=NULL,
                 mod.sd.to.plot = NULL,
                 timeUnit = "Months",
                 timeRange = c(0, 12, .1),
                 mod.type = "cat",
                 no.mod.cats = NULL

## End(Not run)


CoTiMA documentation built on May 29, 2024, 11:39 a.m.