SimCPrInDT {PrInDT} | R Documentation |
Interdependent estimation for classification
Description
The function SimCPrInDT applies interdependent estimation (endogenous case) for finding an optimal model for relationships between the two-class factor variables
specified as column indices of 'data' in the vector 'inddep' and all other factor and numerical variables in the data frame 'data' by means of
'N' repetitions of random subsampling with percentages 'percl' for the large classes and 'percs' for the small classes. One percentage of observations
for each dependent variable has to be specified for the larger and the smaller class. For example, for three dependent variables, 'percl' consists of
three percentages specified in the order in which the dependent variables appear in 'inddep'.
The dependent variables have to be specified as dummies, i.e. as 'property absent' (value 0) or 'property present' (value 1).
The optimization citerion is the balanced accuracy on the full sample.
In an additional step, the mean balanced accuracy over all class variables is optimized (joint optimization).
The trees generated from undersampling can be restricted by not accepting trees
including 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.
Usage
SimCPrInDT(data,ctestv=NA,inddep,percl,percs,N=99,M,psize,conf.level=0.95,
minsplit=NA,minbucket=NA)
Arguments
data |
Input data frame with class factor variables and the influential variables, |
ctestv |
Vector of character strings of forbidden split results; |
inddep |
indices of dependent variables |
percl |
list of undersampling percentages of larger class (numerical, > 0 and <= 1): one per dependent class variable in the same order as in 'inddep' |
percs |
list of undersampling percentage of smaller class (numerical, > 0 and <= 1); one per dependent class variable in the same order as in 'inddep' |
N |
no. of repetitions of subsampling of observations (integer > 0); default = 99 |
M |
no. of repetitions of subsampling of predictors |
psize |
no. of predictors in the subsamples of the predictors |
conf.level |
(1 - significance level) in function |
minsplit |
Minimum number of elements in a node to be splitted; |
minbucket |
Minimum number of elements in a node; |
Details
See Buschfeld & Weihs (2025), Optimizing decision trees for the analysis of World Englishes and sociolinguistic data. Cambridge University Press, section 4.5.6.2, for further information.
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.
Value
- models1
Best trees at stage 1
- models2
Best trees at stage 2
- models3
Best trees from mean maximization
- classnames
names of classification variables
- baAll
balanced accuracies of best trees at both stages
Examples
data <- PrInDT::data_land # load data
dataclean <- data[,c(1:7,23:24,11:13,22,8:10)] # only relevant features
inddep <- c(14:16) # dependent variables
dataland <- na.omit(dataclean)
ctestv <- NA
perc <- c(0.45,0.05,0.25) # percentages of observations of larger class,
# 1 per dependent class variable
perc2 <- c(0.75,0.95,0.75) # percentages of observations of smaller class,
# 1 per dependent class variable
outland <- SimCPrInDT(dataland,percl=perc,percs=perc2,N=9,inddep=inddep,M=2,psize=10)
outland
plot(outland)