All posts by William Doane

Common statistical tests are linear models (or: how to teach stats)

This post by Jonas Kristoffer Lindeløv presents a parsimonious view of common statistical tests which are, on their own, confusingly and inconsistently named and, taken together, a mess.

Jonas argues that there is a common theme among these tests and that it is simple. Simple to explain and simple to understand.

I highly recommend you give it a read.

https://lindeloev.github.io/tests-as-linear/

President Jimmy Carter’s Message to the Universe

“This Voyager spacecraft was constructed by the United States of America. We are a community of 240 million human beings among the more than 4 billion who inhabit the planet Earth. We human beings are still divided into nation states, but these states are rapidly becoming a single global civilization.
 
“We cast this message into the cosmos. It is likely to survive a billion years into our future, when our civilization is profoundly altered and the surface of the Earth may be vastly changed. Of the 200 billion stars in the Milky Way galaxy, some–perhaps many–may have inhabited planets and spacefaring civilizations. If one such civilization intercepts Voyager and can understand these recorded contents, here is our message:
 
This is a present from a small distant world, a token of our sounds, our science, our images, our music, our thoughts, and our feelings. We are attempting to survive our time so we may live into yours. We hope someday, having solved the problems we face, to join a community of galactic civilizations. This record represents our hope and our determination, and our good will in a vast and awesome universe.

Jimmy Carter
President of the United States of America
Statement on the launch of NASA’s Voyager I, 1977

Charlie is so Honest Like

In the early days of the universe, 9 or 10 years ago, I remember being impressed by this young man‘s musical and video creations.

Worlds collide and memes cross, and that’s how I recently ran across Charlie again in the context of a tomato risotto recipe on the SORTEDFood feed. Sorted.

Here, Charlie speaks to an issue that’s near to my heart and that too many people have forever gotten far too wrong: sex & consent. He speaks well and he speaks honestly. I commend you, lend an ear.

In this age of people doing awful things to one another and yet somehow justifying it to themselves, consent is fundamental. As humans, we should be able to discuss it and manifest it in meaningful ways.

If you’ve experienced non-consensual sex at any age, I hope you have or will find your way to talk about it with people you trust. RAINN—the Rape, Abuse & Incest National Network—is available, if you need assistance.

issuer: Local issue tracking, no net required

The goal of issuer is to provide a simple issue tracker, hosted on your local file system, for those users who don’t want to or are disallowed from using cloud-based code repositories.

Online code repositories often provide an issue tracker to allow developers, reviewers, and users to report bugs, submit feature requests, and so on. However, many developers either choose to work offline or work on enterprise networks where use of cloud services may be prohibited.

issuer is an Add-in for use in RStudio’s desktop IDE. It works entirely locally with no requirement for a cloud service or even a network connection.

Read more about issuer at https://github.com/WilDoane/issuer

You can install the development version of issuer from Github with:

devtools::install_github("WilDoane/issuer")

Yes, and…? Inviting People to Take the Next Step

As an educator who advises students working on theses and dissertations, there’s a standard question I ask—I refer to it as “the PhD question”: So what? It’s a shorthand to challenge students to consider the question: If everything you’ve just said is shown to be true, what will that mean for changes in our understanding of the world or how we engage with it?

I found myself using So what? again recently at ICER 2019, a community of education researchers that values openness and community building. I heard myself saying it, and I realized I didn’t like the tone of it at all. So what? is confrontational. It’s a conversation stopper, not a starter. It’s a blockade, not an invitation. Yes, I learned it from my graduate advisors way back when, and I think it’s time to put it to bed.

Continue reading Yes, and…? Inviting People to Take the Next Step

My RStudio Configuration

I help a few of dozen users install RStudio and learn R regularly. Whenever I need to install RStudio on a new machine, I have to think a bit about the configuration options I’ve tweaked. Invariably, I miss a checkbox that leaves me with slightly different RStudio behavior on each system. This post includes screenshots of my currently preferred standard RStudio configuration and custom keyboard shortcuts for RStudio 1.3, MacOS.

If you need an exact copy of your settings, consider the discussion at https://stackoverflow.com/questions/55903423/export-import-rstudio-user-preferences-global-setting-etc/55940249 (h/t: liebrr)

Continue reading My RStudio Configuration

Converting Individual Binary Vectors to a Value Based on Column Names

When processing data downloaded from popular survey engines, it’s not uncommon for multiple choice questions to be represented as one column per possible response coded as 0/1. So, a question with just two responses might be downloaded as part of a CSV with one column for q1_1 and another for q1_2. If the responses are mutually exclusive, then (q1_1 == 0 iff q1_2 == 1) and (q1_1 == 1 iff q1_2 == 0). If the responses are part of a “choose all that apply” question, then it’s possible to have multiple 1s.

How can these individual binary indicator variables be reassembled into a single response variable?

Continue reading Converting Individual Binary Vectors to a Value Based on Column Names

The Shiny Module Design Pattern

Foremost in your mind should be the quintessential reality of R: Everything that happens in R is the result of a function call. Shiny is no exception.

To write a minimal shiny app, you create an object that describes your app’s user interface, write a function describing runtime behaviors, and pass them into a function that spins up the app you’ve described. By convention, these two objects are associated with the variable names ui and server.

library(shiny)
ui <- fluidPage()
server <- function(input, output, session) {}

This is just R code. You can type it into the Console to execute it line by line and inspect what it does.

If you’re working in RStudio, you can type it into a Source file, then press Control-Enter (Windows) or Command-Return (MacOS) to send each line to the Console for execution.

Checking the Environment—or the structure of these two objects with str()—we can see that ui is a list of three objects. If we print ui to the Console, we see only an empty HTML <div> element.

<div class="container-fluid"></div>

The object associated with server is simply a function with no body.

To execute this minimal shiny app, we pass the ui and server objects to the shinyApp() function.

shinyApp(ui, server)

The app will be spun up either in RStudio’s Viewer pane, in a Viewer window, or in your default Web browser, depending on your settings in RStudio.

Don’t be surprised: it will be just a blank window, since all that has been defined thus far is an empty <div> element. The document that opened is an HTML document with some boilerplate CSS and JavaScript. You can inspect it using your Browser’s Developer Tools.

That’s it. That’s shiny. Everything else flows from these core ideas:

  • ui is a list object representing the HTML UI to be constructed.
  • server is a function describing the runtime behavior of your app.
  • shinyApp() takes these two objects and uses them to construct an HTML document that then gets spun up in a browser.
Continue reading The Shiny Module Design Pattern

Writing Research Well

Newcomers to writing nonfiction research—often new PhD students—may find the research process and the formal structure of research documents daunting. Here are a few resources both on research writing and on the writing craft itself that I found useful when I was starting to hone my skill. And, yes, writing is a skill; you can improve your writing through practice.

Above all, seek out and be open to feedback. Anyone who is willing to offer honest feedback on your writing to help you improve it is valuable.

The Craft of Research by Wayne Booth, et al

A Manual for Writers of Research Papers, Theses, and Dissertations by Kate Turabian, et al

On Writing Well by William Zinsser

The Professor is In by Karen Kelsky

Avoid Strunk and White. It’s an interesting historical read, but much of the advice is either incorrect or outdated, by modern standards.