An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20111101/73e5ad28/attachment.pl>
GBSVolatility in fOptions
5 messages · financial engineer, Joshua Ulrich
You have the source code. Take a look:
GBSVolatility = function(price, TypeFlag = c("c", "p"), S, X, Time, r, b,
tol = .Machine$double.eps, maxiter = 10000)
{
TypeFlag = TypeFlag[1]
volatility = uniroot(.fGBSVolatility, interval = c(-10,10), price = price,
TypeFlag = TypeFlag, S = S, X = X, Time = Time, r = r, b = b,
tol = tol, maxiter = maxiter)$root
volatility
}
There you go. Now you can read ?uniroot to see what it does.
--
Joshua Ulrich ?| ?FOSS Trading: www.fosstrading.com
On Tue, Nov 1, 2011 at 6:59 PM, financial engineer <fin_engr at hotmail.com> wrote:
hi, Can anyone shed some light on which root-finding algorithm the GBSVolatility function uses - is it the Newton method? thanks, BA ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20111101/f6c13803/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20111101/4fa226c6/attachment.pl>
BA,
.fGBSVolatility is the objective function. You asked about the
root-finding algorithm. Please see ?uniroot; among other things, it
says:
The function uses Fortran subroutine 'zeroin' (from Netlib)
based on algorithms given in the reference below. They assume a
continuous function (which then is known to have at least one root
in the interval).
Best,
--
Joshua Ulrich ?| ?FOSS Trading: www.fosstrading.com
On Tue, Nov 1, 2011 at 8:03 PM, financial engineer <fin_engr at hotmail.com> wrote:
going through the?uniroot, it seems like the crux is in .fGBSVolatility where the function is defined, unless I am?missing the point.?apologies if I am .... perhaps the more relevant question would have been me requesting reference to .fGBSVolatility....
From: josh.m.ulrich at gmail.com
Date: Tue, 1 Nov 2011 19:48:11 -0500
Subject: Re: [R-SIG-Finance] GBSVolatility in fOptions
To: fin_engr at hotmail.com
CC: r-sig-finance at r-project.org
You have the source code. Take a look:
GBSVolatility = function(price, TypeFlag = c("c", "p"), S, X, Time, r, b,
tol = .Machine$double.eps, maxiter = 10000)
{
TypeFlag = TypeFlag[1]
volatility = uniroot(.fGBSVolatility, interval = c(-10,10), price = price,
TypeFlag = TypeFlag, S = S, X = X, Time = Time, r = r, b = b,
tol = tol, maxiter = maxiter)$root
volatility
}
There you go. Now you can read ?uniroot to see what it does.
--
Joshua Ulrich ?| ?FOSS Trading: www.fosstrading.com
On Tue, Nov 1, 2011 at 6:59 PM, financial engineer <fin_engr at hotmail.com>
wrote:
hi, Can anyone shed some light on which root-finding algorithm the GBSVolatility function uses - is it the Newton method? thanks, BA ? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.