predictY: Predictions from a spline tree

Description Usage Arguments Value Examples

View source: R/tree_evaluation.R

Description

Returns a vector of predicted responses for the testData. If testData is ommitted, returns predictions for the training data. This function is most meaningful if model$intercept==TRUE.

Usage

1
predictY(model, testData = NULL)

Arguments

model

A model created with splineTree()

testData

The data to return predictions for. If ommitted, uses the training data.

Value

A vector of predictions with rows corresponding to the testdata.

Examples

1
2
3
4
5
6
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)

plot(predictY(tree), tree$parms$data[[tree$parms$yvar]])

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