To specialists in the theory of probability. I have a portfolio of 10 stocks. What is the probability that 2 of my 10 companies will go bankrupt next year? - page 5

 
Nikolai Semko:

Not strong on R.

Explain the following points:

k<- 0:n is a vector of quantiles. Can you give a deciphering of this concept?

the second value is the number of bankrupt companies (it should be 50), then why do you add vector k to 50?

The third value is the number of non-bankrupt companies (should be 4950). Do you have 4950-n+k ?

The fourth value is number of shares = 10. Everything seems to be OK here.

R online

k is a vector of possible values for the number of bankruptcies in the second year: 0, 1, ... , 9, 10.

n-k is a vector of 10, 9, ..., 1, 0 (feature R)

Total number of balls 5010 = 5000 + 10

the total number of bankruptcies is not 50, but 50+k, not 4950-n+k (here k is no longer a vector, but an unknown number from 0 to 10)

You assume that in the second year we have 5000 firms, of which 50 will also go bankrupt. This is not correct. All we know is that we have the same probability of bankruptcy as last year - there may well be 49 or 52 bankruptcies per 5000 (the probability of having exactly 50 per 5000 two years in a row is very small).

compile R online
  • rextester.com
compile R online
 
Aleksey Nikolayev:

R online

k is a vector of possible values for the number of bankruptcies in the second year: 0, 1, ... , 9, 10.

n-k is a vector of 10, 9, ..., 1, 0 (feature R)

Total number of balls 5010 = 5000 + 10

the total number of bankruptcies is not 50, but 50+k, not 4950-n+k (here k is no longer a vector, but an unknown number from 0 to 10)

You assume that in the second year we have 5000 firms, of which 50 will also go bankrupt. This is not correct. All we know is that we have the same probability of bankruptcy as last year - there may well be 49 or 52 bankruptcies per 5000 (the probability of two years in a row being exactly 50 per 5000 is very small).

Once again, I repeat. The conditions of the problem are far from practical. You don't need to add terms to the problem as you go along. I, too, had the first idea to ask the author of the topic a lot of leading questions, but I realized that there is no need to complicate things. The question is quite specific, though far from practice.

Thanks for the link. I have understood R. It is much simpler. The results are the same as mine:

p0 <- dhyper(0,50, 4950,10)
p1 <- dhyper(1,50, 4950,10)
p2 <- dhyper(2,50, 4950,10)
p0; p1; p2

The result:

p0 = 0.9042998
p1 = 0.09150979
p2 = 0.004082944

My calculations above:

P1 = (50!*4950!*10!*4990!)/(49!*9!*4941!*5000!) = (50*4950*4949*4948*4947*4946*4945*4944*4943*4942*10)/(5000*4999*4998*4997*4996*4995*4994*4993*4992*4991) = 0.09150979127569519373319974384113

The probability of bankruptcy is exactly 2 out of 10 companies:

P2 = (50!*4950!*10!*4990!)/(2*48!*8!*4942!*5000!) = (49*50*4950*4949*4948*4947*4946*4945*4944*4943*9*10)/(2*5000*4999*4998*4997*4996*4995*4994*4993*4992*4991) =0.00408294394502039462124049848583

HZ immediately noticed that you have something wrong, because in this case the probability cannot be equal to 1, it must be less than 1.

And modelling this situation has confirmed those numbers.

#define  total 10000000
void OnStart() {
   int sum[total];
   MathSrand(GetTickCount());
   for (int j=0; j<total; j++) {
      sum[j]=0;
      int b[10];
      for (int i=0; i<10; i++) {
         int r=35000;
         while (r>=30000) r=rand();
         b[i]=r%5000;
         if (b[i]<50) sum[j]++;
      }
      ArraySort(b);
      for (int i=0; i<9; i++) if (b[i]==b[i+1]) {
            j--;
            break;
         }
   }
   int s0=0,s1=0,s2=0;
   for (int j=0; j<total; j++) {
      if (sum[j]==0) s0++;
      if (sum[j]==1) s1++;
      if (sum[j]==2) s2++;
   }
   Print("Вероятность без банкротства - "+string(double(s0)/total)+"; Вероятность 1 банкротства - "+string(double(s1)/total)+";  Вероятность 2 банкротств -   "+string(double(s2)/total));
}
2020.01.06 10:52:56.474 TestDouble (.BrentCrud,H1)      Вероятность без банкротства - 0.9043109; Вероятность 1 банкротства - 0.0914961;  Вероятность 2 банкротств -   0.0040885
2020.01.06 10:53:10.916 TestDouble (.BrentCrud,H1)      Вероятность без банкротства - 0.9042554; Вероятность 1 банкротства - 0.0915793;  Вероятность 2 банкротств -   0.0040546
2020.01.06 10:53:16.937 TestDouble (.BrentCrud,H1)      Вероятность без банкротства - 0.9043432; Вероятность 1 банкротства - 0.0914806;  Вероятность 2 банкротств -   0.0040718
2020.01.06 10:53:22.539 TestDouble (.BrentCrud,H1)      Вероятность без банкротства - 0.9042999; Вероятность 1 банкротства - 0.0915289;  Вероятность 2 банкротств -   0.0040653

 
Aleksey Nikolayev:

This is precisely the case where one can take advantage of the proximity of the hyper-hiometric distribution to the binomial distribution. The resulting imprecision is much smaller than the imprecision associated with the approximation of the model (inequality of bankruptcy probabilities of different firms, the relationship between bankruptcies, etc.).

A binomial distribution requires the probability to be independent. In this case, the probability is dependent.

 
Nikolai Semko:

A binomial distribution requires the probability to be independent. In this case, the probability is dependent.

There is no such thing as "independent probability" in a theorist, there are independent events.

The model you used does not fit (or rather, fits only approximately). If you don't understand it, that's your problem.
 
Aleksey Nikolayev:

There is no such thing as "independent probability" in a theorist, there are independent events.

I agree. It sounds better that way.
Yes, I'm weak in terminology. And I have an amateurish knowledge of Probability Theory, to be honest.

 
Nikolai Semko:

I agree. It sounds better that way.
Yes, I am weak in terminology. And in general I have amateurish knowledge in Probability Theory, to be honest.

let's not talk about "your" amateurish ones, because I'm tired of sprinkling "our" head with ashes

and what cosmic knowledge Alexey has in almost everything... one can only shake hands in amazement.

 
Maxim Dmitrievsky:

Let's not talk about "your" amateurish ones, because I'm tired of sprinkling "our" head with ashes

and what cosmic knowledge Alexey has in almost everything... I have only to raise my hands in amazement...

:)
Yeah, no, I'm serious. More of an intuitive and on-the-go kind of thing.

 
Maxim Dmitrievsky:

Let's not talk about "your" amateurish ones, because I'm tired of sprinkling "our" head with ashes

and what cosmic knowledge Alexey has in almost everything... I can only wonder with my hands raised in wonder.

As Matroskin said in a similar case: "I can also embroider... And on a typewriter...") )

 
Nikolai Semko:

:)
Yeah, no, I'm serious. I'm more of an intuitive and on the fly kind of guy.

MIT has a good theorist course on youtube.

 
igrok333:
Last year 50 out of 5,000 companies went bankrupt in the US market. So the probability of a company going bankrupt is 1/100.

I have a portfolio of 10 stocks.

What is the probability that 1 out of my 10 companies will go bankrupt in a year? It's easy to calculate.
The probability of one company going bankrupt is 1/100. And we take 10 companies, so we increase the odds of the event occurring by a factor of 10.
So we get the probability: 1/100 * 10 = 1/10.

What is the probability that 2 of my 10 companies go bankrupt in one year? How do we calculate this?

it was just a complete quote from the topic. It underlines what is a condition and notes what is relevant to the subject area

Where do you see conditional probabilities here? There aren't any. There are statistics from last year.

there's not even a total number of companies at the time of investment, it's unknown and by the way unimportant.

PS/ not even surprised that tractors plough the ocean and GAs beat random :-)