treeval.plot
to make treeval.plot
run more efficiently.R/plotting_functions.R
inferenceFrame.Rd
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 )
tree | The tree that you will be plotting. |
---|---|
sigma_y | The standard deviation of the response. If known, should be provided. Otherwise, a conservative estimate (the sample standard deviation of the response) is used. |
CI | Boolean. Should confidence intervals be computed? As confidence intervals are inefficient to compute, this should be set to
|
alpha | If |
digits | Integer. The number of digits that the p-values and confidence intervals will be rounded to in the later plot. |
permute | Boolean. If |
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.
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) }