This function is computationally expensive, especially if CI=TRUE and/or permute=TRUE. This function is called internally by treeval.plot(), as it updates tree$frame to store information (pvalues and confidence intervals) that will be printed by treeval.plot(). If you will be making several plots while playing around with font size and formatting, it is a good idea to call this function first so that it need not be called repeatedly by different calls of treeval.plot inferenceFrame( tree, sigma_y = sd(tree$model[, 1]),
CI = TRUE,
alpha = 0.05,
digits = 3,
permute = FALSE
)

## Arguments

tree The tree that you will be plotting. The standard deviation of the response. If known, should be provided. Otherwise, a conservative estimate (the sample standard deviation of the response) is used. Boolean. Should confidence intervals be computed? As confidence intervals are inefficient to compute, this should be set to FALSE if you intend to make a plot that does not display confidence intervals. If CI=TRUE, the confidence intervals that are computed will be (1-alpha) confidence intervals. Integer. The number of digits that the p-values and confidence intervals will be rounded to in the later plot. Boolean. If TRUE, inference for each region conditions on the event that the region appears in the tree (all permutations of the branch). This leads to narrower intervals but is computationally expensive. If FALSE, inference for each regon conditions on the event that the particular branch appears in the tree; this is a computationally-efficient alternative. Only relevant if CI=TRUE.

## Value

An rpart object. Identical to tree expect that now tree\$frame has two extra columns; one storing p-values for splits and the other storing confidence intervals for regions. If this object is passed in to treeval.plot, the plots will be made more efficiently.

## Examples

if (FALSE) {
library(rpart)
bls.tree <-rpart(
kcal24h0~hunger+disinhibition+resteating+rrvfood+liking+wanting,
model = TRUE, data = blsdata, cp=0.02
)
bls.tree2 <- inferenceFrame(bls.tree)
treeval.plot(bls.tree2, inferenceType=1)
treeval.plot(bls.tree2, inferenceType=2)
treeval.plot(bls.tree2, inferenceType=2, nn=FALSE)
}