growplot: Plot by-subject and by-group growth curves

Description Usage Arguments Value Author(s) See Also

View source: R/growplot.R

Description

Produces a by-subject plot of predicted growth curves with associated data values and an aggregated by-group plot of growth curves along with a smoother line for each group based on user input. Facilates inference for different growth curve patterns based on subsets of subjects and various subject groupings.

Usage

1
2
3
4
growplot(object, compare.objects = NULL, subjects.plot = NULL,
  groups.plot = NULL, subjects.subset = NULL, subjects.random = TRUE,
  x.lab = "Time", y.lab = "Fit", main.label = "Main_Model",
  title.lab = NULL)

Arguments

object

A dpgrow, dgrowmm or dpgrowmult object obtained from running the appropriate modeling function.

compare.objects

An optional list of dpgrow, dgrowmm or dpgrowmm objects to employ as comparison models for by-subject plotting

subjects.plot

A vector of subjects to use for by-group plot that is composed of some subset of subject. Defaults to all subjects modeled in object.

groups.plot

A vector with associated group identifiers for subjects.plot if the grouping is different from trt used to run the dpgrow or dpgrowmm model. The entered grouping does not have to relate to that used for modeling. Defaults to use of treatment groups modeled in object (if not entered).

subjects.subset

A vector of a subset of subjects.plot to use for by-subject plotting for readability. The full subjects.plot set is used for by group plotting. If left blank, the full subjects.plot vector is used for by-subject plotting.

subjects.random

A boolean scalar. If TRUE a random subset (of 10) is selected from subjects.plot for by-subject plotting. Leave blank if enter subjects.subset. Defaults to TRUE.

x.lab

Optional title for x-axis. Default = "Time"

y.lab

Optional title for y-axis. Default = "Fit"

main.label

An optional character model label for object to use in by-subject plots for comparison with models from compare.objects

title.lab

option plot title. A vector of 2 character entries is allowed. The first entry is the title for the group aggregated plot. The second entry is the title for the plot of selected subject growth curves. If title.lab contains a single entry, then it is used as the title for both plots. Otherwise, defaults to NULL.

Value

A list object containing a plot objects, data.frame object from which it is constructed, and data.frame with actual data values co-plotted.

dat.gc

A data.frame object used to generate the within subject predicted growth curves for object. Used for aggregated plot of growth curves by group returned in p.gctrt Fields are titled, c("fit","time","subject","trt").

dat.igc

A data.frame object containing within subject predicted growth curves under models in object and compare.objects. Used for by-subject growth curves plot returned in p.gcsub.

dat.data

A data.frame object containing the actual data observations for plotted subjects. Field titles are the same as for dat.gc.

p.gctrt

A ggplot2 object of subjects aggregated by group.

p.gcsub

A ggplot2 object of subjects.

Author(s)

Terrance Savitsky tds151@gmail.com

See Also

dpgrowmm, dpgrow, dpgrowmult, growthCurve


growcurves documentation built on May 2, 2019, 7:03 a.m.