Re: [R] RQuantlib Array processing applying EuropeanOptionExampleArray

From: Joe Byers <joe-byers_at_utulsa.edu>
Date: Tue 23 May 2006 - 13:03:20 EST

Dirk,

Thank you. Shortly after I sent this email off, I discovered that I left the Array off the function name. It worked fine.

My ignorance and oversight.

Thanx for the help.

Joe

Dirk Eddelbuettel wrote:
> On 22 May 2006 at 10:57, Joe Byers wrote:
> | I try and run the EuropeanOption example using atm.work$For_Price as my
> | array of underlying prices and the other inputs from row 9 of atm.work.
> | i<-9;
> | x<-EuropeanOption(type = "put", underlying = atm.work$For_Price, strike
> | = atm.work$K[i],
> | dividendYield = atm.work$BEY[i], riskFreeRate =
> | atm.work$BEY[i], maturity = atm.work$t_exp[i],
> | volatility = atm.work$sigma[i])
> |
> | x$parameters has the array of underlying prices but the results is only
> | a single vector using the first row of atm.work$For_Price. Is this
> | because I am pulling the inputs from data.frame not arrays?
>
> If I understand correctly what you are trying to do, then there may simply be
> a misunderstanding on your part.
>
> EuropeanOption(), like all but one [ more on that in the next paragraph ] of
> the other RQuantLib functions, expects _scalars_ for all its inputs. But you
> seem to expect that it magically vectorises things automatically for you. It
> doesn't, and that's why you get errors or unexpected results.
>
> There is however one convenience function -- mostly as a proof of concept --
> which unrolls vectors (or sequences) in any of its arguments. See
>
> > help(EuropeanOptionArrays)
>
> and
>
> > example(EuropeanOptionArrays)
>
> where the results are shown in terms of two sequences of values for the
> underlying and the volatility.
>
> As always, there will be many more clever ways for doing this. Suggestions
> and patches welcome.
>
> | Any help is greatly appreciated.

>
> Hope this helps.
>
> Regards, Dirk
>
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue May 23 13:08:22 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 23 May 2006 - 14:10:31 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.