Sign in

Wang minjie

@perlatex.bsky.social
23 followers 105 following 4 posts

R, Tidyverse, Tidymodels and Stan

PostsRepliesMedia
Wang minjie @perlatex.bsky.social · 29/09/2026
AI + R + Quarto
000 0
Wang minjie @perlatex.bsky.social · 29/09/2026
R + Quarto workflow
000 0
Wang minjie @perlatex.bsky.social · 08/09/2026
What’s New in R: August 31, 2026 rfortherestofus.com/2026/08/what...
rfortherestofus.com
What’s New in R: August 31, 2026
What's New in R: Aug 31, 2026 covers an R-built Australian AI employment report, Spain's rising temperatures visualized in R, and an R/Pharma intro to agent.
000 0
Reposted by Wang minjie
Aki Vehtari @avehtari.bsky.social · 26/06/2026
@aloctavodia.bsky.social has been porting Bayesian Workflow book avehtari.github.io/Bayesian-Wor... case studies to Python using CmdStanPy, numpyro, ArviZ, Bambi, and kulprit arviz-devs.github.io/bayesian-wor... He is working on porting the rest of the case studies, too
arviz-devs.github.io
Bayesian Workflow book: Case studies in Python – Bayesian Workflow case studies in Python
16218 0
Reposted by Wang minjie
Solomon Kurz @solomonkurz.bsky.social · 11/10/2025
www.amazon.com/Doing-Bayesi...
amazon.com
Doing Bayesian Data Analysis: A Tutorial with R, Stan, brms, and the tidyverse
Doing Bayesian Data Analysis: A Tutorial with R, Stan, brms, and the tidyverse - Kindle edition by Kruschke, John, Kurz, Solomon. Download it once and read it on your Kindle device, PC, phones or tablets. Use features like bookmarks, note taking and highlighting while reading Doing Bayesian Data Analysis: A Tutorial with R, Stan, brms, and the tidyverse.
1132 0
Reposted by Wang minjie
Jan Broder Engler @jbengler.de · 23/01/2025
In case you ever wondered about the differences between magrittr pipe and base pipe 🤔 This table is taken from a great stackoverflow answer by @GeorgKindermann stackoverflow.com/questions/67... #rstats #dataviz #phd
118033 0
Reposted by Wang minjie
Crystal Lewis @cghlewis.bsky.social · 18/03/2025
Trying out dplyr::consecutive_id() for a project today. #rstats It generates a unique identifier that increments every time a variable (or combination of variables) changes.
612527 0
Reposted by Wang minjie
Rodrigo Barreiro @rodrigo404.bsky.social · 25/04/2025
Just one more week to go 😮‍💨 Finished my #day24 of the #30DayChartChallenge using some WHO data. Code at: github.com/barreiro-r/3... #rstats #dataviz
0143 0
Reposted by Wang minjie
Dirk Eddelbuettel @eddelbuettel.com · 20/04/2025
The "Getting Started in R - Tinyverse Edition" eight-page pdf guide now has a 2nd edition using, appropriately, `tinyplot` as the plotting package. See github.com/eddelbuettel... for more. #rstats
Screenshot of the top parts of pages 5 and 6 of 'Getting Started in R - Tinyverse Edition' at https://github.com/eddelbuettel/gsir-te/
310724 0
Reposted by Wang minjie
Andrew Heiss @andrew.heiss.phd · 18/04/2025
Thing I just learned in #rstats: unz() lets you connect to a .zip and load files from inside it without actually unzipping it (great for a file I'm working with that's 30 MB zipped and 1+ GB unzipped, with multiple CSVs in it)
# unz() lets you connect to a .zip and treat it like a mini file system, 
# and you can load files from inside it
one_zipped_csv_among_others <- readr::read_csv(
  unz("lotsa_zipped_csvs.zip"), "one_csv.csv"
)

# readr::read_csv() can read a .zip with a single CSV in it
one_zipped_csv <- readr::read_csv("big_zipped_file.zip")
1023446 0
Reposted by Wang minjie
Nicola Rennie @nrennie.bsky.social · 16/04/2025
A quick plot for #TidyTuesday this week - celebrating the addition of the penguins data into base R 🐧 I used {ggdist} to plot the distribution of body weights with four different chart types in one! 📊 I couldn't quite decide whether I prefer the light or dark version💡 #RStats #DataViz #ggplot2
Three box plot/density plot/rainfall plots showing body weight for three penguin species, with Gentoo significantly higher. Colours also show density, and species. Background is light with dark text.Three box plot/density plot/rainfall plots showing body weight for three penguin species, with Gentoo significantly higher. Colours also show density, and species. Background is dark with light text.
4499 0
Reposted by Wang minjie
Jumping Rivers @jumpingrivers.com · 11/04/2025
New version of R is out! Our Data Scientist, Russ Hyde, has put together a quick review of the key features and changes in R 4.5 — from new language features to graphics updates and more. 📝 Read the full blog post here: www.jumpingrivers.com/blog/whats-n... #rstats #Rprogramming #opensource
jumpingrivers.com
What's new in R 4.5.0?
Here we summarise some of the more interesting changes that have been introduced in R 4.5.0.
413557 0
Reposted by Wang minjie
John Paul Helveston @jhelvy.bsky.social · 07/04/2025
Made an app so you can view daily updates of this chart & compare other administrations and metrics like unemployment and inflation 🤓 It updates daily, so check it tomorrow to see today's continued US market collapse 🤠 jhelvy.github.io/potus-econ-s... Built with #rstats #shinylive #quarto
Screenshot of my POTUS Economic Scorecard app showing S&P 500 performance during the first 100 days following presidential inaugurations. The graph reveals Biden (2021) at +8.5%, Obama (2013) at +7%, Trump (2017) at +5%, and Trump (2025) at -16.1%. The interface includes options to select different economic indicators, adjust time periods, and filter by political party. The data visualizes a significant market decline during the current Trump administration compared to positive performances in previous administrations' early days.
35118 0
Reposted by Wang minjie
tj nightmahr 🧟‍♂️ @tjmahr.com · 20/03/2025
"what if i make a one-off Stat ggproto object?", i thought
StatRightEnd <- ggproto(
  "RightEnd", 
  Stat, 
  compute_group = function(data, scales) {
    data[which.max(data$x), ]
  }
)

ggplot(grid2) + 
  aes(mean_log_prob, plogis(preds)) +
  geom_line(aes(group = item), linewidth = .5) +
  geom_text(
    aes(label = tocs_prompt, group = tocs_prompt), 
    stat = StatRightEnd
  )
  plot of curves with a label on the right end
1122 0
Reposted by Wang minjie
Benjamin Hlina, PhD @benjaminhlina.bsky.social · 22/03/2025
Trophic Ecologists - new pkg alert - {trps} (pronounced ‘tropes’): Bayesian Trophic Position Models using 'Stan'. Estimates trophic position using equations from Post (2002), Vander Zanden & Vadeboncoeur (2002), & Heuvel et al. (2024). benjaminhlina.github.io/trps/ #rstats #ecology #foodwebs
benjaminhlina.github.io
Bayesian Trophic Position Models using stan
Bayesian trophic position models using stan by leveraging brms for stable isotope data. Trophic position models are derived by using equations from Post (2002) <doi:10.1890/0012-9658(2002)083[0703:USI...
02510 0
Reposted by Wang minjie
Matthew Kay @mjskay.com · 17/03/2025
A wrapper around the builtin #rstats splinefun() function should work with ggplot2::stat_smooth() --- see code in alt text
df = data.frame(x = -1:10, y = c(-3,2,1,2,5,3,6,7,3,6,10,11))

smooth_spline_x = \(formula, data) {
  X = model.matrix(formula[-2], data)
  # this is dumb but good enough for a hack
  X %*% rep(1, ncol(X))
}

smooth_spline = \(formula, data, ..., weights = NULL) {
  x = smooth_spline_x(formula, data)
  y = eval(formula[[2]], data, environment(formula))
  structure(
    splinefun(x, y, ...), 
    class = c("smooth_spline", "function"),
    formula = formula
  )
}

predict.smooth_spline = \(object, newdata, ..., weights = NULL, se.fit = FALSE) {
  fit = object(smooth_spline_x(attr(object, "formula"), newdata))
  if (se.fit) {
    list(fit = data.frame(fit = fit, lwr = 0, upr = 0), se.fit = NA_real_)
  } else {
    fit
  }
}

df |>
  ggplot(aes(x, y)) +
  stat_smooth(formula = y ~ x, method = smooth_spline) +
  geom_point()
6243 0
Reposted by Wang minjie
Michael Friendly @datavisfriendly.bsky.social · 14/03/2025
📊 #psy6135 #rstats Today's topic: Visualizing Uncertainty Topics: Visualizing distributions, Error bars, Bayesian stuff, fitted curves, ... Thx to @elibryan.bsky.social, @mjskay.com, @clauswilke.com, @cedricscherer.com and other folks I stole from. 💻 Slides-- friendly.github.io/6135/lecture...
29529 0
Reposted by Wang minjie
Nicola Rennie @nrennie.bsky.social · 07/03/2025
Code: github.com/nrennie/tidy...
github.com
tidytuesday/2025/2025-03-04 at main · nrennie/tidytuesday
This repository contains the R code used to produce my visualisations for the #TidyTuesday challenges. - nrennie/tidytuesday
041 0
Reposted by Wang minjie
Federica Gazzelloni @fgazzelloni.bsky.social · 05/03/2025
🔔 I'm thrilled to introduce my new series! I've been working hard on this project, and I can't wait for you to see it. 🤿 Check out this clip to get a sneak peek: buff.ly/zUowPHW Let me know what you think and stay tuned for more updates!
buff.ly
✂️ New Series: Health Data Science: Metrics, AI & Spatial Modelling
38 seconds · Clipped by Federica Gazzelloni · Original video "Health Data Science: Metrics, AI & Spatial Modelling - 01" by Federica Gazzelloni
041 0
Reposted by Wang minjie
Steven Ponce @sponce1.bsky.social · 14/02/2025
📊 #TidyTuesday – 2025 W07 | Agencies from the FBI Crime Data API . 🔗: stevenponce.netlify.app/data_visuali... . #rstats | #r4ds | #dataviz | #ggplot2
Seven small maps of the continental United States show law enforcement agencies' geographic distribution by type. City agencies (11,251) and County agencies (3,023) show the densest coverage across the country. State Police (882) are concentrated in the Northeast. Other State Agencies (715) cluster in the Southeast. University/College agencies (671) are spread across the country, with higher density in the East. Other agencies (430) show scattered distribution. Tribal agencies (185) are primarily located in Western states.
091 0
Reposted by Wang minjie
Vincent Arel-Bundock @vincentab.bsky.social · 14/02/2025
Rdatasets is a collection of 2300 free and documented datasets in CSV format. It's a great resource for teaching and exploration! The new `get_dataset()` function from the {marginaleffects} 📦 allows you to search and load them directly in #Rstats. vincentarelbundock.github.io/Rdatasets/ar...
210028 0
Reposted by Wang minjie
Konsta Happonen @konsta.happonen.eu · 14/02/2025
Happy Valentine's Day (p<0.05). #rstats
## A scatterplot of a heart tilted 45° to the right with a regression line overlaid. The title says Happy Valentine's Day with p < 0.05

library(tidyverse)
library(ggview)
library(extrafont)

## Sample from a heart curve
t <- seq(0,2*pi,length.out = 400)
x <- 16*sin(t)^3
y <- 13 * cos(t) - 5 * cos(2*t) - 2*cos(3*t) - cos(4*t)

dd <- matrix(c(x,y),ncol=2)

# Rotate 45 degrees
theta <- pi*-0.25
rotmat <- matrix(c(cos(theta),sin(theta),-sin(theta),cos(theta)), ncol = 2)
dd2 <- t(rotmat %*% t(dd))
colnames(dd2) <- c("x","y")
dd2 <- dd2 |> as_tibble()

# Check p-value
lm(y~x, data = dd2) |> summary()

# Publish or perish
p_heart <- dd2 |> 
  ggplot(aes(x,y)) +
  geom_point(size = 0.01) +
  stat_smooth(formula = y~x,method = "lm",
              color = "firebrick",
              fill = "hotpink") +
  coord_fixed() +
  theme_minimal(base_family = "Karla") +
  theme(panel.grid.minor = element_blank()) +
  labs(title = "Happy Valentine's Day",
       subtitle = "with p < 0.05",
       x = NULL, y = NULL) +
  canvas(width = 4, height = 4, dpi = 300)

p_heart |> save_ggplot("sydän/sydän.png", device = png)
0278 0
Reposted by Wang minjie
Robert (Bob) Kubinec @rmkubinec.bsky.social · 04/12/2024
I asked chatGPT to define a new statistical distribution no one had used before, then write R code to simulate the model and fit it with Stan. It created a "Bimodal Exponential-Beta Distribution" (a mixture on the domain (0,1)). and... it works 😱 code here: gist.github.com/saudiwin/081... #rstats
gist.github.com
ChatGPT-created statistical distribution with R and Stan Code:
ChatGPT-created statistical distribution with R and Stan Code: - chatgpt_exponential_beta_mixture.R
283 0
Reposted by Wang minjie
Andrew Heiss @andrew.heiss.phd · 03/05/2024
New blog post! Probability math is hard, but simulating real world data-generating processes is fun. Here's a neat exploration of how to find the probability that everyone in a household has birthdays in the same 6-months, using CDC day-of-birth statistics #rstats www.andrewheiss.com/blog/2024/05...
Radial plot showing 8 birthdays occurring in the same 6-month span between May and NovemberPlot showing how the simulated probability that everyone in a household has birthdays in the same 6-month span decreases as household size increasesThese days of the year now match the actual distribution of birthdays in the United States. If we simulated thousands of birthdays, we'd get more in September, fewer on the 13th of each money, and far fewer around Thanksgiving and Christmas.

We can now update our simulation to use this more realistic distribution of birthdays:

```{r}
#| label: fun-simulate-prob-real

simulate_prob_real <- function(n, num_simulations = 1000) {
  results <- map_lgl(1:num_simulations, ~{
    birthdays <- sample(
      prob_per_day$day_of_year, 
      size = n, 
      replace = TRUE, 
      prob = prob_per_day$prob
    )
    
    birthdays_doubled <- sort(c(birthdays, birthdays + 366))
    
    any(map_lgl(1:n, ~ birthdays_doubled[.x + n - 1] - birthdays_doubled[.x] <= (366 / 2)))
  })
  mean(results)
}
```Heatmap plot showing the relative average frequencies of being born in the US
42612 0
Reposted by Wang minjie
Chris Brownlie @bsky.chrisbrownlie.com · 28/02/2025
this week in #rstats: - R 4.4.3 released today! 🎁 - Air: the new superfast R formatter @davisvaughan.bsky.social 💨 - upcoming {rix}/Nix webinar @brodriguesco.bsky.social 📦 - intro to {ellmer} LLM pkg @posit.co 🤖 - tidymodels Q1 2025 update 📊 and more! ✨ www.linkedin.com/pulse/week-r...
linkedin.com
This week in R (2025-02-28)
A brand new superfast R formatter; a new version of R; whats new in tidymodels?; useR! deadline extension; get to know {rix}; introducing {ellmer} and more!
0125 0
Reposted by Wang minjie
Ed Hagen Twitter archive @twitterarchive.edhagen.net · 23/01/2022
The #rstats #tidyverse tibble function builds columns sequentially, so you can refer to earlier columns when defining later ones, a feature I use all the time.
001 0
Reposted by Wang minjie
Benjamin Rosenbaum @benrosenbaum.bsky.social · 28/02/2025
I completely re-worked my course "Introduction to Bayesian statistics with brms" and taught it for the 1st time this week. It is meant as a tutorial for ecologists, but should be general enough for other sciences as well github.com/benjamin-ros... #stats #Rstats #brms #Stan #Bayesian
github.com
GitHub - benjamin-rosenbaum/bayesian-intro: Introduction to Bayesian statistics
Introduction to Bayesian statistics. Contribute to benjamin-rosenbaum/bayesian-intro development by creating an account on GitHub.
1229275 0
Reposted by Wang minjie
Travis Dawry @tdawry.bsky.social · 19/11/2024
I like @andrew.heiss.phd, because he's insightful and by all accounts is a genuinely nice guy. With that said, this (building on @grrrck.xyz's work) is invaluable for making students more comfortable with the second-best #rstats library!
083 0
Reposted by Wang minjie
Mattan S. Ben-Shachar @mattansb.msbstats.info · 20/09/2024
Every damn time... #rstats
0142 0
Reposted by Wang minjie
Crystal Lewis @cghlewis.bsky.social · 07/12/2023
Is your longitudinal data currently in long format, but you need it in wide format, or vice versa? No worries! It is easy to restructure your data in R using the {tidyr} package. #rstats #edresearch You can find more examples here: github.com/Cghlewis/dat...
2268 0