spaghettiPlot: Create a faceted spaghetti plot of a splinetree model

Description Usage Arguments Examples

View source: R/plotting.R

Description

Uses ggplot to create a paneled spaghetti plot of the data, where each panel corresponds to a terminal node in the tree. Allows users to visualize homogeneity of trajectories within the terminal nodes of the tree while also looking at the trajectories of different nodes side by side.

Usage

1

Arguments

model

a model returned from splineTree()

colors

optional argument specifying colors to be used for each panel.

Examples

1
2
3
4
5
6
7
nlsySubset <- nlsySample[nlsySample$ID %in% sample(unique(nlsySample$ID), 400),]
split_formula <- ~HISP + WHITE + BLACK + SEX + Num_sibs + HGC_FATHER + HGC_MOTHER
tree <- splineTree(split_formula, BMI~AGE, idvar = "ID",
   data = nlsySubset, degree = 1, df = 3,
   intercept = TRUE, cp = 0.005)

spaghettiPlot(tree)

splinetree documentation built on July 18, 2019, 9:08 a.m.