other

Miscellaneous useful code

Survey Analysis Template While every survey is different; they generally share some common features. Thus, I start each survey analysis the same way: First I ensure that I have the data in neat flat sheet form, and then I create a second sheet of metadata that describes the data in useful ways. See this fake survey data spreadsheet example to better understand the idea. Second I use a Quarto script or an R Markdown script that processes the data and metadata in a generic way and includes all the tables and plots needed for most survey analyses, as well as notes and links explaining key topics.

Miscellaneous

Everything that's not in another project.

Increasing probability of success

Problem You run a series of trials. Trials are independent of each other and any other results. The probability of success on a trial starts at 2% and increases linearly / additively by 3% after each failure. The probability of success resets to 2% after a success; but this is irrelevant as you only run trials until you obtain a single success. Should you be interested in multiple successes then merely repeat the entire experiment exactly.

Multiple lines on a graph example

What are we doing and why? We are just going to draw a graph in R with multiple lines on one graph. This is interesting because the way base R draws graphs is a bit strange to people who are used to other packages. Some explanation is useful. Specific example In this example we are going to use the lengths of the 25 most popular movies of each year from 1931 to 2013, as explained here bu Randy Olson.