1
$\begingroup$

Hi I just want to flatten a function, I tied it with Joined->True, but it did not work, hope somebody of you can help me.

This is my code:

Remove["Global`*"] m = 30; (*number of banks*) n = 5;(*number of defaults*) AssetV = 100;(*asset value at T*) DebtV = 80;(*debt value at T*) μ = 0.2;(*annual drift*) σ = 0.3;(*annual volatility*) T = 5;(*years*) ρ = 0.8; 

Since I want to use a BinomialDistribution I calculated the individual probabilities through:

P = (CDF[NormalDistribution[], -(Log[ AssetV/DebtV] + (μ - 0.5*σ^2)*T)/(σ*Sqrt[ T])]) 

In the following I generated a table where I wanted to see the probabilities where k=n1, varies from 0 to 30 since n=30, and this is given by:

data1 = Table[ Probability[x >= n1, x \[Distributed] BinomialDistribution[30, P]], {n1, 0, 30, 1}] 

In order to plot the probabilities I entered:

Plot[Probability[x >= n1, x \[Distributed] BinomialDistribution[30, P]], {n1, 0, 30}, PlotRange -> All, AxesLabel -> {"# of Defaults", "PD"}, Filling -> Axis] 

and now I just want to flatten this function. I tried it with Joined-True, which did not work out.

I want also to show the density by:

DiscretePlot[PDF[BinomialDistribution[30, P], n1], {n1, 0, 30}, PlotRange -> All, AxesLabel -> {"# of Defaults", "PD"}, Joined -> True] 

However, is there the possibility to implement data1=Table[...] into the two functions, would it be then possible to generate the plot by the ListLinePlot function?

thank you for your help.

$\endgroup$
4
  • $\begingroup$ is your question on how to combine plots? $\endgroup$ Commented Jul 23, 2013 at 8:26
  • $\begingroup$ @Stefan no my question is, how to flatten the plot given by Plot[Probability[...]] and if it is possible to implement data1 into Plot[Probability[...]]. $\endgroup$ Commented Jul 23, 2013 at 8:28
  • $\begingroup$ @Nasser I want the results from Plot[Probability[...]] to be a combined/connected line $\endgroup$ Commented Jul 23, 2013 at 8:28
  • $\begingroup$ Perhaps Exclusions -> None is the option you're looking for? $\endgroup$ Commented Jul 23, 2013 at 8:39

1 Answer 1

3
$\begingroup$

You mean like this? (no place to put in comment, will remove if not)

 data = Table[{n1, Probability[x >= n1, x \[Distributed] BinomialDistribution[30, P]]}, {n1, 0, 20}]; ListPlot[data, Joined -> True, Mesh -> True, PlotRange -> All, Frame -> True, PlotStyle -> PointSize[.02], GridLines -> Automatic, GridLinesStyle -> LightGray] 

enter image description here

side-by-side

enter image description here

$\endgroup$
1
  • $\begingroup$ @ Nasser thank you, that was exactly what I was looking for $\endgroup$ Commented Jul 23, 2013 at 8:46

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.