Setting classification rules
Let's follow a different logic to develop decision rules so that we can contrast the two results later. Let's select which shares offered the best returns. Decision or classification trees are great for this purpose. Here, R will pick from the given list of variables those that can create the most effective decision rules. Instead of building joint rules, like we did previously, first, it selects the variable using which we may create subgroups of the shares regarding their TRS. Then, for each of these subgroups, it will choose the second most effective variable and so on. The output is a kind of decision tree:
d_tree <- d[,c(3:17,19)] vars <- colnames(d_tree) m <- length(vars) tree_formula <- paste(vars[m], paste(vars[-m], ...
Get R: Data Analysis and Visualization now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.