Using AI for data analysis

By Dr. Rafiq Muhammad, MD, PhD · Updated June 2026

AI can genuinely accelerate analysis — writing your code, drafting a first set of qualitative codes, explaining what an output means. What it can’t do is be responsible for the result. The safe pattern is the same everywhere: AI drafts, you run and verify, you own the finding.

Quantitative: code, don’t compute

The single most important habit: have AI write the code, not do the maths. A model will happily compute a t-test in chat and quietly get it wrong; the same model writes correct R or Python that you run on your real data in real software. Ask it which test fits, to write the script, and to explain the output — then sanity-check the numbers yourself.

The trap: “Here’s my data, calculate the mean and p-value” in a chat window. It can invent plausible numbers. Instead: “Write R that loads this CSV and runs the test” → run it → check it. Code is verifiable; chat arithmetic isn’t.

Qualitative: a first pass, not the analysis

AI can suggest codes, group similar segments, and draft a codebook — a real time-saver on a large dataset. But the analyst reviews and owns every code. Trustworthiness rests on a transparent, reflexive process, so document where AI assisted and never let its labels substitute for your interpretation. A theme the model named that you can’t defend from the data isn’t your finding.

The three rules that keep it rigorous

  1. Confidentiality — never paste identifiable or unpublished participant data into a public model. Anonymise first, or use an approved private environment.
  2. Verify — every number against the real output of your software; every AI claim against the data.
  3. Disclose — record where AI assisted, as your journal or institution requires.

Where it shines

Debugging a cryptic error, translating SPSS clicks into reproducible code, explaining what an interaction term means, drafting a data-cleaning script — these are real, safe wins that save hours without touching your judgement. The line holds: AI helps you do the analysis; it doesn’t make the call.

Planning an AI-assisted qualitative analysis? The free Qualitative Coding Planner gives you a step-by-step plan, a codebook template, and a rigor checklist — so AI speeds up a process that’s still demonstrably yours.

Get the free AI-in-Research toolkit

Analysis prompt recipes, a verification checklist, and an AI-use disclosure template from The AI-Powered Scholar. We’ll email you the download link.

One email with your download, then occasional research tips. One-click unsubscribe, anytime. We never sell your data.

Get The AI-Powered Scholar

Frequently asked questions

Can I use AI to analyse my data?

Yes — as an assistant. It helps write code, draft codes, and explain output; you run, verify, and own every result.

Can ChatGPT do statistics correctly?

It writes correct analysis code far more reliably than it computes in chat. Have it write code you run on real data, then sanity-check.

Is AI OK for qualitative coding?

For a first pass, with the analyst reviewing and owning every code and documenting where AI assisted. Never as a substitute for interpretation.

What are the risks?

Confidentiality (don’t paste participant data), fabrication (confident wrong numbers), and over-trust. Anonymise, verify, disclose.

How to code qualitative data → Which statistical test? →