Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: solving for implied volatility

From   Christopher F Baum <>
Subject   st: solving for implied volatility
Date   Wed, 22 Sep 2004 07:57:22 -0400

Dan said
My problem is how to get implied volatilities out of option prices. I
have the options prices and I want to get implied volatilities out of
them. My variable 'x' contains option prices, variable 'y' contains only
missings. How do I get stata filling 'y' with values (volatility)
solving my option pricing formula (Black-Scholes) ?

Although (given a function that returns the Normal cdf) there is a closed form solution for C (the B-S Call price) in terms of its five arguments (one of which is S, the standard deviation of the underlying stock price), the solution of that function for S as a function of C and the other arguments must be solved by iteration. The foot of the page
provides C code for two ways of solving for implied volatility: a bisection method and Newton-Raphson, taking advantage of the fact that the B-S derivative w.r.t. S (what non-classically-trained options traders call "vega") is also analytical. Both assume that you have a function to calculate the B-S C, which is given farther up on the page.

For a Stata data set containing option call prices (and the other four necessary arguments) you would have to solve for S for each observation in turn. This cannot be done with an egen function, but would require a program that took five variables (C, X, K, T-t, r) and looped over the observations, solving by iteration for the S and generating S as a new variable. My guess is that it would be pretty slow to do this in Stata code, so this would be a great application for a Stata plugin (, which could just pass the five vectors to a C routine -- which is already written in that web page!--and return the S variable).

Kit Baum, Boston College Economics

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index