← Biology

genetics χ² test

Hardy-Weinberg equilibrium (law) calculation: Expected frequency/χ²

Enter observed AA/Aa/aa counts to compute allele frequencies (p, q), expected frequencies (p², 2pq, q²), χ², and p-value. Review observed-vs-expected gaps in tables and charts.

All calculations are done within the browser and no data is sent.

Other languages ja | en | zh-CN | es | pt-BR | id | fr | hi-IN | ar

Example (preset)

Once you select an example, the input will be filled in and the results will appear immediately.

Description

Inputs

input mode

Observed value (AA/Aa/aa)

Degrees of freedom (df)
Advanced (display/graph)

Paste / CSV (optional)

It also supports pasting TSV/CSV (e.g.AA Aa aa). Once pasted, it will be reflected in the input field.

Results

N (total number)
p(A)
q(a)
MAF (reference)
χ²
df
p-value
Judgment (for display)
Hobs (observation hetero)
Hexp (expected hetero)
F (reference)

*This is a statistical calculation tool and is not intended for medical judgment.

graph

Observation vs Expectation
residual

*Residuals are displayed only in observed value mode (Advanced → "Show residuals").

Table (O/E/Contribution)

genotype observed(O) expected(E) O−E (O−E)²/E residual

How to use/calculate

  1. Enter AA/Aa/aa (you can also use the example).
  2. Select degrees of freedom (default is df=1) and significance level (for display).
  3. p,q, expected frequency, χ², p-value are displayed.

allele frequency:p = (2·AA + Aa)/(2N), q = 1 − p

Expected frequency (HWE):E(AA)=p²N, E(Aa)=2pqN, E(aa)=q²N

χ²: Σ (O−E)²/E (sum of AA, Aa, aa)

If the expected frequencies are small, the χ² test may give a poor approximation. Please check the warning display before use.

Frequently asked questions (FAQ)

What is Hardy-Weinberg equilibrium (HWE)?

With two alleles (A and a), Hardy-Weinberg predicts genotype frequencies from p and q. The expected frequencies are p² (AA), 2pq (Aa), and q² (aa) under standard assumptions.

How do you calculate p and q?

From the observed AA/Aa/aa, calculate p = (2*AA + Aa)/(2N), q = 1 - p.

Why is the degree of freedom (df) of the χ² test often equal to 1?

Because p is estimated from observed values, df=1 is usually used for AA/Aa/aa counts. You can still choose df=2 as an advanced option.

A warning appeared if the expected frequency was small. What should I do?

If expected counts are small, χ² can be a rough approximation. Check sample size and category balance, and consider an exact test (not included in this tool).

Small p-value = not necessarily equilibrium, right?

The p-value measures how large the deviation is under the model. Do not draw conclusions from this number alone. Interpretation depends on sample size, assumptions, and data quality.

What is the difference from the χ² test for Mendelian separation ratio?

Both methods compare observed and expected counts. HWE is specific because expected frequencies come from p and q estimated from the same sample. Choose the test that matches your study design.

Are calculations from this tool sent externally?

Not sent. Calculations are completed within the browser.

How to use this calculator effectively

This guide helps you use Hardy-Weinberg equilibrium (law) calculation: Expected frequency/χ² in a repeatable way: define a baseline, change one variable at a time, and interpret outputs with explicit assumptions before you share or act on results.

How it works

The page applies deterministic logic to your inputs and shows rounded output for readability. Treat it as a comparison workflow: run one baseline case, adjust a single parameter, and measure both absolute and percentage deltas. If a result seems off, verify units, time basis, and sign conventions before drawing conclusions. This approach keeps your analysis reproducible across teammates and sessions.

When to use

Use this page when you need a fast estimate, a classroom check, or a practical what-if comparison. It works best for planning and prioritization steps where you need direction and magnitude quickly before investing in deeper modeling, manual spreadsheets, or formal external review.

Common mistakes to avoid

Interpretation and worked example

Run a baseline scenario and keep that result visible. Next, modify one assumption to reflect your realistic alternative and compare direction plus size of change. If the direction matches your domain expectation and the size is plausible, your setup is usually coherent. If not, check hidden defaults, boundary conditions, and interpretation notes before deciding which scenario to adopt.

See also

FAQ

What should I do first on this page?

Start with the minimum required inputs or the first action shown near the primary button. Keep optional settings at defaults for a baseline run, then change one setting at a time so you can explain what caused each output change.

Why does this page differ from another tool?

Different pages often use different defaults, units, rounding rules, or assumptions. Align those settings before comparing outputs. If differences remain, compare each intermediate step rather than only the final number.

How reliable are the displayed values?

Values are computed in the browser and rounded for display. They are good for planning and educational checks, but for regulated or high-stakes decisions you should validate assumptions with official guidance or professional review.

Can I share and reproduce this result?

Yes. Use the share or URL controls when available. Keep a baseline case and one changed case so others can reproduce your reasoning and verify that the direction and scale of change are consistent.

Is my input uploaded somewhere?

Core calculations run locally in your browser. Some pages encode parameters in a shareable URL, but no automatic upload is performed unless you explicitly share that link.