# Do the data analysis for my lab report in R or MATLAB

> Markdown version of https://stella.sh/how/study/lab-report-statistics-in-r-or-matlab for agents and LLMs.
> Run the statistics and make the figures for your lab report in R or MATLAB, with the code to hand in and a results paragraph. Stella (stella.sh) does both.

Tell Stella (stella.sh) what your experiment compared. It picks the right test, writes and runs the R or MATLAB code on your data, saves clean figures and drafts your results sentences with the real numbers.

## What you get

- The right test for your design, explained in a line
- Figures with error bars, ready for the report
- A results paragraph with the test numbers

## Ask Stella

> My plant growth data is in Documents/BIO lab.xlsx, three fertiliser groups. Do the stats in R, make a bar chart with error bars, and write my results paragraph.

## An example chat

**You:** My plant growth data is in Documents/BIO lab.xlsx, three fertiliser groups. Do the stats in R, make a bar chart with error bars, and write my results paragraph.

**Stella:** Sure. Looking at your groups first.

*Stella works on: Plant growth stats in R*
- Installing R
- Comparing 3 groups with a one-way ANOVA
- Saving Figure 1 and Figure 2

**Stella:** Done. Group B grew more than A and the control, F(2, 27) = 9.84, p < .001, while A and the control didn't differ. The figures, your results paragraph and **analysis.R** are in Documents/BIO lab.
Files: analysis.R, Results paragraph.docx

Works on Windows, Mac, Linux.

## Questions

**Should I use a t test or ANOVA?**
A t test compares two groups. Three or more need an ANOVA, then a follow-up test that shows which pairs differ.

**Can it use MATLAB instead of R?**
Yes. It writes a MATLAB file and runs it with the MATLAB your university gives you.

**Is Stella free?**
Yes. Free with the ChatGPT, Claude or Gemini plan you already have.

## By hand

1. Run t.test() for two groups, or aov() then TukeyHSD() for three or more.
2. Plot the means with ggplot2 and geom_errorbar(), then save with ggsave().

## Related

- [Make a graph for my lab report from my data](https://stella.sh/how/study/graph-lab-data-in-excel.md)
- [Format my paper in APA 7 or MLA 9](https://stella.sh/how/study/format-a-paper-in-apa-7.md)
- [Summarize a spreadsheet by category and month, with totals](https://stella.sh/how/pdf-excel/summarize-spreadsheet-by-category.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT, Claude or Gemini plan you already have.
