"매 sample 수가 커질수록 sample mean 의 expected value 로의 수렴". 매 Bernoulli (1713) 의 weak LLN, Kolmogorov (1930) 의 strong LLN. 매 frontend analytics / A/B testing / RUM (Real User Monitoring) 의 통계적 정당성 — 매 sample 적으면 의미 X.
매 핵심
매 두 형태
Weak LLN: \bar{X}_n \xrightarrow{P} \mu — 매 probability convergence.
Strong LLN: \bar{X}_n \xrightarrow{a.s.} \mu — 매 almost sure convergence.
매 둘 다 finite mean μ 가정.
매 frontend 함의
A/B test sample size: 매 N=100 의 noise 지배 — 매 N=10,000+ 필요 (effect size 의 함수).
Core Web Vitals p75: 매 RUM 의 "75th percentile" — 매 N>1,000 sessions 권장 (Google).
Conversion rate stabilization: 매 daily flux → weekly average 의 수렴.
Error rate monitoring: 매 small traffic page 의 false alert.
매 응용
A/B test power analysis (sample size calculator).
Web Vitals percentile reliability.
Recommendation system click-through rate.
Survival analysis of user retention.
💻 패턴
Sample size for A/B test
// Two-proportion z-test, 80% power, α=0.05
functionabTestSampleSize(baselineRate: number,minDetectableEffect: number,):number{constp1=baselineRate;constp2=baselineRate+minDetectableEffect;constpBar=(p1+p2)/2;constz_alpha=1.96;// two-sided 0.05
constz_beta=0.84;// power 0.80
constnumerator=Math.pow(z_alpha*Math.sqrt(2*pBar*(1-pBar))+z_beta*Math.sqrt(p1*(1-p1)+p2*(1-p2)),2);returnMath.ceil(numerator/Math.pow(p2-p1,2));}// Baseline 5% conversion, want to detect +1 percentage point lift
console.log(abTestSampleSize(0.05,0.01));// ~3,000 per arm
Running mean (LLN visualizer)
function*runningMean(samples: Iterable<number>){letn=0;letmean=0;for(constxofsamples){n+=1;mean+=(x-mean)/n;// Welford
yield{n,mean};}}// Coin flip (true mean = 0.5)
constflips=Array.from({length: 10000},()=>(Math.random()<0.5?1 : 0));for(const{n,mean}ofrunningMean(flips)){if(n%1000===0)console.log(`n=${n}, mean=${mean.toFixed(4)}`);}// n=1000 mean ≈ 0.49
// n=10000 mean ≈ 0.50 (LLN convergence)
Web Vitals percentile reliability check
import{onLCP}from'web-vitals';constlcpSamples: number[]=[];onLCP((metric)=>{lcpSamples.push(metric.value);if(lcpSamples.length>=1000){constsorted=[...lcpSamples].sort((a,b)=>a-b);constp75=sorted[Math.floor(sorted.length*0.75)];sendBeacon({p75,n: lcpSamples.length});}});// p75 trustworthy only after N>1,000 (Google CrUX guidance)
Bayesian early-stopping (avoid LLN trap)
// Don't peek at A/B test before sample size reached!
functionshouldStop(arm:{successes: number;trials: number},target: number){if(arm.trials<target)returnfalse;// proceed to analysis
returntrue;}
언제: 매 sample size 결정 / 매 metric 의 reliability 의 statistical 정당화 / 매 small-N false-positive 의 진단.
언제 X: 매 비-i.i.d. data (autocorrelated time series) — 매 LLN naive 적용 X. 매 stationarity 확인.
❌ 안티패턴
Peeking at A/B test: 매 N=50 에서 "winner" 선언 — 매 LLN 미달 + multiple testing.
Rare event LLN: 매 0.01% conversion → 매 N=1000 의 평균 0 가능. 매 Poisson 필요.
Heavy-tail distribution: 매 Cauchy (no finite mean) — 매 LLN 미적용.
Selection bias: 매 sample 이 random 이 X — 매 N 무관 의 biased estimate.
🧪 검증 / 중복
Verified (Kolmogorov, "Foundations of Probability"; Google web.dev — Web Vitals reporting).
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — LLN with frontend analytics applications