Learn R Programming

growcurves (version 0.2.3.8)

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

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

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 t
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
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 sin

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.gcA 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.igcA 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.dataA data.frame object containing the actual data observations for plotted subjects. Field titles are the same as for dat.gc.
  • p.gctrtA ggplot2 object of subjects aggregated by group.
  • p.gcsubA ggplot2 object of subjects.

See Also

dpgrowmm, dpgrow, dpgrowmult, growthCurve