The Open Workspace

S3 · Chapter 2

Today’s Agenda

  • Why only 36 percent of studies could be redone
  • Why clicking through menus loses the record, and why code keeps it
  • The four tools, and the order to install them
  • The setup check
  • Your first look at the example data

Only 36 Percent of Studies Replicated

Open Science Collaboration, 2015

  • 270 researchers set out to redo 100 published psychology studies
  • They used the same methods, similar participants, and the same analyses
  • Only 36 percent replicated at conventional thresholds
  • Among those that did, effect sizes were on average half the original size
  • The result was published in Science and is one of the decade’s most cited findings

Two Words From That Study

Replication: running a study again with new data to see whether it reaches the same answer. Example: the 270 researchers redid each study with new participants.

Effect size: how big a difference is, on a scale that does not grow with the sample. Example: the replications found effects about half the size the originals reported.

The Cause Was Friction, Not Fraud

  • Methods sections did not contain enough detail to re-run the analysis
  • Researchers had to email the original authors for clarification
  • Some authors had moved, and some had lost the data
  • Some had used software whose menus had since changed
  • The work was never built to be retraceable in the first place

Code Is the Methods Section

  • A script is a description of every step, in a language a computer can re-run
  • When you write your analysis as code, the code is the methods section
  • Reinhart and Rogoff was caught because the spreadsheet was eventually shared
  • It would have been caught faster if the analysis had been code from the start

Reproducibility: getting the same results again from the same data, the same code, and the same steps. Example: anyone who renders your file on the example data gets your exact message counts.

Exercise: Could You Rebuild Your Number?

  • Think of a number you produced for a class: an average, a count, or a percentage
  • State whether you could reconstruct exactly how you got it six months from now
  • List what you would have needed to write down at the time

Four Tools, One Ecology

  • VS Code is the editor, where prose, code, and notes all live in tabs
  • R is the language that does the counting and the statistics
  • Quarto is the publishing system that turns source into finished output
  • Git and GitHub are version control and a home for the history

All four are free, open, and cross-platform, and each produces a plain-text record of what you did.

Why R and Why Quarto

  • R dominates social science: communication, sociology, and political science
  • Its packages for content analysis, reliability, and regression are the deepest available
  • Python is also excellent, and the skills transfer both ways
  • Quarto takes one .qmd source and produces HTML, PDF, Word, or slides
  • The source mixes prose with code, and the code runs when you render

Why Git and GitHub

  • Git tracks every change to every file in a project
  • GitHub hosts that history on the web, publicly by default
  • You get a permanent audit trail and the ability to roll back to any state
  • Students get the GitHub Student Developer Pack at no cost
  • The pack includes GitHub Copilot. The course workspace tells Copilot Chat to write tidyverse code with %>% and to remind you to log each exchange in your AI-use log
  • This is the standard workflow in research labs and industry data teams

Two Git Words

Repository (repo): a project folder that Git tracks, holding your files and the full history of every change to them. Example: the mc451-workspace folder you build on Thursday.

Commit: a saved change to your files in Git, recorded with who made it, when, and a short message saying what changed. Example: “Add my research question to the prospectus.”

Packages and the Tidyverse

Package: a bundle of functions, data, and help pages that adds to what R can do on its own. Example: the course’s v2v package adds the example Twitch data and a chart theme.

Tidyverse: a collection of R packages for data science that share one design and are built to work together. Example: library(tidyverse) loads its core packages at once, including dplyr for tables and ggplot2 for charts.

Install Order, Part One

Order matters. Install these first:

  1. R, from cran.r-project.org, with installer defaults
  2. VS Code, from code.visualstudio.com
  3. The R extension for VS Code, by REditorSupport
  4. Quarto, from quarto.org, installed with defaults

R has no interface of its own. It is a backend that other tools call.

Install Order, Part Two

  1. The Quarto extension for VS Code, for live preview of .qmd files
  2. Git, from git-scm.com, with default options
  3. A GitHub account, with a professional username you will link work to
  4. The v2v package, with the install command on the V2V Hub
  5. The AURA Lab R Companion, inside VS Code: Extensions view > search AURA Lab R Companion > Install

Click-by-click walkthroughs with screenshots live on the Hub.

The Setup Check

The starter file 00-check-your-setup.qmd on the Hub ends by running one chunk:

library(v2v)
v2v::setup()
  • The validator confirms that R, Quarto, Git, and the packages the course needs are present
  • Success prints Everything the course needs is installed.
  • Then open the Command Palette and run Check my setup. It runs the same checklist, and its Install what is missing action installs any package it flags
  • Anything else means the Hub’s troubleshooting page is your next stop

First Contact With the Data

stream_log, first ten rows

channel game viewers date
sodapoppin Marble It Up! 27,934 1542578200214
xqcow Just Chatting 19,381 1542578200240
forsen Artifact 15,300 1542578200273
giantwaffle Rocket League 4,697 1542578200423
sodapoppin Marble It Up! 28,076 1542578261145
xqcow Just Chatting 19,231 1542578261186

The Data Moves

Time series: a set of measurements of the same thing taken one after another over time. Example: four channels repeat across these ten rows, so each one’s viewer count can be followed minute by minute.

  • Sodapoppin climbs from 27,934 to 28,076 to 28,203
  • That is 269 viewers gained in 122 seconds

What Moves the Numbers

  • xQc lost 150 viewers and then held steady, Forsen lost 120, and Giantwaffle gained 3
  • Each number is a real moment: a clip going viral, or a raid arriving

Raid: on Twitch, a streamer ending a stream by sending their viewers to another live channel. Example: a viewer count that jumps by hundreds in one minute.

Three More Things to Notice

  • The timestamps look like nonsense: Chapter 11 shows how to convert them

Unix epoch time: time counted from midnight UTC on January 1, 1970; this data counts it in milliseconds. Example: 1542578200214 is a moment on November 18, 2018.

  • There is a hidden newline inside sodapoppin’s title
    • Real data is messy in exactly this way
  • Titles are themselves data
    • “No Smoking in Chat” performs etiquette, and Chapter 12 returns to title content

The v2v Package

The course companion package ships three things:

  • Two fixtures: twitch_chat_sample, roughly 35,000 messages, and twitch_streams_sample, roughly 32,000 rows across 50 channels
  • Helper functions for loading data, codebook skeletons, reliability, and plots
  • The setup validator, v2v::setup(), which you can rerun any time

Load a fixture with data(twitch_chat_sample, package = "v2v").

Looking Ahead to Thursday

  • Thursday’s session is a recorded lab video. Work along with it on your own laptop, with as much of the stack installed as you managed
  • You build your project repository and make your first commit
  • Before then, finish the installs, or get far enough to know where you are stuck
  • Read Chapter 3 on ethics before Tuesday
  • GitHub Profile, 25 points, is due Friday, September 4, 11:59 PM
  • Project Setup, 25 points, is due Friday, September 11, 11:59 PM

Questions, Comments, or Concerns?