Hi Sonal,

The example you gave is not reproducible since we don't have "data" as you
do.
However, here is an example of how to access the object you are after:

tmp <- CRRBinomialTreeOption(TypeFlag = "pa", S = 50, X = 50,
     Time = 5/12, r = 0.1, b = 0.1, sigma = 0.4, n = 5)

tmp@price

Cheers,
Tal

----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------




On Fri, Dec 24, 2010 at 6:51 AM, sonal <sonal.sarkar@arxaa.com> wrote:

>
> I'm using the CRRBinomialTreeOption function (in package "fOptions") with a
> loop for pricing a large number of options. But I can't transfer the values
> obtained from this function to a "numeric" matrix as the outcome of this
> function is not a simple numeric.
>
> The following is the piece of code:
>
> # USING THE FUNCTION
> library(fOptions)
> option.price<-matrix(nrow=250,ncol=9)
> for(j in 1:9){for(i in 1:250)
>
> {option.price[i,j]=CRRBinomialTreeOption(TypeFlag="ca",S=data[(i+250),j],X=data[j,19],Time=T[i,j],r=data[i
> ,(9+j)],b=0,sigma=sig[i,j],n=5)}}
>
> R output:
> Error in option.price[i, j] = CRRBinomialTreeOption(TypeFlag = "ca", S =
> data[(i +  :
>  object of type 'S4' is not subsettable
>
> I'm very new to R and can't find a solution with my knowledge at this
> moment. Plz help.
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Help-required-binomial-option-pricing-using-package-tp3162935p3162935.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>

	[[alternative HTML version deleted]]

