Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering R for Quantitative Finance

You're reading from  Mastering R for Quantitative Finance

Product type Book
Published in Mar 2015
Publisher
ISBN-13 9781783552078
Pages 362 pages
Edition 1st Edition
Languages

Table of Contents (20) Chapters

Mastering R for Quantitative Finance
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Time Series Analysis 2. Factor Models 3. Forecasting Volume 4. Big Data – Advanced Analytics 5. FX Derivatives 6. Interest Rate Derivatives and Models 7. Exotic Options 8. Optimal Hedging 9. Fundamental Analysis 10. Technical Analysis, Neural Networks, and Logoptimal Portfolios 11. Asset and Liability Management 12. Capital Adequacy 13. Systemic Risks Index

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], collapse = " + "), sep = " ~ ")
library(rpart)
tree <- rpart(formula = tree_formula, data = d_tree, maxdepth = 5 ,cp = 0.001)
tree <- prune(tree, cp = 0.003)
par(xpd = T)
plot(tree)
text(tree, cex = .5, use.n = T, all = T...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}