The printout provides numbered labels for the terminal nodes, a description of the split at each node, the number of observations found at each node, and the predicted spline coefficients for each node. This code is primarily taken from rpart base code for print.rpart. It has been modified to ensure that the full vector of coefficients is printed for each node.

stPrint(t, cp, digits = getOption("digits"))

Arguments

t

A model returned by splineTree()

cp

Optional- if provided, a pruned version of the tree will be printed. The tree will be pruned using the provided cp as the complexity parameter.

digits

Specifies how many digits of each coefficient should be printed

Examples

split_formula <- ~HISP + WHITE + BLACK + SEX + Num_sibs + HGC_FATHER + HGC_MOTHER tree <- splineTree(split_formula, BMI~AGE, idvar = "ID", data = nlsySample, degree = 1, df = 3, intercept = TRUE, cp = 0.005)
stPrint(tree)
#> n= 1000, #> #> node), split, n , coefficients #> * denotes terminal node #> #> 1) root, 1000, (21.52416, 4.961796, 8.091247) #> 2) WHITE< 0.5, 505, (21.42300, 5.882807, 9.006190) #> 4) HGC_FATHER< 0.5, 25, (23.08928, 7.703289, 8.380706)* #> 5) HGC_FATHER>=0.5, 480, (21.33622, 5.787990, 9.038767)* #> 3) WHITE>=0.5, 495, (21.62736, 4.022179, 7.157821) #> 6) SEX< 1.5, 259, (22.69360, 3.999510, 6.896897)* #> 7) SEX>=1.5, 236, (20.45721, 4.047057, 7.444175) #> 14) HGC_FATHER< 7.5, 12, (20.40041, 9.027571, 9.903029)* #> 15) HGC_FATHER>=7.5, 224, (20.46025, 3.780243, 7.312451)*