Publications by Thomas Wood (

Code Lab 10 (functional programming ii)

15.05.2024

Functional Programming II Let’s reprise some of the purrr toolkit. It’s a very general way to solve the problems we meet in applied statistics. First, our friend map library(tidyverse) library(magrittr) library(palmerpenguins) map( .x = c(2, 4, 8, 16, 32), .f = function(i){ i ^ 2 } ) ## [[1]] ## [1] 4 ## ## [[2]] ## [1]...

4422 sym R (7055 sym/26 pcs)

Document

07.03.2024

Graph Clinic First, we’ll download the data, helpfully saved as a static `rds`` file library(tidyverse) library(magrittr) library(showtext) library(ggtext) library(httr) font_add_google("Roboto") t2 <- "https://github.com/thomasjwood/ps7160/raw/master/gpss/gpss_honesty_76_23.rds" %>% url %>% readRDS We need to turn some of the e...

1750 sym R (8827 sym/12 pcs) 5 img

Document

20.02.2024

A single figure We’ll try something different this time–going methodically through a single figure, from scratch. I’ll try to move at a pace which allows us to discuss the details. In this lab, we’ll use the 2022 version of the Chicago Council Survey, which has measured foreign policy attitudes since 1974. First, we’ll download the da...

5824 sym R (20400 sym/37 pcs) 8 img

Graphics Lab I Exercise Anwers

18.02.2024

Answers to Graphics Lab exercises 1. Take the top grossing film released in every year between 2018 and 2023. For each film, plot the cumulative adjusted box office against days in release. We’ll start by loading the data library(tidyverse) library(magrittr) t1 <- "https://github.com/thomasjwood/code_lab/raw/main/data/box_office_jan_97_feb_...

1300 sym R (4776 sym/7 pcs) 3 img 1 tbl

2024 code lab meeting 7 (graphics i)

15.02.2024

Graphics Perhaps the way to introduce this is to provide the dominant R graphics package’s (ggplot2) intellectual history. Hadley Wickham starts grad school at Iowa State, eventually to be supervised by Diana Cook, an Australian statistician. In assessing the extant computational approaches to statistical graphics, Hadley observes that they t...

5109 sym R (4670 sym/12 pcs) 11 img

Debrief Estimates Check

12.02.2024

Hey all– On our call two (three?!) weeks ago: Ethan proposed that we only plot estimates from Studies 3-5, and Katie asked for more clarity on the estimates and the labelling of the facets. So what I want to do here is just clarify what I did, especially since I was just following the R models that Katie wrote and saved in dropbox. First, w...

931 sym R (7363 sym/5 pcs) 1 img

Two Table Verbs

19.01.2024

Two table verbs–way more useful than you think. Joining one table to another probably appeals to your intuition as an application when you’re joining between different levels of data: You have survey subjects from separate countries, and you want to regress attitudes on a state property (like GDP/capita or the Polity score.) You have county...

2647 sym R (5433 sym/14 pcs) 2 img

Code Lab for emmeans library

30.11.2023

You estimated a model, but you probably want to report an emmeans. Whether a paper is observational or experimental, they almost always end with a set of statistical models. But gosh, they can be a bear to map a set of coefficients to your intuition. An indicative example: library(tidyverse) library(magrittr) library(broom) titanic <- "https:...

4648 sym R (16005 sym/20 pcs) 4 img 3 tbl

Publish Document

30.11.2023

You estimated a model, but you probably want to report an emmeans. Whether a paper is observational or experimental, they almost always end with a set of statistical models. But gosh, they can be a bear to map a set of coefficients to your intuition. An indicative example: library(tidyverse) library(magrittr) library(broom) titanic <- "https:...

4648 sym R (16005 sym/20 pcs) 4 img 3 tbl

Functional programming exercise

07.10.2023

A couple of exercises with purrr. A couple of exercises with the presidential election data we messed with in lab. I hope this will advertise the advantage of group_by and nest in managing list of models. First we’ll load the county presdidental election tables and do some initial manipulations. library(tidyverse) library(magrittr) t20 <- ...

905 sym R (449 sym/1 pcs)