04 May 2024

Matlab, R and AI

I was bringing out my modern, technological side! And some of it went better than other bits. My master student had got her data together, and I ideally wanted her to perform multivariant statistics on it. But the thing is, if I want her to do it, I have to be able to do it myself as well! And I'm not a coding genius in the best of days, and I also hadn't kept it up since the last time I had used it in anger. So I really needed to dig out my knowledge from underneath a thick layer of dust.

I thought I'd start with an MDS plot. I had been processing for all data that way for years. I still had the Matlab scripts. I just had to check if it still worked. Matlab evolves, after all. But it did! I got me a plot.

I then decided that an even better idea would be to perform principal component analysis. My student was thinking about the relationship between pollution and microorganism assemblages. Surely it would be interesting to see how these parameters relate to each other graphically. So I started googling how you do that in Matlab. And I asked Monica, my AI assistant. But I couldn't get these scripts to work.

I then noticed a search result that directed me to R. Maybe that was worth the try? It is more user-friendly than Matlab. I found the page that guides you through the process. So I dug out my RStudio. I had made some tentative starts with that software for reasons of probably having to teach it in Welsh. No I needed much more from it! Would I manage to make it work?

Asking AI, again, didn't really help much. But I found a webpage where it was explained in detail how you can make the software do your PCA. And when I followed that recipe, I got what I needed! I was very proud of myself. Two successful plots with two different types of mathematical software in one day; that is not bad. And I hadn't had to ask anyone for help!

If I can do this, my student can too. I directed her to the same website. And when I had the software open anyway, I made a plot with some arbitrary data. I am not going to give away the results of my student here!

I fully intend to make recipes for doing the other calculations and plots I do in my teaching in R as well. I think it is powerful enough to suit all my needs. In order to actually need Matlab, you need to have rather high demands, and I don't. And R is free, so I will keep having access to it. The university isn't keen on paying for licenses, so using free software relieves you of the risk of the university quitting its subscription.

Altogether a bit of a disappointment AI wasn't of much use here. But extra cool I got what I needed in the end. I hope I can keep this momentum going!


A PCA plot of some example data


No comments: