[R] 3D Black-Scholes Graph Help!

ilai keren at math.montana.edu
Tue Mar 13 22:56:37 CET 2012


On Tue, Mar 13, 2012 at 3:34 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> When I got around to running it I was hampered by a lack of knowledge about
> what sort of data-object "price" might have been. I tried putting in a
> single number on hte theory that it would saitisfy the seq() call, and also
>  got the error you report. More input is needed from the OP about the
> problem specification, and hopefully she will provide a test dataset.

It is just a number. The OP function works fine, the error was
generated by wireframe because of the "partial" data passed to formula
- OptionPrice is a matrix, not a column in the grid data.frame which
only holds the scales.

Anna, Replace call to wireframe in your function with

wireframe(OptionPrice,main="3D Option", drape=T, col.regions=heat.colors(100),
scales = list(arrows=F,x=list(at=1:length(t),labels=t),y=list(at=1:length(s),labels=s)))

Then:
plotbs(16)

Note, the first value is always NaN but that's from your calculations
- look at the OptionPrice matrix.

Cheers
Elai



> --
> David.
>
>
>>
>> Berend
>>
>
> David Winsemius, MD
> West Hartford, CT
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list