Qui-Quadrado (Goodness-of-Fit)
Calcula χ² = Σ (O−E)²/E para listas O e E de mesma dimensão.
χ² + gl
—
Chi-square goodness-of-fit test
Pearson's chi-square goodness-of-fit test, from 1900, asks whether an observed categorical distribution lines up with a theoretical one: χ² = Σ (O − E)² / E, where O is the observed and E the expected frequency in each category. The degrees of freedom come from df = k − 1 − p, with k categories and p parameters estimated from the data. You reject H₀ (that the data fits the model) once χ² climbs past the critical value χ²_crit in the chi-square table. Picture a die rolled 600 times: if it is fair, E = 100 per face, and a large χ² is a sign the die is loaded. As a working rule, keep each E ≥ 5 so the approximation holds up.
Applications
It turns up wherever categorical data needs checking: genetics, where you test Mendelian segregation ratios such as 9:3:3:1; market research and survey responses; A/B tests comparing proportions across several variants; validating pseudo-random number generators; and confirming that a sample reflects the distribution recorded in a population census.
FAQ
Goodness-of-fit or test of independence? Goodness-of-fit pits a single variable against a theoretical distribution. The test of independence compares two variables using a contingency table.
What if some expected counts are below 5? The chi-square approximation starts to break down. Merge the small categories together, or switch to Fisher's exact test or a Monte Carlo p-value.
How are degrees of freedom counted? Begin at k − 1, since one constraint already fixes the totals to match. Then drop one more df for every parameter you estimate from the sample, such as a Poisson mean.
Related Tools
Rent Adjustment Calculator
Compute annual rent adjustment by IGP-M or IPCA accumulated in the last 12 months (manually configurable).
Pregnancy Calculator
Compute estimated due date (EDD), gestational age and trimester from the last menstrual period (LMP).
Fertile Period Calculator
Compute fertile window and ovulation day from the first day of the last cycle and the average cycle length.