Thread Subject: Calculating probability of 0 return

Subject: Calculating probability of 0 return

From: MortenA Abrahamsen

Date: 30 Apr, 2009 12:03:03

Message: 1 of 7

Hi!

I have simulated an option value from 1 mill simulations. I've gotten ranges from 0 to 60 for the value of the option.

Now I am trying to figure out a way to calculate the probability of a return of 0. Is there any input on how to do this?

Subject: Calculating probability of 0 return

From: John D'Errico

Date: 30 Apr, 2009 12:46:01

Message: 2 of 7

"MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc41m$6m2$1@fred.mathworks.com>...
> Hi!
>
> I have simulated an option value from 1 mill simulations. I've gotten ranges from 0 to 60 for the value of the option.
>
> Now I am trying to figure out a way to calculate the probability of a return of 0. Is there any input on how to do this?

Please be clear about your question. It sounds
like you have ~1E6 simulations, with a value
returned for each. Sometimes that value was
zero, sometimes not. Now you would like to
estimate the probability that the value was zero?

Surely the trivial solution seems right here.

p = numberZeroEventsObserved/totalEvents

Is there some reason why this is not correct?
If there is a reason, then you need to explain
your problem much more accurately.

John

Subject: Calculating probability of 0 return

From: MortenA Abrahamsen

Date: 30 Apr, 2009 13:35:02

Message: 3 of 7

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <gtc6i9$6n8$1@fred.mathworks.com>...
> "MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc41m$6m2$1@fred.mathworks.com>...
> > Hi!
> >
> > I have simulated an option value from 1 mill simulations. I've gotten ranges from 0 to 60 for the value of the option.
> >
> > Now I am trying to figure out a way to calculate the probability of a return of 0. Is there any input on how to do this?
>
> Please be clear about your question. It sounds
> like you have ~1E6 simulations, with a value
> returned for each. Sometimes that value was
> zero, sometimes not. Now you would like to
> estimate the probability that the value was zero?
>
> Surely the trivial solution seems right here.
>
> p = numberZeroEventsObserved/totalEvents
>
> Is there some reason why this is not correct?
> If there is a reason, then you need to explain
> your problem much more accurately.
>
> John

Hi again!

I'm sorry for not being specific enough, and thank you for your response.
Basically this is the important part of the code:

% simulate the stock price and compute the option price
for i=1:N
    S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
    C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
end

% estimate the option price
[price, err, low, up] = meanstd(C)

If I run 1 mill simulations I get 1 mill different C(1)...... C(1000000) values.

Ex for 9993 through 10.000:
Columns 9993 through 10000

    4.8245 18.7140 19.8167 1.2596 11.9627 12.5841 0 11.7897

I was now wondering how I could find the total number of 0's among the 1 mill simulations. I am quite new with Matlab, and there might be an easy solution for this one.

I was later on thinking about estimating the probability of getting a return obove risk-free rate (e.g. rf = 3%). I am wondering if I need some sort of an IF statement here?

Sorry for the bad explaining, hope you will understand this one!

Morten

Subject: Calculating probability of 0 return

From: John D'Errico

Date: 30 Apr, 2009 14:19:00

Message: 4 of 7

"MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc9e6$qlg$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote in message <gtc6i9$6n8$1@fred.mathworks.com>...
> > "MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc41m$6m2$1@fred.mathworks.com>...
> > > Hi!
> > >
> > > I have simulated an option value from 1 mill simulations. I've gotten ranges from 0 to 60 for the value of the option.
> > >
> > > Now I am trying to figure out a way to calculate the probability of a return of 0. Is there any input on how to do this?
> >
> > Please be clear about your question. It sounds
> > like you have ~1E6 simulations, with a value
> > returned for each. Sometimes that value was
> > zero, sometimes not. Now you would like to
> > estimate the probability that the value was zero?
> >
> > Surely the trivial solution seems right here.
> >
> > p = numberZeroEventsObserved/totalEvents
> >
> > Is there some reason why this is not correct?
> > If there is a reason, then you need to explain
> > your problem much more accurately.
> >
> > John
>
> Hi again!
>
> I'm sorry for not being specific enough, and thank you for your response.
> Basically this is the important part of the code:
>
> % simulate the stock price and compute the option price
> for i=1:N
> S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
> C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
> end
>
> % estimate the option price
> [price, err, low, up] = meanstd(C)
>
> If I run 1 mill simulations I get 1 mill different C(1)...... C(1000000) values.
>
> Ex for 9993 through 10.000:
> Columns 9993 through 10000
>
> 4.8245 18.7140 19.8167 1.2596 11.9627 12.5841 0 11.7897
>
> I was now wondering how I could find the total number of 0's among the 1 mill simulations. I am quite new with Matlab, and there might be an easy solution for this one.
>
> I was later on thinking about estimating the probability of getting a return obove risk-free rate (e.g. rf = 3%). I am wondering if I need some sort of an IF statement here?
>
> Sorry for the bad explaining, hope you will understand this one!
>
> Morten

Ah. I knew there was something unexplained.

The problem is merely how to count the zeros.

numberOfZeros = sum(C==0);

By the way, if you are building the array C using
a loop this way, you have left out a HUGELY
important part. It is the preallocation line for C.

C = zeros(1,N);
for i=1:N
     S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
     C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
end

John

Subject: Calculating probability of 0 return

From: MortenA Abrahamsen

Date: 1 May, 2009 14:58:01

Message: 5 of 7

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <gtcc0k$161$1@fred.mathworks.com>...
> "MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc9e6$qlg$1@fred.mathworks.com>...
> > "John D'Errico" <woodchips@rochester.rr.com> wrote in message <gtc6i9$6n8$1@fred.mathworks.com>...
> > > "MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc41m$6m2$1@fred.mathworks.com>...
> > > > Hi!
> > > >
> > > > I have simulated an option value from 1 mill simulations. I've gotten ranges from 0 to 60 for the value of the option.
> > > >
> > > > Now I am trying to figure out a way to calculate the probability of a return of 0. Is there any input on how to do this?
> > >
> > > Please be clear about your question. It sounds
> > > like you have ~1E6 simulations, with a value
> > > returned for each. Sometimes that value was
> > > zero, sometimes not. Now you would like to
> > > estimate the probability that the value was zero?
> > >
> > > Surely the trivial solution seems right here.
> > >
> > > p = numberZeroEventsObserved/totalEvents
> > >
> > > Is there some reason why this is not correct?
> > > If there is a reason, then you need to explain
> > > your problem much more accurately.
> > >
> > > John
> >
> > Hi again!
> >
> > I'm sorry for not being specific enough, and thank you for your response.
> > Basically this is the important part of the code:
> >
> > % simulate the stock price and compute the option price
> > for i=1:N
> > S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
> > C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
> > end
> >
> > % estimate the option price
> > [price, err, low, up] = meanstd(C)
> >
> > If I run 1 mill simulations I get 1 mill different C(1)...... C(1000000) values.
> >
> > Ex for 9993 through 10.000:
> > Columns 9993 through 10000
> >
> > 4.8245 18.7140 19.8167 1.2596 11.9627 12.5841 0 11.7897
> >
> > I was now wondering how I could find the total number of 0's among the 1 mill simulations. I am quite new with Matlab, and there might be an easy solution for this one.
> >
> > I was later on thinking about estimating the probability of getting a return obove risk-free rate (e.g. rf = 3%). I am wondering if I need some sort of an IF statement here?
> >
> > Sorry for the bad explaining, hope you will understand this one!
> >
> > Morten
>
> Ah. I knew there was something unexplained.
>
> The problem is merely how to count the zeros.
>
> numberOfZeros = sum(C==0);
>
> By the way, if you are building the array C using
> a loop this way, you have left out a HUGELY
> important part. It is the preallocation line for C.
>
> C = zeros(1,N);
> for i=1:N
> S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
> C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
> end
>
> John

Thanks a bunch John! That worked perfectly :)
I haven't left out the C = zeros(1,N); part, hehe.
One more small questing... I am trying to figure out the possibility of return below risk free rate. I have this expression:

uriskfree = sum(1+P^(1/T)-1<rd)
But I get the error ??? Error using ==> mpower
Matrix must be square.
Any ideas?

Morten

Subject: Calculating probability of 0 return

From: Dan Riviello

Date: 22 Oct, 2009 17:55:21

Message: 6 of 7

I can't address this specific question, but as a way to help show your students probability in everyday life, consider using our new website.

It can be accessed at http://www.bookofodds.com

We cover topics ranging from the odds a person has ever eaten cold pizza for breakfast (1 in 2.56) to the odds a female will ever be diagnosed with breast cancer ( 1 in 8.14).

Check us out and use as a reference that will both interest and educate your students.

Subject: Calculating probability of 0 return

From: Matt Fetterman

Date: 22 Oct, 2009 18:13:19

Message: 7 of 7

"MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtf2lp$mrg$1@fred.mathworks.com>...
> "John D'Errico" <woodchips@rochester.rr.com> wrote in message <gtcc0k$161$1@fred.mathworks.com>...
> > "MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc9e6$qlg$1@fred.mathworks.com>...
> > > "John D'Errico" <woodchips@rochester.rr.com> wrote in message <gtc6i9$6n8$1@fred.mathworks.com>...
> > > > "MortenA Abrahamsen" <lynx@pornostjerne.com> wrote in message <gtc41m$6m2$1@fred.mathworks.com>...
> > > > > Hi!
> > > > >
> > > > > I have simulated an option value from 1 mill simulations. I've gotten ranges from 0 to 60 for the value of the option.
> > > > >
> > > > > Now I am trying to figure out a way to calculate the probability of a return of 0. Is there any input on how to do this?
> > > >
> > > > Please be clear about your question. It sounds
> > > > like you have ~1E6 simulations, with a value
> > > > returned for each. Sometimes that value was
> > > > zero, sometimes not. Now you would like to
> > > > estimate the probability that the value was zero?
> > > >
> > > > Surely the trivial solution seems right here.
> > > >
> > > > p = numberZeroEventsObserved/totalEvents
> > > >
> > > > Is there some reason why this is not correct?
> > > > If there is a reason, then you need to explain
> > > > your problem much more accurately.
> > > >
> > > > John
> > >
> > > Hi again!
> > >
> > > I'm sorry for not being specific enough, and thank you for your response.
> > > Basically this is the important part of the code:
> > >
> > > % simulate the stock price and compute the option price
> > > for i=1:N
> > > S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
> > > C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
> > > end
> > >
> > > % estimate the option price
> > > [price, err, low, up] = meanstd(C)
> > >
> > > If I run 1 mill simulations I get 1 mill different C(1)...... C(1000000) values.
> > >
> > > Ex for 9993 through 10.000:
> > > Columns 9993 through 10000
> > >
> > > 4.8245 18.7140 19.8167 1.2596 11.9627 12.5841 0 11.7897
> > >
> > > I was now wondering how I could find the total number of 0's among the 1 mill simulations. I am quite new with Matlab, and there might be an easy solution for this one.
> > >
> > > I was later on thinking about estimating the probability of getting a return obove risk-free rate (e.g. rf = 3%). I am wondering if I need some sort of an IF statement here?
> > >
> > > Sorry for the bad explaining, hope you will understand this one!
> > >
> > > Morten
> >
> > Ah. I knew there was something unexplained.
> >
> > The problem is merely how to count the zeros.
> >
> > numberOfZeros = sum(C==0);
> >
> > By the way, if you are building the array C using
> > a loop this way, you have left out a HUGELY
> > important part. It is the preallocation line for C.
> >
> > C = zeros(1,N);
> > for i=1:N
> > S = quantosimpath(S0, rf, delta, sigmas, sigmax, corr, dt);
> > C(i) = AF*ex*exp(-rd*T)*max( mean(S(2:end)) - S(1),0);
> > end
> >
> > John
>
> Thanks a bunch John! That worked perfectly :)
> I haven't left out the C = zeros(1,N); part, hehe.
> One more small questing... I am trying to figure out the possibility of return below risk free rate. I have this expression:
>
> uriskfree = sum(1+P^(1/T)-1<rd)
> But I get the error ??? Error using ==> mpower
> Matrix must be square.
> Any ideas?
>
> Morten

Probably that should be uriskfree = sum(1+P.^(1/T)-1<rd)
Use that period, Otherwise it is raising the matrix to the power, when you want to raise each element to the power. Regards Matt

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com