Juli Nagel's Avatar

Juli Nagel

@juli-nagel.bsky.social

PhD student (psychology, neurobiology) researching reward, memory and sleep. Way too passionate about R. Otherwise interested in gaming, western riding and climbing. Mum.

176 Followers  |  127 Following  |  83 Posts  |  Joined: 21.11.2023  |  2.2483

Latest posts by juli-nagel.bsky.social on Bluesky

Caveat: tabulate() only works for single vectors, so you can't replace sth like table(1:4, c("a", "a", "b", "b")).
Bonus points: You easily get 0 counts if you expect numbers from 1:nbins, i.e.:

> tabulate(c(3, 1, 3, 3, 3), nbins = 4)
[1] 1 0 4 0

2/2

01.10.2025 13:23 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Post image

IF YOU CAN, REPLACE TABLE() WITH TABULATE() IN YOUR #rstats CODE!

data <- sample(1:3, 100, replace = TRUE)
microbenchmark::microbenchmark(table(data), tabulate(data), times = 10000)

I'm almost angry at how much faster this is, and why I was today years old when I learned this 🀬
1/2

01.10.2025 13:23 β€” πŸ‘ 5    πŸ” 1    πŸ’¬ 2    πŸ“Œ 0

This is extremely exciting!
(But also with the release party being on October 3rd, a missed opportunity to use a "The Life of a Showgirl" reference.)

30.09.2025 18:47 β€” πŸ‘ 2    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

Is this ... a very early preregistration?

29.09.2025 16:56 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I also learned a fair deal of Spanish in school (read Don Quijote and all), but couldn't even do small talk nowadays. That happens, and it's normal (albeit sad). I fell into the "What?! But EVERYBODY should know THIS!" trap in the past, but learned that it's a very unhelpful trap to fall into.
2/2

29.09.2025 16:35 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Sure, I've learned this in school. I'm a nerdy nerd with degrees in psychology, working as a scientist, well-trained in statistics (not so much physics). When I see these videos, all I remember is that it's not surprising that this happens, but I wouldn't be able to explain it properly.
1/2

29.09.2025 16:35 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

To be fair, I've had occasional situations like these with students BEFORE the rise of LLMs ...

29.09.2025 16:25 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Line 1: warning("Hey, thought about restarting R before running this script? Btw, you might wanna set up a clean project for this, cause, you know, if you still use setwd(), Jenny Bryan will personally set your computer on fire. And do you know about dependency management? Sorry if you already do!")

26.09.2025 08:36 β€” πŸ‘ 7    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
Zebra stripes confuse biting flies, causing them to abort their landings Coat pattern helps zebras and horses evade dangerous insects

Don't know why the zebra paper won, though? It's been tested in horses before (Caro et al.); the horse community has been using blankets with zebra stripes for years. Sure, we desparetly need more replications, but why the Ig Nobel prize for a conceptual replication?
www.science.org/content/arti...

19.09.2025 12:43 β€” πŸ‘ 8    πŸ” 2    πŸ’¬ 1    πŸ“Œ 0

Had the opposite experience lately. Daycare warned me: "In case tells any stories about today ... don't be confused ... he was very excited about the document shredder."
Unfortunately, he DIDN'T mention it, so I will never know why they were so worried what weird things he might say.

29.08.2025 12:50 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Wooooooow, where is this?! 😱

25.08.2025 07:40 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

"So I leap from the gallows and I levitate down your street
Crash the party like a record scratch as I scream
'Who's afraid of little old me?'
You should be"

20.08.2025 18:08 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

(Disclaimer: Of course, results will vary if the data are not balanced, or are funky in any other way, but in this simple case, mixed model/t-test estimates and p-values will be identical.)

20.08.2025 10:16 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

t_test <- t.test(t1, t2, paired = TRUE)
mm <- lmer(value ~ time + (1 | id), data = data)
mm_summary <- summary(mm)

# estimates
abs(mm_summary$coefficients["timet2", "Estimate"])
abs(t_test$estimate)

# pval
mm_summary$coefficients["timet2", "Pr(>|t|)"]
t_test$p.value

2/2

20.08.2025 10:16 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

And here's a paired t-test versus a mixed model with a random intercept in R:

library(lmerTest)

n <- 1000
t1 <- rnorm(n)
t2 <- t1 + rnorm(n)

data <-
data.frame(
id = paste0("ID-", 1:n),
t1 = t1,
t2 = t2
)

data <-
data %>%
pivot_longer(c(t1, t2), names_to = "time")

1/2

20.08.2025 10:16 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I once had a student telling me that she hates t-tests, but prefers linear mixed models. Boy, did I have news for her ...

20.08.2025 09:46 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

"Nagel" ist German for "nail", which is why this is the first GIF to pop up, once again reminding me how lucky I was to be able to assimilate my husband's last name.

15.08.2025 11:23 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I am very proud of my Bluesky feed, which combines magic Quarto plugins with "The Life of a Showgirl" references.

14.08.2025 12:03 β€” πŸ‘ 5    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0
Preview
Understanding the Replication Crisis as a Base Rate Fallacy | The British Journal for the Philosophy of Science: Vol 72, No 4 The replication (replicability, reproducibility) crisis in social psychology and clinical medicine arises from the fact that many apparently well-confirmed experimental results are subsequently overtu...

E.g.
www.journals.uchicago.edu/doi/abs/10.1...

(But personally, I think it's not either/or, and even IF base rates were the main explanation, we should STILL fight against questionable research practices.)

23.07.2025 06:39 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Joke aside, we recently discussed in our journal club about how there's no nominal rate of successful replication, i.e., the replication rates we're seeing might be just what to expect. I don't buy that, BUT there's an interesting discussion here about base rates of theories being correct etc. etc.

23.07.2025 06:36 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I think it says a lot about how dominant RStudio is as an IDE that people frequently mistake it for the actual programming language. Sure, many don't even think about the difference between a language and an IDE, but you'd never see someone write "we used Spyder for data analysis" (I hope).

17.07.2025 07:38 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Banana for scale: Gauging trends in academic interest by normalising publication rates to common and innocuous keywords Many academics use yearly publication numbers to quantify academic interest for their research topic. While such visualisations are ubiquitous in grant applications, manuscript introductions, and revi...

Also, I wonder what these data would look like if they were normaized to account for increasing overall publication rates. Here's a banana for scale! 🍌
arxiv.org/abs/2102.06418
@dalmaijer.bsky.social

15.07.2025 13:28 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

πŸ––

10.07.2025 08:31 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

I can see past the questionable artistic choices if they can also give me the data normalized by the overall consumption of each food item.

08.07.2025 09:09 β€” πŸ‘ 15    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

preprint alert 🚨
1/ Can we accurately detect sequential replay in humans using Temporally Delayed Linear Modelling (#TDLM)? In our recent study, we could not find any replay and decided to dig deeper by running a hybrid simulation with surprising results. Link to preprint & details below πŸ‘‡

16.06.2025 07:22 β€” πŸ‘ 55    πŸ” 27    πŸ’¬ 2    πŸ“Œ 2

Ohhh, thanks for reminding me that I still have this bookmarked! (Have been hesitating to order it, though, because it would increase my pile of shame, i.e., unread books.)

10.06.2025 19:40 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Soooo ... you could potentially set up an automated pipeline on GitHub/GitLab/whatever where you push the bio updates to a repo, and then they get implemented here via some API magic. Would very likely be a massive waste of time, but, hypothetically speaking ...

05.06.2025 08:11 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Preview
Rey–Osterrieth complex figure - Wikipedia

If I didn't know the test was designed in the 1940ies, I'd almost say it looks like a drawing of the Rey–Osterrieth complex figure, a test where you have to draw a comple figure (duh!) after memorizing it.

en.wikipedia.org/wiki/Rey%E2%...

23.05.2025 11:14 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

It's bonkers that in academic science we spend hours obsessing over the wording of a paper, but often only one person has seen the code that produced the results! 2/N

16.04.2025 13:23 β€” πŸ‘ 200    πŸ” 55    πŸ’¬ 7    πŸ“Œ 10
Post image

πŸš€ Join Us for the Next Mannheim Open Science Meetup! πŸš€
πŸ”¬ Topic: ARIADNE – A Scientific Navigator to Find Your Way Through the Research Resource Labyrinth
πŸŽ™ Speaker: Γ‡ağatay GΓΌrsoy, Central Institute of Mental Health
πŸ“… Date & Time: April 30, 2025, 3:00 PM
πŸ“ Location: Register online lnkd.in/exErgJfy

20.03.2025 12:04 β€” πŸ‘ 13    πŸ” 5    πŸ’¬ 2    πŸ“Œ 2

@juli-nagel is following 20 prominent accounts