The function PrInDTreg
realizes regression tree optimization to identify the best interpretable tree; interpretability is checked (see 'ctestv').
The relationship between the target variable 'regname' and all other factor and numerical variables
in the data frame 'datain' is optimally modeled by means of 'N' repetitions of subsampling.
The optimization criterion is the R2 of the model on the validation sample 'valdat'.
Default for the validation sample is the full sample 'datain'.
Multiple subsampling percentages of observations and predictors can be specified (in 'pobs' and 'ppre', correspondingly).
The trees generated from subsampling can be restricted by
rejecting unacceptable trees which include split results specified in the character strings of the vector 'ctestv'.
The parameters 'conf.level', 'minsplit', and 'minbucket' can be used to control the size of the trees.
Besides the maximal R2, the minimal MAE (Mean Absolute Error) is reported.
PrInDTreg(datain,regname,ctestv=NA,N,pobs=c(0.9,0.7),ppre=c(0.9,0.7),
conf.level=0.95,seedl=TRUE,minsplit=NA,minbucket=NA,valdat=datain)
Mean number of interpretable trees over the combinations of individual percentages in 'pobs' and 'ppre'
best resampled regression tree on the validation data set
Best model achieved for %observations
Best model achieved for %predictors
maximum R2 on the validation data set for resampled regression trees (for 'ctmax')
minimum MAE (Mean Absolute Error) on the validation data set for resampled regression trees (for 'ctmax')
interpretability of best tree 'ctmax'
second best resampled regression tree on the full data set
second best model achieved for %observations
second best model achieved for %features
second best R2 on the validation data set for resampled regression trees (for 'ctmax2')
second best MAE on the validation data set for resampled regression trees (for 'ctmax2')
interpretability of second-best tree 'ctmax2'
Input data frame with class factor variable 'classname' and the
influential variables, which need to be factors or numericals (transform logicals and character variables to factors)
name of regressand variable (character)
Vector of character strings of forbidden split results;
(see function PrInDT
for details.)
If no restrictions exist, the default = NA is used.
Number of repetitions (integer > 0)
Vector of resampling percentages of observations (numerical, > 0 and <= 1)
Vector of resampling percentages of predictor variables (numerical, > 0 and <= 1)
(1 - significance level) in function ctree
(numerical, > 0 and <= 1);
default = 0.95
Should the seed for random numbers be set (TRUE / FALSE)?
default = TRUE
Minimum number of elements in a node to be splitted;
default = 20
Minimum number of elements in a node;
default = 7
Validation data; default = datain
For the optimzation of the trees, we employ a method we call Sumping (Subsampling umbrella of model parameters), a variant of Bumping (Bootstrap umbrella of model parameters) (Tibshirani & Knight, 1999). We use subsampling instead of bootstrapping. The aim of the optimization is to identify conditional inference trees with maximum predictive power on the full sample under interpretability restrictions.
Reference
Tibshirani, R., Knight, K. 1999. Model Search and Inference By Bootstrap "bumping".
Journal of Computational and Graphical Statistics, Vol. 8, No. 4 (Dec., 1999), pp. 671-686
Standard output can be produced by means of print(name)
or just name
as well as plot(name)
where 'name' is the output data
frame of the function.
The plot function will produce a series of more than one plot. If you use R, you might want to specify windows(record=TRUE)
before
plot(name)
to save the whole series of plots. In R-Studio this functionality is provided automatically.
data <- PrInDT::data_vowel
data <- na.omit(data)
ctestv <- 'vowel_maximum_pitch <= 320'
N <- 30 # no. of repetitions
pobs <- c(0.70,0.60) # percentages of observations
ppre <- c(0.90,0.70) # percentages of predictors
outreg <- PrInDTreg(data,"target",ctestv,N,pobs,ppre)
outreg
plot(outreg)
Run the code above in your browser using DataLab