Pairs Trading: A Bayesian Example


Book Description

Have you ever wondered whether Bayesian analysis can be applied toward the stock market? We did, and set out to investigate. This book shows you how to find relationships between stocks or exchange traded funds (ETFs) using Bayesian analysis. A relationship that most traders are probably familiar with is linear correlation. This is sometimes used as the basis for pairs trading. But linear correlation is just one way that stocks or ETFs can be related. The analysis we present in this book can be used to exploit almost any kind of relationship that may exist between stocks or ETFs. The book will show how to calculate the probability of a stock or ETF ending the day up or down based on what other stocks or ETFs are doing. A probability is more useful than a simple up or down signal. It quantifies the certainty of a prediction and allows a trader to take a position consistent with a given level of risk. Any active trader should find the techniques presented in this book useful. We are only going to examine the relationships in one small group of ETFs as an example of what is possible but the same techniques will work for any set of stocks, ETFs, or even bonds. The tool we use to calculate the probability of a positive or negative return on a stock or ETF is called a Bayesian classifier. It is called a classifier because it calculates probabilities for only two discrete outcomes: positive or negative. The method we use to calculate these probabilities is called Bayes' Theorem.




Pairs Trading


Book Description

The first in-depth analysis of pairs trading Pairs trading is a market-neutral strategy in its most simple form. The strategy involves being long (or bullish) one asset and short (or bearish) another. If properly performed, the investor will gain if the market rises or falls. Pairs Trading reveals the secrets of this rigorous quantitative analysis program to provide individuals and investment houses with the tools they need to successfully implement and profit from this proven trading methodology. Pairs Trading contains specific and tested formulas for identifying and investing in pairs, and answers important questions such as what ratio should be used to construct the pairs properly. Ganapathy Vidyamurthy (Stamford, CT) is currently a quantitative software analyst and developer at a major New York City hedge fund.




Machine Learning for Algorithmic Trading


Book Description

Leverage machine learning to design and back-test automated trading strategies for real-world markets using pandas, TA-Lib, scikit-learn, LightGBM, SpaCy, Gensim, TensorFlow 2, Zipline, backtrader, Alphalens, and pyfolio. Purchase of the print or Kindle book includes a free eBook in the PDF format. Key FeaturesDesign, train, and evaluate machine learning algorithms that underpin automated trading strategiesCreate a research and strategy development process to apply predictive modeling to trading decisionsLeverage NLP and deep learning to extract tradeable signals from market and alternative dataBook Description The explosive growth of digital data has boosted the demand for expertise in trading strategies that use machine learning (ML). This revised and expanded second edition enables you to build and evaluate sophisticated supervised, unsupervised, and reinforcement learning models. This book introduces end-to-end machine learning for the trading workflow, from the idea and feature engineering to model optimization, strategy design, and backtesting. It illustrates this by using examples ranging from linear models and tree-based ensembles to deep-learning techniques from cutting edge research. This edition shows how to work with market, fundamental, and alternative data, such as tick data, minute and daily bars, SEC filings, earnings call transcripts, financial news, or satellite images to generate tradeable signals. It illustrates how to engineer financial features or alpha factors that enable an ML model to predict returns from price data for US and international stocks and ETFs. It also shows how to assess the signal content of new features using Alphalens and SHAP values and includes a new appendix with over one hundred alpha factor examples. By the end, you will be proficient in translating ML model predictions into a trading strategy that operates at daily or intraday horizons, and in evaluating its performance. What you will learnLeverage market, fundamental, and alternative text and image dataResearch and evaluate alpha factors using statistics, Alphalens, and SHAP valuesImplement machine learning techniques to solve investment and trading problemsBacktest and evaluate trading strategies based on machine learning using Zipline and BacktraderOptimize portfolio risk and performance analysis using pandas, NumPy, and pyfolioCreate a pairs trading strategy based on cointegration for US equities and ETFsTrain a gradient boosting model to predict intraday returns using AlgoSeek's high-quality trades and quotes dataWho this book is for If you are a data analyst, data scientist, Python developer, investment analyst, or portfolio manager interested in getting hands-on machine learning knowledge for trading, this book is for you. This book is for you if you want to learn how to extract value from a diverse set of data sources using machine learning to design your own systematic trading strategies. Some understanding of Python and machine learning techniques is required.




Pairs Trading


Book Description

The first in-depth analysis of pairs trading Pairs trading is a market-neutral strategy in its most simple form. The strategy involves being long (or bullish) one asset and short (or bearish) another. If properly performed, the investor will gain if the market rises or falls. Pairs Trading reveals the secrets of this rigorous quantitative analysis program to provide individuals and investment houses with the tools they need to successfully implement and profit from this proven trading methodology. Pairs Trading contains specific and tested formulas for identifying and investing in pairs, and answers important questions such as what ratio should be used to construct the pairs properly. Ganapathy Vidyamurthy (Stamford, CT) is currently a quantitative software analyst and developer at a major New York City hedge fund.




The Coin Toss


Book Description

The coin toss is really just a metaphor for a random event that has only two possible outcomes. The actual tossing of a real coin is just one way to realize such an event. There are many examples of questions that are equivalent to a coin toss. For example: Will the stock market close up or down tomorrow? Will a die roll come up with an even or odd number? Will we make contact with extraterrestrials within the next ten years? Will a car drive by in the next minute? Will tomorrow be sunny or cloudy? Will my medical test result be negative or positive? Will I enjoy this movie? Will the next joke be funny? Will the Earth's average temperature go up next year?Because a coin toss is equivalent to such a wide variety of questions, the results in this book are widely applicable.Because the coin toss is the simplest random event you can imagine, many questions about coin tossing can be asked and answered in great depth. The simplicity of the coin toss also opens the road to more advanced probability theories dealing with events with an infinite number of possible outcomes.This book is very mathematical. Some knowledge of calculus, discrete math, and generating functions is helpful to get the most out of it. A review of discrete math is provided in the index,




Bayesian Inference of State Space Models


Book Description

Bayesian Inference of State Space Models: Kalman Filtering and Beyond offers a comprehensive introduction to Bayesian estimation and forecasting for state space models. The celebrated Kalman filter, with its numerous extensions, takes centre stage in the book. Univariate and multivariate models, linear Gaussian, non-linear and non-Gaussian models are discussed with applications to signal processing, environmetrics, economics and systems engineering. Over the past years there has been a growing literature on Bayesian inference of state space models, focusing on multivariate models as well as on non-linear and non-Gaussian models. The availability of time series data in many fields of science and industry on the one hand, and the development of low-cost computational capabilities on the other, have resulted in a wealth of statistical methods aimed at parameter estimation and forecasting. This book brings together many of these methods, presenting an accessible and comprehensive introduction to state space models. A number of data sets from different disciplines are used to illustrate the methods and show how they are applied in practice. The R package BTSA, created for the book, includes many of the algorithms and examples presented. The book is essentially self-contained and includes a chapter summarising the prerequisites in undergraduate linear algebra, probability and statistics. An up-to-date and complete account of state space methods, illustrated by real-life data sets and R code, this textbook will appeal to a wide range of students and scientists, notably in the disciplines of statistics, systems engineering, signal processing, data science, finance and econometrics. With numerous exercises in each chapter, and prerequisite knowledge conveniently recalled, it is suitable for upper undergraduate and graduate courses.




An Introduction to Copulas


Book Description

Copulas are functions that join multivariate distribution functions to their one-dimensional margins. The study of copulas and their role in statistics is a new but vigorously growing field. In this book the student or practitioner of statistics and probability will find discussions of the fundamental properties of copulas and some of their primary applications. The applications include the study of dependence and measures of association, and the construction of families of bivariate distributions. With nearly a hundred examples and over 150 exercises, this book is suitable as a text or for self-study. The only prerequisite is an upper level undergraduate course in probability and mathematical statistics, although some familiarity with nonparametric statistics would be useful. Knowledge of measure-theoretic probability is not required. Roger B. Nelsen is Professor of Mathematics at Lewis & Clark College in Portland, Oregon. He is also the author of "Proofs Without Words: Exercises in Visual Thinking," published by the Mathematical Association of America.




Bayesian Data Analysis, Third Edition


Book Description

Now in its third edition, this classic book is widely considered the leading text on Bayesian methods, lauded for its accessible, practical approach to analyzing data and solving research problems. Bayesian Data Analysis, Third Edition continues to take an applied approach to analysis using up-to-date Bayesian methods. The authors—all leaders in the statistics community—introduce basic concepts from a data-analytic perspective before presenting advanced methods. Throughout the text, numerous worked examples drawn from real applications and research emphasize the use of Bayesian inference in practice. New to the Third Edition Four new chapters on nonparametric modeling Coverage of weakly informative priors and boundary-avoiding priors Updated discussion of cross-validation and predictive information criteria Improved convergence monitoring and effective sample size calculations for iterative simulation Presentations of Hamiltonian Monte Carlo, variational Bayes, and expectation propagation New and revised software code The book can be used in three different ways. For undergraduate students, it introduces Bayesian inference starting from first principles. For graduate students, the text presents effective current approaches to Bayesian modeling and computation in statistics and related fields. For researchers, it provides an assortment of Bayesian methods in applied statistics. Additional materials, including data sets used in the examples, solutions to selected exercises, and software instructions, are available on the book’s web page.




Bayes Rules!


Book Description

Praise for Bayes Rules!: An Introduction to Applied Bayesian Modeling “A thoughtful and entertaining book, and a great way to get started with Bayesian analysis.” Andrew Gelman, Columbia University “The examples are modern, and even many frequentist intro books ignore important topics (like the great p-value debate) that the authors address. The focus on simulation for understanding is excellent.” Amy Herring, Duke University “I sincerely believe that a generation of students will cite this book as inspiration for their use of – and love for – Bayesian statistics. The narrative holds the reader’s attention and flows naturally – almost conversationally. Put simply, this is perhaps the most engaging introductory statistics textbook I have ever read. [It] is a natural choice for an introductory undergraduate course in applied Bayesian statistics." Yue Jiang, Duke University “This is by far the best book I’ve seen on how to (and how to teach students to) do Bayesian modeling and understand the underlying mathematics and computation. The authors build intuition and scaffold ideas expertly, using interesting real case studies, insightful graphics, and clear explanations. The scope of this book is vast – from basic building blocks to hierarchical modeling, but the authors’ thoughtful organization allows the reader to navigate this journey smoothly. And impressively, by the end of the book, one can run sophisticated Bayesian models and actually understand the whys, whats, and hows.” Paul Roback, St. Olaf College “The authors provide a compelling, integrated, accessible, and non-religious introduction to statistical modeling using a Bayesian approach. They outline a principled approach that features computational implementations and model assessment with ethical implications interwoven throughout. Students and instructors will find the conceptual and computational exercises to be fresh and engaging.” Nicholas Horton, Amherst College An engaging, sophisticated, and fun introduction to the field of Bayesian statistics, Bayes Rules!: An Introduction to Applied Bayesian Modeling brings the power of modern Bayesian thinking, modeling, and computing to a broad audience. In particular, the book is an ideal resource for advanced undergraduate statistics students and practitioners with comparable experience. Bayes Rules! empowers readers to weave Bayesian approaches into their everyday practice. Discussions and applications are data driven. A natural progression from fundamental to multivariable, hierarchical models emphasizes a practical and generalizable model building process. The evaluation of these Bayesian models reflects the fact that a data analysis does not exist in a vacuum. Features • Utilizes data-driven examples and exercises. • Emphasizes the iterative model building and evaluation process. • Surveys an interconnected range of multivariable regression and classification models. • Presents fundamental Markov chain Monte Carlo simulation. • Integrates R code, including RStan modeling tools and the bayesrules package. • Encourages readers to tap into their intuition and learn by doing. • Provides a friendly and inclusive introduction to technical Bayesian concepts. • Supports Bayesian applications with foundational Bayesian theory.




Bayesian Networks


Book Description

Explains the material step-by-step starting from meaningful examples Steps detailed with R code in the spirit of reproducible research Real world data analyses from a Science paper reproduced and explained in detail Examples span a variety of fields across social and life sciences Overview of available software in and outside R