Måns Thulin's Avatar

Måns Thulin

@mansthulin.bsky.social

I work in statistics and AI. Consultant, teacher, researcher. #Rstats user. Book: https://modernstatisticswithr.com Homepage: https://mansthulin.se Co-founder of https://aireview.se

170 Followers  |  89 Following  |  101 Posts  |  Joined: 15.11.2024  |  1.7177

Latest posts by mansthulin.bsky.social on Bluesky

Post image

Wow ... I'd never come across this use of with(), which allows combining the pipe and computing a correlation coefficient. Thanks to @mansthulin.bsky.social for explaining this in his fantastic book www.modernstatisticswithr.com!
#Rstats #code #neverknew

22.07.2025 12:22 — 👍 6    🔁 2    💬 0    📌 0
Modern Statistics with R Modern Statistics with R

I'm extremely biased, but I think Modern Statistics with R is a great choice 😁
www.modernstatisticswithr.com

04.07.2025 20:37 — 👍 7    🔁 2    💬 1    📌 0
Bootstrap inference made easy: p-values and confidence intervals in one line of code
YouTube video by R Consortium Bootstrap inference made easy: p-values and confidence intervals in one line of code

I really enjoyed attending and speaking at R/Medicine this year! I learned a lot. Huge thanks to the organisers! My talk "Bootstrap inference made easy" is now available online: www.youtube.com/watch?v=EeAt...

#Rstats #Statsky

02.07.2025 06:47 — 👍 8    🔁 3    💬 0    📌 0

Very nice! I really like what this package has turned into. Now, if only it worked seamlessly with pipes... 😉

04.06.2025 09:09 — 👍 5    🔁 0    💬 0    📌 0

I prefer the term "overfitted regression models". Gives a different and perhaps more accurent ring to things:
- "Will overfitted regression models take our jobs?"
- "92 % of students use overfitted regression models in their studies."
- "Overfitted regression models in military decision making."

04.06.2025 09:07 — 👍 0    🔁 0    💬 0    📌 0

For the #rstats nerds: 405 is "Method not allowed". That is why R 4.0.5 was nicknamed "Shake and Throw", due to this piece of dubious pedagogy:

www.gocomics.com/peanuts/1978...

03.06.2025 09:36 — 👍 11    🔁 4    💬 0    📌 0

#rstats base ?`$`

29.05.2025 10:58 — 👍 17    🔁 3    💬 3    📌 1
Preface | Computational Statistics with R Lecture notes providing an introduction to computational statistics using the R programming language.

@tiddlydump.bsky.social perhaps I have shared this before. It's an unfinished project but has some #rstats gems imho
cswr.nrhstat.org

27.05.2025 13:57 — 👍 7    🔁 2    💬 1    📌 0

Following this thread with great interest. I still haven't found an LLM that's even remotely useful for anything beyond the most trivial tasks (also when used with tools like {gander}). Too many hallucinated functions and ignored prompt instructions still.

27.05.2025 09:00 — 👍 1    🔁 0    💬 1    📌 0

I don't like var, as it's the name of a commonly used function. col is also a base R function. I'd go with x.

27.05.2025 06:16 — 👍 2    🔁 0    💬 0    📌 0

To be clear, I'm not saying that those are the actual priorities within the company. I'm just saying how things appear to users.

26.05.2025 20:50 — 👍 3    🔁 0    💬 0    📌 0

Agreed. But as a customer I see Posit pushing Python tools much more than R tools. Trying to break into the Python market I guess. Which makes sense, but it does give an impression that R isn't as important, and pushes R users towards Python rather than the other way around.

26.05.2025 20:46 — 👍 4    🔁 0    💬 1    📌 0

According to my system logs, the actually memory usage of the R session is 104 MB (plus 273 MB for RStudio). So this seems to be a bug in the memory usage report in RStudio.

26.05.2025 13:48 — 👍 5    🔁 0    💬 0    📌 0
Screenshot of RStudio, showing that the environment is empty but that 17.12 GiB of RAM is being used.

Screenshot of RStudio, showing that the environment is empty but that 17.12 GiB of RAM is being used.

This seems like an awfully high RAM usage for a new #Rstats session in RStudio. 🤔 Anyone seen this before?

26.05.2025 13:44 — 👍 15    🔁 2    💬 2    📌 0
Preview
Posit

Looking at @posit.co from the outside, it definitely seems like their focus has shifted from #Rstats to Python. Looking at the 9 posts on the front page of the Posit blog (posit.co/blog/), 4 posts are language agnostic and 5 are about Python. None are about R.

26.05.2025 13:28 — 👍 7    🔁 0    💬 1    📌 0

Positron is built on top of VSCode, so it's pretty much the same as that in VSCode. But it also has some features from RStudio, like a variables pane and a data explorer.

22.05.2025 13:52 — 👍 0    🔁 0    💬 1    📌 0

RStudio offers both multiple panels for different scripts and parallel R sessions (through the terminal). But I agree that the git integration in VSCode is much better. Have you checked Positron out?

22.05.2025 10:13 — 👍 2    🔁 0    💬 2    📌 0

Light mode is still the default in most browser and on most sites, so that's what I usually go with. An added bonus is that the same plot can be used for print without any modifications, unlike dark mode plots.

21.05.2025 17:36 — 👍 1    🔁 0    💬 1    📌 0
Creating a custom ggplot2 theme – Måns Thulin

The most common question I get when teaching ggplot2: "Can we change the background colour?"
Yes, we can - and much more. Here's how to create your own ggplot2 themes:
🔗 mansthulin.se/posts/ggplot...

#Rstats #datasky

21.05.2025 12:06 — 👍 7    🔁 1    💬 3    📌 0

And maybe with a description of what an RSS feed is? 😀

21.05.2025 08:20 — 👍 2    🔁 0    💬 1    📌 0
Creating a Blog – Quarto

As long as it's done politely, absolutely! Preferably with a link to the part of the Quarto documentation that describes how to add an RSS feed (quarto.org/docs/website...)

21.05.2025 08:17 — 👍 2    🔁 1    💬 1    📌 0

"Pro tip: logistic regression should by default use ridge regularisation with the shrinkage parameter set to 1. That's why you always should use Python's sklearn.linear_model.LogisticRegression instead of #Rstats silly non-regularised glm."

09.05.2025 13:22 — 👍 5    🔁 1    💬 0    📌 0
Post image

The new release of RStudio prints errors, warnings and messages in different colours. That's a great improvement! I teach introductory #Rstats a lot, and students *always* think messages are errors. Hopefully this will help.

09.05.2025 06:53 — 👍 29    🔁 6    💬 3    📌 1
A deliberately chaotic and cluttered chart mocking bad data visualisation practices, featuring overlapping symbols, unreadable labels, clashing colours, and dual y-axes. The design satirises poor visual clarity and overcomplication.

A deliberately chaotic and cluttered chart mocking bad data visualisation practices, featuring overlapping symbols, unreadable labels, clashing colours, and dual y-axes. The design satirises poor visual clarity and overcomplication.

For the prompt of "Extraterrestrial" on Day29 of the #30DayChartChallenge, I decided to make a chart designed in the style of an extraterrestrial who has never heard of good data visualisation principles! 📊

How many chart crimes can you spot? 🕵️‍♂️

#DataViz #RStats #ggplot2 #Day29

29.04.2025 08:05 — 👍 15    🔁 4    💬 4    📌 1
10 Structural equation models, factor analysis, and mediation | Modern Statistics with R 10 Structural equation models, factor analysis, and mediation | Modern Statistics with R

Chapter 10 of Modern Statistics with R cover those topics: www.modernstatisticswithr.com/sem.html

29.04.2025 06:33 — 👍 1    🔁 0    💬 1    📌 0

Still using caret. I strongly dislike some of the design choices of tidymodels (like how it misuses pipes and how you can't evaluate models using LOOCV).

26.04.2025 06:45 — 👍 1    🔁 0    💬 0    📌 0
Post image

Found in r/stopdoingscience
#RStats

23.04.2025 17:49 — 👍 18    🔁 7    💬 1    📌 1

And then hack Bluesky and delete this thread to hide the evidence

17.04.2025 21:04 — 👍 0    🔁 0    💬 0    📌 0

Seems like the kind of idea that's obvious, but only after you've had the idea. 🙂 I'm interested in how it performs compared to other methods. Will run some simulations of my own next week and let you know if I find anything interesting!

17.04.2025 21:01 — 👍 1    🔁 0    💬 0    📌 0

Interesting approach! Are there any papers studying this in more depth? The "via" link at the end of the Github readme is dead.

17.04.2025 15:10 — 👍 2    🔁 0    💬 1    📌 0

@mansthulin is following 20 prominent accounts