LLMVisibility.wikiThe sourced reference on how AI assistants learn about, find and cite brands

Sample size and confidence intervals (with calculator)

From LLMVisibility.wiki

When a brand's visibility in an AI assistant is measured by running the same prompt many times and counting how often the brand appears, the result is a proportion estimated from a finite sample of runs.[4] Statistics treats that kind of measurement as a binomial proportion, and provides confidence intervals that describe how much the observed percentage could differ from the underlying rate.[1] The main choices are the simple normal-approximation (Wald) formula, the Wilson score interval, and exact intervals based on the binomial distribution.[2]

Key facts. A visibility percentage measured over repeated runs is a binomial proportion, and the Wilson score interval is recommended over the simple normal-approximation formula for virtually all combinations of sample size and proportion.[2]

Why sample size matters

Asking an assistant the same question twice does not reliably produce the same answer. In research published by SparkToro, 600 volunteers ran 12 prompts through ChatGPT, Claude and Google's AI Overviews or AI Mode a combined 2,961 times, and nearly every response differed in the list of brands presented, the order of the recommendations and the number of items on the list.[4] The authors calculated that there is a less than 1 in 100 chance that ChatGPT or Google's AI, asked 100 times, would give the same list of brands in any two responses, and roughly 1 in 1,000 for two lists in the same order.[4] This is industry research carried out with a company in the AI tracking sector rather than peer-reviewed work, and the authors disclose that relationship.[4]

That instability is the reason a single run tells you very little, a topic covered further under why LLM answers vary. The same study concluded that counting appearances across dozens or hundreds of runs of the same prompt does carry signal: when Google's AI was asked to recommend digital marketing consultants with e-commerce expertise, the SmartSites agency appeared in 85 out of 95 responses.[4] Measuring that percentage of visibility is described by the authors as probably a reasonable way to know how prominent or invisible a brand is.[4] Any program for measuring LLM visibility therefore depends on how many runs sit behind the percentage.

Visibility as a proportion

A binomial proportion confidence interval is an interval estimate of a success probability when only the number of experiments and the number of successes are known.[1] If each run of a prompt is recorded as a success when the brand appears and a failure when it does not, the observed visibility rate is exactly that kind of estimate.[1]

The binomial model assumes that the experiment is repeated a fixed number of times, each trial has two possible outcomes, the probability of success is the same for each trial, and the trials are statistically independent.[1] Those assumptions deserve attention in practice: they imply that every run uses the same prompt, the same tool and the same conditions, which is why the design of a prompt set and a clear definition of what counts as an appearance matter before any arithmetic is done.[1] Whether a success means a passing mention, a citation or an explicit recommendation is a separate decision, discussed under mentions, citations and recommendations.[4]

The normal-approximation interval

The most frequently used confidence expression for a proportion is p̂ ± z₁₋α/₂·√(p̂(1−p̂)/n), where p̂ is the observed proportion and n the number of trials.[2] This formula approximates the distribution of error about a binomially distributed observation with a normal distribution, and it is sometimes called the Wald interval or Wald method, after Abraham Wald, although it was first described by Laplace in 1812.[1] For a 95% confidence level the multiplier is the quantile of the standard normal distribution corresponding to the target error rate.[1]

The approximation depends on the de Moivre–Laplace theorem and becomes unreliable as the sample size becomes small or as the success probability grows close to 0 or 1.[1] Two failure modes appear immediately: as the observed proportion approaches 1 or 0 the interval narrows to zero width, falsely implying certainty, and for low proportions the interval boundaries can overshoot below zero.[1] NIST states plainly that a confidence limit approach producing a lower limit which is an impossible value for the parameter is an inferior approach.[2]

The Wilson interval

The Wilson method was introduced by Wilson in 1927 and is recommended by Brown, Cai and DasGupta (2001) and by Agresti and Coull (1998).[2] It is derived by inverting the large-sample hypothesis test for a proportion: the limits are the two values of the hypothesized proportion that make the test statistic equal to the positive and negative critical values.[2] The resulting upper and lower limits can be written in closed form, so no iteration is required, and they include a z²/(2n) adjustment to the center and a z²/(4n²) term inside the square root.[2]

Its advantages are practical. The worth of the procedure does not strongly depend on the value of n or p, and Agresti and Coull recommended it for virtually all combinations of n and p.[2] The lower limit cannot be negative, which is not true of the simple formula.[2] The interval is asymmetric and does not suffer from the overshoot and zero-width problems of the normal interval, can be safely employed with small samples and skewed observations, and its observed coverage probability is consistently closer to the nominal value.[1] Intuitively, its center is a weighted average of the observed proportion and one half, with the observed value receiving greater weight as the sample size increases; for a roughly 95% interval this corresponds to the "plus four rule" of adding two to both the success and failure counts.[1] A one-sided interval is obtained simply by replacing each z₍α/₂₎ by z₍α₎ in the expression for the limit required.[2]

Calculator

The calculator runs in your browser and sends nothing anywhere. It treats each run of a prompt as one trial in which the brand either appears or does not, and uses the interval formulas published in the NIST/SEMATECH e-Handbook of Statistical Methods.[2]

1. Interval for an observed visibility rate

2. Runs needed for a target margin of error

Part 2 rearranges the normal-approximation formula, so it is a rough planning figure; an expected rate of 50% gives the largest, most cautious number of runs.

Exact intervals for small samples

If the number of successes is very small, or the sample size is very small, symmetric limits approximated using the normal distribution may not be accurate enough for some applications, and an exact method based on the binomial distribution can be used instead.[2] The upper limit is found by solving the cumulative binomial equation that sets the probability of observing at most the recorded count equal to α/2, and the lower limit by solving the matching equation for one fewer success set equal to 1 − α/2.[2] Both are solved numerically with software that finds the roots of a function.[2]

NIST gives an example in a manufacturing setting: twenty units are sampled and four are found defective, giving an estimate of 0.20, and the 90% interval works out to (0.071, 0.400).[2] The interval is not symmetric about the observed proportion.[2] An extension of the Clopper–Pearson interval to complex survey data is known as the Korn–Graubard confidence interval.[1]

Choosing a sample size

Sample size for a proportion is usually derived from the normal approximation even though the sampling distribution actually follows a binomial distribution.[3] The calculation starts from the change you want to be able to detect, written as δ, the absolute difference between the baseline proportion p₀ and the alternative p₁, together with a significance level α and a power 1 − β.[3] The minimum two-sided sample size is N ≥ ((z₁₋α/₂·√(p₀(1−p₀)) + z₁₋β·√(p₁(1−p₁)))/δ)², with z₁₋α replacing z₁₋α/₂ for a one-sided test.[3]

NIST works through an example in which a manager wants to detect any change above 0.10 in a process running at about 10% defective, using a one-sided test at a 5% significance level and accepting a 10% risk of missing such a change.[3] With z₀.₉₅ = 1.645, z₀.₉₀ = 1.282, δ = 0.10 and p₀ = 0.10, the minimum sample size is approximately 102, and with the continuity correction N = N′ + 1/δ recommended by Fleiss, Levin and Paik it becomes 112.[3] Translated into visibility work, the same structure applies: the smaller the change in appearance rate you want to detect, the more runs are needed, and detecting small shifts around a low baseline requires many more runs than confirming that a brand is present in most responses.[3]

Limits

A confidence interval only describes sampling uncertainty under the assumed model. A 95% confidence interval for a proportion will contain the true proportion 95% of the times that the procedure for constructing the interval is employed, which is a statement about the long-run behavior of the method rather than about any single measured number.[1] All the standard formulas also rely on the assumption of a binomial distribution, including independence between trials and a constant success probability.[1]

Those assumptions are the weak point in practice. The SparkToro study notes that prompt variability was not even addressed in the analysis of list randomness, so intervals computed from one fixed prompt say nothing about how the same brand would fare under differently worded questions.[4] The same study attributes part of the variation to how many entities frequently appear in documents in the AI corpora around a topic, and to the tokens that follow other tokens in the corpus and in extracted results when retrieval-augmented generation is used.[4] An interval therefore quantifies how precisely a particular measurement procedure was executed; it does not establish that the measured quantity is stable over time or representative of real user questions.[4]

Common questions

How many runs are needed to measure AI visibility?

There is no single published number for AI assistants, but the sample size formula for proportions makes the trade-off explicit: the required N grows with the square of the inverse of δ, the change in proportion you want to detect.[3] In the NIST worked example, detecting a shift of 0.10 around a baseline of 0.10 with 5% significance and 90% power needs about 102 observations, or 112 with the continuity correction.[3] For reference, the SparkToro study ran each of its 12 prompts 60 to 100 times per tool.[4]

What is a confidence interval for a proportion?

It is an interval estimate of a success probability when only the number of experiments and the number of successes are known.[1] Applied to visibility, the successes are the runs in which a brand appeared and the experiments are the total runs of that prompt.[1] A 95% interval will contain the true proportion 95% of the times that the construction procedure is employed.[1]

Why is the Wilson interval preferred over the simple formula?

The simple normal-approximation formula can produce a lower limit below zero, which NIST describes as an inferior approach because the value is impossible for the parameter being estimated.[2] The Wilson interval cannot return a negative lower limit, is asymmetric, avoids the zero-width problem near 0 and 1, and can be safely employed with small samples and skewed observations.[2][1] Agresti and Coull recommended it for virtually all combinations of sample size and proportion.[2]

What does a wide interval mean?

Interval width is driven by the sample size n, which appears in the denominator of the variance term in every standard formula, so few runs produce wide limits.[2] The NIST binomial example shows how wide this can be: four defects in twenty units gives a point estimate of 0.20 but a 90% exact interval of (0.071, 0.400).[2] A wide interval means the observed percentage is compatible with a broad range of underlying rates, so comparisons between brands or time periods based on that number are weakly supported.[1]

Can an exact interval be computed by hand?

Not easily; the exact limits are defined by cumulative binomial equations that are solved for the upper and lower proportions using software that finds the roots of a function.[2] The Wilson limits, by contrast, are given by closed-form expressions that can be evaluated directly once the observed proportion, the sample size and the normal quantile are known.[2][1]

See also

References

  1. ^ a b c d e f g h i j k l m n o p q r s t u v w "Binomial proportion confidence interval". Wikipedia. Retrieved November 2026.
  2. ^ a b c d e f g h i j k l m n o p q r s t u v w x y "Confidence intervals (for proportions)". NIST/SEMATECH e-Handbook of Statistical Methods. Retrieved November 2026.
  3. ^ a b c d e f g h i "Sample sizes required (for testing proportions)". NIST/SEMATECH e-Handbook of Statistical Methods. Retrieved November 2026.
  4. ^ a b c d e f g h i j k l "NEW Research: AIs are highly inconsistent when recommending brands or products". SparkToro. Retrieved November 2026.