Skip to main content Accessibility help
×
Hostname: page-component-78c5997874-lj6df Total loading time: 0 Render date: 2024-11-09T20:36:38.508Z Has data issue: false hasContentIssue false

5 - Dataset Analytics and Risk Measurement

Published online by Cambridge University Press:  20 October 2016

Mark J. Bennett
Affiliation:
University of Chicago
Dirk L. Hugen
Affiliation:
University of Iowa
Get access

Summary

When performing Monte Carlo simulation in finance, mixture models are probabilistic models that can be used to represent subpopulations within a population. In order to simulate extreme events which can occur in the various financial markets, the subpopulations can be jumps or crashes in the market. While applying a non-Gaussian distribution is common practice for introducing these jumps, it is also reasonable to use two or more single-variate Gaussian distributions and combine them into a mixture model. We apply it to simulations from the foreign exchange markets.

Generating Prices from Log Returns

Performing financial analytics is now easier than ever before due to the sophistication of open source toolkits such as RStudio and web-available market datasets. When forecasting and predicting future outcomes using such data, measuring the uncertainty and risk is important. We start with the most basic properties of mixture models and then work our way into actual market events.

Whether the log returns are Gaussian or normally distributed (the theoretical assumption), or not really normally distributed (the practical reality), simulating prices from log returns is important. Once we know the distribution of the log returns, simulating realistic prices allows one to go back and forth between simulated and actual market prices without losing much accuracy.

R has such convenient functional programming syntax that it can really save, at times, the analyst a lot of programming. The best trick in the book for quantitative finance is the idiom

Ylogrets = diff(log(Y))

Being able to apply the log() function to the vector and then feed the results into the diff() function is quite powerful. Imagine how unwieldy this is in a spreadsheet by comparison. Let's see: we must find the top and bottom of the row with the prices and create a column with the logs, now another column with the differences of the logs which is one row fewer in length. In any case, whether in a spreadsheet program or R, finding the inverse to the above equation is not quite so obvious! A little algebra will get us there, though.

Type
Chapter
Information
Financial Analytics with R
Building a Laptop Laboratory for Data Science
, pp. 77 - 91
Publisher: Cambridge University Press
Print publication year: 2016

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×