Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Number of games to test. Here is your table !

Author: Leen Ammeraal

Date: 07:59:11 03/09/02

Go up one level in this thread


On March 09, 2002 at 02:46:42, TEERAPONG TOVIRAT wrote:

>
>
>I see the correlation between  score ratio and the number of games
>at specific %  of confident interval.
>Would u please calculate this correlation for me?
>
>score          the number of games at 90% confident interval
>60%              ?
>70%              ?
>80%              ?
>90%              ?
>
>Thanks in advance,
>Teerapong

Here is the table, as you requested. I just wrote a
program for it, which I also list below, so you
can easily extend it to produce more tables.
I hope I did not make any errors. If anyone
thinks I did, please let me know.
Leen Ammeraal

================================
This table computes how many games are required
for a given score to tell with a given confidence
that the winning side is really stronger.

For example, with the score 60-40, that is,
a score of 60% and 100 games, the confidence
of the winner really being stronger is between
95 and 99%.

         Confidence
 Score   90%  95%  99%
  55%    170  281  550
  60%     46   71  141
  65%     21   30   64
  70%     14   18   35
  75%      9   13   22
  80%      7   11   17
  85%      7    8   14
  90%      4    5   11
  95%      4    5    7
 100%      4    5    7
======================================
The program to produce the above table:

// ngames.cpp: How many games are required to
//        prove stronger play?
//        Programmed by Leen Ammeraal
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

double binom(int n, int k)
{  double x = 1;
   for (int j=0; j<k; ++j)
      x *= double(n - j) / (j + 1);
   return x;
}

const nLevel = 3;
double confLevel[nLevel] = {0.90, 0.95, 0.99};

int main()
{  cout << "This table computes how many games are required\n"
           "for a given score to tell with a given confidence\n"
           "that the winning side is really stronger.\n\n";
   cout << "For example, with the score 60-40, that is,\n"
           "a score of 60% and 100 games, the confidence\n"
           "of the winner really being stronger is between\n"
           "95 and 99%.\n\n";

   cout << "         Confidence\n";
   cout << " Score ";
   for (int i=0; i<nLevel; ++i)
      cout << setw(4) << int(confLevel[i] * 100 + 0.5) << "%";
   cout << endl;

   for (int scorePerc = 55; scorePerc <= 100; scorePerc += 5)
   {
      cout << setw(4) << scorePerc << "%   ";
      int h = 0;
      for (int n=1; n<2000; ++n) // Number of games
      {  int nA = scorePerc * n / 100.0 + 0.5,
             nB = n - nA;

         double s = 0, t = 0;

         double pown = pow(0.5, n);
         for (int i=0; i<=nB; ++i)
         {  t = binom(n, i) * pown; // pow(p, i) * pow(1-p, n-i);
             // t is the probability of B obtaining i points.
            s += t;
         }
         // s is the probability of B obtaining nB points or less.
         // This is equal to the probability of A obtaining nA points
         // or more.
         double conf = 1 - s;
         if (conf >= confLevel[h])
         {  cout << setw(4) << n << " ";
            if (++h >= nLevel)
            {  cout << endl;
               break;
            }
         }
      }
   }
   return 0;
}




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.