monteCarloTrialsForStandardErrorBound
Smallest integer n so monteCarloStandardError(pHat, n) <= targetSe (ceil of p(1-p)/targetSe²).
monteCarloTrialsForStandardErrorBound(pHat: number, targetSe: number): number
Import
const poker = require('poker-calculations');
ESM (Node):
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const poker = require('poker-calculations');
When to use
Pick a Monte Carlo trial count before running equity sims so standard error stays below a target. Requires interior pHat strictly between 0 and 1 (use a pilot estimate or 0.5 as conservative planning value).
How to use
const pilotEquity = 0.38;
const targetSe = 0.003; // 0.3 percentage points
const n = poker.monteCarloTrialsForStandardErrorBound(pilotEquity, targetSe);
console.log('run at least', n, 'trials');
const equity = poker.simulateHandOutcome(
['Ah', 'Kh'],
['2h', '7d', '9c'],
n,
42
);
console.log('equity:', equity);