Project: Association Between Two Categorical Variables (AI version)
Project — Chi-Square Test of Independence. Carry out the analysis in Jamovi (or R) and communicate the result. The graded skills are framing the association question, checking the expected-count condition, and interpreting the test in context.
The question
AI coding tools (ChatGPT, Copilot, and the like) swept into software work almost overnight. A natural question: is adoption uniform, or does it depend on who you are?
Among developers, is using AI tools associated with age?
The data
ai_tool_use.csv is a random sample of 600 developers from the Stack Overflow Annual Developer Survey (2024). You’ll use two categorical variables: ai_use (Yes, Not yet, but plan to, No — do you use AI tools in your development work?) and age_group (18-24, 25-34, 35-44, 45+).
Data source & license. Stack Overflow Annual Developer Survey 2024 (via the TidyTuesday project), used under the Open Database License (ODbL) 1.0. This excerpt is a derived subset; it is shared under ODbL — an exception to this book’s CC BY-SA license.
Plan it first
Variables. Confirm both variables are categorical and give the size of the table (rows × columns).
Hypotheses. State \(H_0\) and \(H_A\) for a test of independence in words (AI-tool use and age are independent vs. associated).
Eyeball it. Look at the row percentages (the AI-use mix within each age group). Can you tell for sure whether adoption depends on age, or could the differences be chance? This is the judgment the test makes rigorous.
Procedure & condition. Two categorical variables, “are they associated?” → chi-square test of independence. It needs expected counts that aren’t too small (a common rule: each ≥ 5) — what will you check?
# Condition check: smallest expected count (rule of thumb: each >= 5)cat("Smallest expected count:", round(min(chisq.test(tab)$expected), 1), "\n")
Smallest expected count: 14.7
ggplot(ai, aes(age_group, fill = ai_use)) +geom_bar(position ="fill") +labs(x ="Age group", y ="Proportion", fill ="Uses AI tools?") +theme_minimal(base_size =13)
AI-tool use by age group in a sample of 600 developers. Younger developers adopt AI tools more — but is the difference real or noise?
Your deliverable
Submit a short report containing all of:
Graphic — a labeled stacked (or side-by-side) bar chart showing the AI-use mix by age group.
Numerical result — the contingency table, the χ² statistic, the degrees of freedom, and the p-value.
Conditions — one sentence confirming the expected counts are large enough for the chi-square approximation.
Conclusion in context — 3–4 sentences: is there discernible evidence that AI-tool use is associated with age? Describe the pattern (who adopts most?), note how the test settled what the percentages alone left uncertain, and stress that association is not causation.
One limitation — e.g., this samples developers who chose to take one survey; results may not generalize to all workers, and attitudes change fast.