Arguments

res

The dynr object returned by dynr.cook().

dynrModel

The model object to plot.

style

The style of the plot. If style is 1 (default), user-selected smoothed state variables are plotted. If style is 2, user-selected observed-versus-predicted values are plotted.

numSubjDemo

The number of subjects to be randomly selected for plotting.

idtoPlot

Values of the ID variable to plot.

names.state

(optional) The names of the states to be plotted, which should be a subset of the state.names slot of the measurement slot of dynrModel.

names.observed

(optional) The names of the observed variables to be plotted, which should be a subset of the obs.names slot of the measurement slot of dynrModel.

names.regime

(optional) The names of the regimes to be plotted, which can be missing.

shape.values

(optional) A vector of values that correspond to the shapes of the points, which can be missing. See the R documentation on pch for details on possible shapes.

title

(optional) A title of the plot.

ylab

(optional) The label of the y axis.

is.bw

Is plot in black and white? The default is FALSE.

colorPalette

A color palette for lines and dots. It is a value passed to the palette argument of the ggplot2::scale_colour_brewer() function. These palettes are in the R package RColorBrewer. One can find them by attaching the package with library(RColorBrewer) and run display.brewer.all().

fillPalette

A color palette for blocks. It is a value passed to the palette argument of the ggplot2::scale_fill_brewer() function. These palettes are in the package RColorBrewer. One can find them by attaching the package with library(RColorBrewer) and run display.brewer.all().

mancolorPalette

(optional) A color palette for manually scaling the colors of lines and dots. It is a vector passed to the values argument of the ggplot2::scale_colour_manual function.

manfillPalette

(optional) A color palette for manually scaling the colors of filled blocks. It is a vector passed to the values argument of the ggplot2::scale_fill_manual function.

...

A list of elements that modify the existing ggplot theme. Consult the ggplot2::theme() function in the R package ggplot2 for more options.

object

The same as res. The dynr object returned by dynr.cook().

Details

This function outputs a ggplot layer that can be modified using functions in the package ggplot2. That is, one can add layers, scales, coords and facets with the "+" sign. In an example below, the ggplot2::ylim() function is used to modify the limits of the y axis of the graph. More details can be found on http://ggplot2.org and http://ggplot2.tidyverse.org/reference/.

The two functions dynr.ggplot() and autoplot() as identical aliases of one another. The autoplot() function is an S3 method from the package ggplot2 that allows many objects to be plotted and works like the base plot() function.