March 2019
Beginner to intermediate
250 pages
6h 6m
English
Let’s put the winsorization approach into practice. First, we need to know the position of ratios in the dataset:
head(colnames(train)) ## [1] "ID_RSSD" "UBPR1795" "UBPR4635" "UBPRC233" "UBPRD582" "UBPRE386"tail(colnames(train)) ## [1] "UBPRE541" "UBPRE542" "UBPRJ248" "UBPRK447" "Date" "Default"
So, we need to apply the technique to all the variables, excluding the first and the last two variables.
All the transformations done in the training set should be applied later in the test dataset. Modifications in the test sample will be done using the limits of the training data. We will do winsorization for both datasets:
for (k in 2:(ncol(train)-2)){ variable<-as.character(colnames(train)[k]) limits <- quantile(train[,k], ...Read now
Unlock full access