<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Simply Statistics</title>
    <link>https://simplystatistics.org/index.xml</link>
    <description>Recent content on Simply Statistics</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>&amp;copy; 2011 - 2017. All rights reserved.</copyright>
    <lastBuildDate>Sun, 03 Dec 2017 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://simplystatistics.org/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Hurricane María official death count in conflict with mortality data</title>
      <link>https://simplystatistics.org/2017/12/03/data-do-not-agree-with-hurricane-official-death-count/</link>
      <pubDate>Sun, 03 Dec 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/12/03/data-do-not-agree-with-hurricane-official-death-count/</guid>
      <description>&lt;p&gt;A recent &lt;a href=&#34;https://osf.io/preprints/socarxiv/s7dmu&#34;&gt;preprint&lt;/a&gt; by Alexis R. Santos-Lozada and Jeffrey T. Howard concludes that&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;The mortality burden may [be] higher than official counts, and may exceed the current official death toll by a factor of 10.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;The authors used monthly death records from the Puerto Rico Vital Statistics system from 2010 to 2016. Although data for 2017 was apparently not available, they extracted data from a statement made by Héctor Pesquera, the Secretary of Public Safety:&lt;/p&gt;
&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;The number of deaths for September 2017 is 2,838, with 95% of the deaths processed by the Puerto Rico Department of Health.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;Their final conclusions rely on assumptions and methodology needed to predict October figures. But just by looking at the data, we can see that the official figure of 55 deaths appears to be way off.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-12-03-data-do-not-agree-with-hurricane-official-death-count_files/figure-html/unnamed-chunk-1-1.png&#34; width=&#34;100%&#34; /&gt;&lt;/p&gt;
&lt;p&gt;To create this plot, I downloaded the Microsoft Word version of the preprint, converted it to PDF, then scraped the data from Table 1. Because there is month-to-month variability in total deaths in Puerto Rico, I computed the difference between each data point and the average for their respective month. The September 2017 data point is a clear outlier, 455 deaths above average, and is well beyond 55 deaths above the largest deviation from the monthly average. Keep in mind that Hurricane María hit Puerto Rico on September 20th, so only 10 days account for the observed difference. The official figure includes September and October so it covers at least 40 days.&lt;/p&gt;
&lt;p&gt;Below is a plot of the total deaths, which the preprint shows in Figure 2. &lt;img src=&#34;https://simplystatistics.org/post/2017-12-03-data-do-not-agree-with-hurricane-official-death-count_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;100%&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Note that 55 was the official figure at the time the preprint was written.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Some roadblocks to the broad adoption of machine learning and AI </title>
      <link>https://simplystatistics.org/2017/11/27/some-roadblocks-to-the-broad-adoption-of-machine-learning-and-ai/</link>
      <pubDate>Mon, 27 Nov 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/11/27/some-roadblocks-to-the-broad-adoption-of-machine-learning-and-ai/</guid>
      <description>&lt;p&gt;I read two blog posts on AI over the Thanksgiving break. One was a nice post discussing the challenges for AI in medicine by &lt;a href=&#34;https://lukeoakdenrayner.wordpress.com/2016/11/27/do-computers-already-outperform-doctors/&#34;&gt;Luke Oakden-Rayder&lt;/a&gt; and the other was about the need for increased focus on basic research in AI motivated by AlphaGo by &lt;a href=&#34;http://timharford.com/2017/11/what-alphago-zero-teaches-us-about-whats-going-wrong-with-innovation/&#34;&gt;Tim Harford&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve had a lot of interactions with people lately who want to take advantage of machine learning/AI in their research or business. Despite the excitement around AI and the exciting results we see from sophisticated research teams almost daily - the actual extent and application of AI is much smaller. In fact, most AI usually ends up &lt;a href=&#34;https://twitter.com/hmason/status/934046836284850176&#34;&gt;being humans in the end&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;While the promise of AI/ML has never been clearer, there are still only a handful of organizations that are using the technology in a major way. Sometimes even apparent success stories &lt;a href=&#34;https://www.statnews.com/2017/09/05/watson-ibm-cancer/&#34;&gt;turn out to be problematic&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was thinking about the lifecycle of developing an AI application. I have defined this type of application previously as having &lt;a href=&#34;https://simplystatistics.org/2017/01/19/what-is-artificial-intelligence/&#34;&gt;three parts&lt;/a&gt;: (i) an interface to humans, (ii) a data set, and (iii) an algorithm for turning the data into interactions. I started thinking about the extension of this idea to the development of an AI application and all the steps involved. Then I started thinking about potential barriers.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://user-images.githubusercontent.com/1571674/33272622-b2b5687e-d358-11e7-87c7-df633e853e09.png&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;To develop an AI application you need a few things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A group of people who are willing to let you have their data.&lt;/li&gt;
&lt;li&gt;A technology for data capture from people (this could be as simple as a website, or an Echo, or as complex as a robot).&lt;/li&gt;
&lt;li&gt;A data storage mechanism for collecting the raw data from this input (this could just be a database)&lt;/li&gt;
&lt;li&gt;A set of algorithms and scripts for organizing the data for analysis.&lt;/li&gt;
&lt;li&gt;A definition of the problem you&amp;rsquo;d like to solve in quantitative terms - usually generated through exploratory analysis.&lt;/li&gt;
&lt;li&gt;An algorithm trained on a &lt;a href=&#34;https://simplystatistics.org/2017/05/31/deeplearning-vs-leekasso/&#34;&gt;massive data set&lt;/a&gt; or at minimum trained with a &lt;a href=&#34;https://beamandrew.github.io/deeplearning/2017/06/04/deep_learning_works.html&#34;&gt;good prior or expert knowledge&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A way to structure the responses and provide feedback either to the original users of your application or to other users (researchers or executives at a company for example).&lt;/li&gt;
&lt;li&gt;The pipeline to take those formatted responses and return them to the user in a way that they can take advantage of.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I think that a lot of attention is focused on step 6 and how costly talent is for &lt;a href=&#34;https://www.nytimes.com/2017/10/22/technology/artificial-intelligence-experts-salaries.html?_r=0&#34;&gt;designing AI algorithms&lt;/a&gt;. I think for the big players where a lot of the other steps have been solved this is for sure the limiting factor and it is no wonder that the talent war is fierce.&lt;/p&gt;

&lt;p&gt;But I think that for 95% of organizations - whether they be researchers, businesses, or individuals the problem isn&amp;rsquo;t in developing the algorithm. A random forest can be fit with one line of R code and while it won&amp;rsquo;t be as accurate as an expertly trained neural network on a gigantic training data set, it will be really useful.&lt;/p&gt;

&lt;p&gt;So I think that most of the roadblocks to the democratization of AI are actually in the other steps and in particular the &amp;ldquo;glue&amp;rdquo; between the steps. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Getting access to people&amp;rsquo;s data (Step 0)&lt;/strong&gt; - It is very hard, even for researchers, to get access to health information if you aren&amp;rsquo;t DeepMind and Google. It can take years to deal with the bureaucracy of getting access to even simple data sets.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Having the infrastructure to capture data (Step 1)&lt;/strong&gt; if you aren&amp;rsquo;t a major player you might not even be capturing complete data from people visiting your website, let alone sensors, images, text, and everything else you would want to do to perform AI.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Storing data centrally (Step 2)&lt;/strong&gt; In almost all of the organizations I&amp;rsquo;ve talked to data are scattered and managed across multiple systems and with different protocols. Just knowing where and what the data are can be a multi-month process.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tidying the data (Step 3)&lt;/strong&gt; There is an entire industry of data scientists built to tackle this problem, but if you can&amp;rsquo;t find the data or if the data isn&amp;rsquo;t stored centrally (Step 2), then this can be delayed. Even if it isn&amp;rsquo;t, there is rarely a standardized data tidying pipeline even in places that only have one data type - so that makes it hard to do the next step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Defining a question AI can answer (Step 4)&lt;/strong&gt; I would venture to say this is maybe one of the biggest bottlenecks. To create an AI system as they currently exist a human needs to (i) define a concrete scientific/business problem, (ii) create a quantitative definition of that model, and (iii) define an objective function to optimize. This process can take a huge amount of expert/knowledgeable work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fitting the algorithm (Step 5)&lt;/strong&gt; While I think there are some commodity technologies that work well here - streamlining the process from modeling to implementation is probably where a lot of AI applications could use work. This can take a while to just get the model set up even after you know exactly what you want to fit.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Making the model output mean something to humans (Step 6)&lt;/strong&gt; Even in the cases where we ideally want the computer to do everything (self driving cars) we&amp;rsquo;d still like to summarize the choices the AI might make so humans can decide if they are ethical and how to regulate those decisions. But there is still a whole field of AI that is interpretable that needs to be developed and disseminated. So even places that have models built often struggle to communicate the results in a way that they can be used.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automating the use of AI models (Step 7)&lt;/strong&gt; Even if you get past all those other hurdles and have a working, interpretable AI model, you need humans to use it. Whether that is a doctor using the output of a radiology scan to make diagnostic/treatment decisions, or a car that can actually drive, the last step of actually making the model useful is still a major barrier to many projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think a lot of these barriers come down to the fact that for the most part we don&amp;rsquo;t have strict standards for data capture/tidying/organization/use that are used across organizations. We also don&amp;rsquo;t have the &amp;ldquo;glue&amp;rdquo; steps between each of these components automated. So while I think that the algorithms for AI will continue to develop rapidly in accuracy and range, for organizations to keep up they will need a lot more than just a way to fit the latest model. The reason that I think some organizations are leaping so far ahead is that they already have spent a huge amount of time thinking about all the Steps but the model fitting, so now they can focus their time/energy/resources on making algorithms do things we didn&amp;rsquo;t imagine were possible.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>A few things that would reduce stress around reproducibility/replicability in science</title>
      <link>https://simplystatistics.org/2017/11/21/rr-sress/</link>
      <pubDate>Tue, 21 Nov 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/11/21/rr-sress/</guid>
      <description>&lt;p&gt;I was listening to the Effort Report Episode on &lt;a href=&#34;https://effortreport.libsyn.com/59-the-messy-execution-of-research-reproducibility&#34;&gt;The Messy Execution of Reproducible Research&lt;/a&gt; where they were discussing the piece about &lt;a href=&#34;https://www.nytimes.com/2017/10/18/magazine/when-the-revolution-came-for-amy-cuddy.html?_r=1&#34;&gt;Amy Cuddy in the New York Times&lt;/a&gt;. I think both the article and the podcast did a good job of discussing the nuances of the importance of reproducibility and the challenges of the social interactions around this topic. After listening to the podcast I realized that I see a lot of posts about reproducibility/replicability, but many of them are focused on the technical side. So I started to think about compiling a list of more cultural things we can do to reduce the stress/pressure around the reproducibility crisis.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m sure others have pointed these out in other places but I am procrastinating writing something else so I&amp;rsquo;m writing these down while I&amp;rsquo;m thinking about them :).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;We can define what we mean by &amp;ldquo;reproduce&amp;rdquo; and &amp;ldquo;replicate&amp;rdquo;&lt;/strong&gt; Different fields have different definitions of the words &lt;em&gt;reproduce&lt;/em&gt; and &lt;em&gt;replicate&lt;/em&gt;. If you are publishing a new study we now have an &lt;a href=&#34;https://cran.r-project.org/web/packages/scifigure/index.html&#34;&gt;R package&lt;/a&gt; that you can use to create figures that show what changed and what was the same betweeen the original study and your new work. Defining concretely what was the same and different will reduce some of the miscommunication about what a reproducibility/replicability study means.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We can remember that replication is statistical, not deterministic&lt;/strong&gt; If you are doing a new study where you re-collect data according to a protocol from another group - you should not expect to get exactly the same answer. So if a result is statistically significant in one study and not significant in another, &lt;a href=&#34;http://journals.sagepub.com/doi/abs/10.1177/1745691616646366?journalCode=ppsa&#34;&gt;that may be within the bounds of what we&amp;rsquo;d expect to see&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We can remember that there is a difference between exploratory and confirmatory research&lt;/strong&gt; There is a reason that randomized trials are the basis for regulatory decisions by the FDA and others. But if we require every single study to meet the requirements of a pre-registered, randomized, double blind controlled trial with a huge sample size we might miss some &lt;a href=&#34;https://www.acs.org/content/acs/en/education/whatischemistry/landmarks/flemingpenicillin.html#alexander-fleming-penicillin&#34;&gt;important&lt;/a&gt; &lt;a href=&#34;https://en.wikipedia.org/wiki/Barry_Marshall&#34;&gt;discoveries&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We can remember that a failed replication isn&amp;rsquo;t always a scientific failure&lt;/strong&gt; One thing Roger and Elizabeth point out is that many scientific studies won&amp;rsquo;t replicate - nor should we expect all studies to replicate. Sometimes a study is preliminary, exploratory, or the first observation of an unusual event. It may be a perfectly well executed study, and not replicate because the sample size was too small or there was an unmodeled confounder. This doesn&amp;rsquo;t mean that the scientific study was a failure, it just was an observation that didn&amp;rsquo;t pan out.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We can stop publicizing scientific results as solutions so quickly&lt;/strong&gt; University press offices, startup companies, and researchers stressed for funding are under pressure to label every discovery as a &amp;ldquo;cure&amp;rdquo;, a &amp;ldquo;diagnosis&amp;rdquo;, a &amp;ldquo;solution to the crisis&amp;rdquo;. A lot of the frustration in the scientific community arises from this overstatement of results. It is hard to escape this (for me too!) - but we can excercise skepticism about claims of solutions on the basis of single scientific papers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We can be persistent and private as long as possible&lt;/strong&gt; Like many people I&amp;rsquo;ve run into frustrating cases where data isn&amp;rsquo;t available from a paper that has been published. I have contacted the authors only to be rebuffed. I have found that it takes work to convince them to provide the data, but I can often do it without having to resort to publicizing the problems and trying to make it adversarial.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We can make the realization that data is valuable but in science you don&amp;rsquo;t own it&lt;/strong&gt; There is still discussion of  data parasites and data symbionts. I have been both a data collector and a data analyst. I realize there is frustration to releasing your data and seeing others quickly publish ideas you may have had. At the same time I&amp;rsquo;ve seen how frustrating it can be to see people keep their data private and inaccessable indefinitely after publication. The reality is that people do deserve credit for collecting data, but that they don&amp;rsquo;t own the data they collect.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;We should cut each other some slack&lt;/strong&gt; I think that a lot of the frustration around reproducibility and replicability can come from the way the problem is approached. On the one hand, if you publish a scientific paper and someone tries to reproduce or replicate your work you can realize that they are doing that because they are &lt;em&gt;interested&lt;/em&gt; and try to help them. Even if they find some flaws (as they inevitably will) or the study doesn&amp;rsquo;t replicate (as it might not) that is not a failure by you. On the other hand if you are reproducibing or replicating, remember that the scientist on the other end is a person. That person is subject to all the same funding, publication, and promotion stresses as everyone else. So we should try not to make the discovery of reproducibility/replicability problems high profile &amp;ldquo;gotchas&amp;rdquo; but focus on pointing out the real scientific issues that arise and trying to move forward in a positive way.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Like many others, I have noticed that the stakes around reproducibility/replicability have been ratcheted up by social media and the &lt;a href=&#34;https://simplystatistics.org/2017/03/02/rr-glossy/&#34;&gt;rise in the prominence of the field of reproducibility&lt;/a&gt;. As someone who has experienced the real stress all of this can create in the life of real scientists, I&amp;rsquo;d love to see if we could move forward in a way that was more positive and collaborative while we address the explosion of data in the scientific enterprise.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Follow Up on Reasoning About Data</title>
      <link>https://simplystatistics.org/2017/11/20/follow-up-on-reasoning-about-data/</link>
      <pubDate>Mon, 20 Nov 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/11/20/follow-up-on-reasoning-about-data/</guid>
      <description>&lt;p&gt;Sometimes, when I write a really long blog post, I forget what the point was at the end. I suppose I could just update the previous post&amp;hellip;but that feels wrong for some reason.&lt;/p&gt;

&lt;p&gt;I meant to make one final point in my last post about how &lt;a href=&#34;https://simplystatistics.org/2017/11/16/reasoning-about-data/&#34;&gt;better data analyses help you reason about the data&lt;/a&gt;. In particular, I meant to tie together the discussion about garbage collection to the section on data analysis. With respect to garbage collection in programming, I wrote&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The promise of garbage collection is clear: &lt;em&gt;the programmer doesn&amp;rsquo;t have to think about memory&lt;/em&gt;. Lattner&amp;rsquo;s criticism is that when building large-scale systems the programmer &lt;em&gt;always&lt;/em&gt; has to think about memory, and as such, garbage collection makes it &lt;em&gt;harder&lt;/em&gt; to do so. The goal of [Automatic Reference Counting] is to make it easier for other people to understand your code and to allow programmers to reason clearly about memory.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To pick this apart just a little bit, it&amp;rsquo;s tempting to think that &amp;ldquo;not having to think about memory management&amp;rdquo; is a worthy goal, but Lattner&amp;rsquo;s point is that it&amp;rsquo;s not. At least not right now. Better to make tools that will help people to think more effectively about this important topic (a &lt;a href=&#34;https://www.brainpickings.org/2011/12/21/steve-jobs-bicycle-for-the-mind-1990/&#34;&gt;&amp;ldquo;bicycle for the mind&amp;rdquo;&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I think the analogy for data analysis is that I think it&amp;rsquo;s tempting to think of the goal of methods development as removing the need to think about data and assumptions. The &amp;ldquo;ultimate&amp;rdquo; method is one where you don&amp;rsquo;t have to worry about distributions or nonlinearities or interactions or anything like that. But I don&amp;rsquo;t see that as the goal. Good methods, and good analyses, help us think about all those things much more efficiently. So what I might say is that&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When doing large-scale data analyses, the data analyst &lt;em&gt;always&lt;/em&gt; has to think about the data and assumptions, and as such, some approaches can actually make that &lt;em&gt;harder&lt;/em&gt; to do than others. The goal of the good data analysis is to make it easier to reason about how the data are related to the result, relative to the assumptions you make about the data and the models.&lt;/p&gt;
&lt;/blockquote&gt;
</description>
    </item>
    
    <item>
      <title>Reasoning About Data</title>
      <link>https://simplystatistics.org/2017/11/16/reasoning-about-data/</link>
      <pubDate>Thu, 16 Nov 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/11/16/reasoning-about-data/</guid>
      <description>&lt;p&gt;In my ongoing discussion in my mind about &lt;a href=&#34;https://youtu.be/qFtJaq4TlqE&#34;&gt;what makes for a good data analysis&lt;/a&gt;, one of the ideas that keeps coming back to me is this notion of being able to “reason about the data”. The idea here is that it’s important that a data analysis allow you to understand how the &lt;strong&gt;data&lt;/strong&gt;, as opposed to other aspects of an analysis like assumptions or models, played a role in producing the outputs. I think for a given problems, some kinds of analysis do a better job of that than others.&lt;/p&gt;
&lt;div id=&#34;to-collect-garbage-or-not&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;To Collect Garbage or Not?&lt;/h2&gt;
&lt;p&gt;Programmers talk a lot about the importance of being able to “reason about code”, in part so that you can understand what’s going on and perhaps make modifications in the future. If there are two software solutions that produce equivalent results, one might prefer the one that allows you to reason about the code and about what the software is doing, even if it is less efficient. Aside from having a certain common sense logic to it, there are also important implications for maintaining the code.&lt;/p&gt;
&lt;p&gt;Along these lines, a while back I was listening to one of my favorite podcasts, the &lt;a href=&#34;http://atp.fm&#34;&gt;Accidental Tech Podcast&lt;/a&gt;, when &lt;a href=&#34;https://twitter.com/clattner_llvm&#34;&gt;Chris Lattner&lt;/a&gt; made a &lt;a href=&#34;http://atp.fm/205-chris-lattner-interview-transcript/&#34;&gt;surprise appearance&lt;/a&gt;. Chris previously created LLVM and worked at Apple where he developed the Swift programming language. On this episode, around the 1 hour and 56 minute mark, Lattner and John Siracusa get into a discussion about memory management models for programming languages. In particular, Siracusa asks Lattner to discuss garbage collection versus automatic reference counting (ARC), a system that Lattner developed while working at Apple.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;John Siracusa&lt;/strong&gt;: Objective-C had garbage collection, as you mentioned. Eventually, Objective-C dropped the garbage collection and got ARC [Automatic Reference Counting], and of course, Swift doesn’t have garbage collection at all. Can you talk about the trade-offs there and why Swift is the way it is?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Just as a quick summary, &lt;a href=&#34;https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)&#34;&gt;garbage collection&lt;/a&gt; is a system by which programmers can allocate memory for objects and not have to worry about de-allocating the memory when their done with it. The idea is that a separate process called the garbage collector periodically goes through all the memory that a program is using and checks to see if it still being used by some aspect of the program. If the memory is not being used, the garbage collector marks the memory as available so that it can be allocated for something else. If the garbage collector never ran, then eventually all the memory would get allocated and nothing would free up.&lt;/p&gt;
&lt;p&gt;Here’s how Siracusa sells it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Siracusa&lt;/strong&gt;: Well, the idea [is] that memory management is completely out of the hands of the programmer, and that some magical fairy behind the scenes will make it all good for you. What you’re giving up, as you mentioned before…you lack some amount of control…&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you use R, you’re using an application that uses a garbage collector (originally written by &lt;a href=&#34;https://twitter.com/LukeTierney4&#34;&gt;Luke Tierney&lt;/a&gt;). If you’ve ever noticed that sometimes you run an operation in R that normally takes a short amount of time and it takes an unusually long time to run, that’s often because R had to stop for a second or two to let the garbage collector run in the background. This “stutter” is the bane of all applications that use garbage collection. You can actually force the garbage collector to run in R by calling the &lt;code&gt;gc()&lt;/code&gt; function (although you should never have to do that in practice). I don’t think the “stutter” is a big issue in R, but it can be a big problem for applications that demand a fluid user experience.&lt;/p&gt;
&lt;p&gt;One downside of garbage collection is that it addes a random aspect to program operation. Since you never know when the garbage collector is going to get called (that is based on runtime conditions), you never know when your program is going to be halted to allow the garbage collector to do its thing. The upside though is that programmers don’t have to worry about memory management, which is often the source of nasty bugs.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Automatic_Reference_Counting&#34;&gt;Automatic reference counting&lt;/a&gt; is essentially a fancier version of manual memory management, where programmers have to manual allocate and deallocate. But instead, with ARC the &lt;em&gt;compiler&lt;/em&gt; does most of the work for you. In order to allow for this, certain restrictions must be placed on the language to allow the compiler to analyze programs and determine whether certain blocks of memory will be in use at a given time. The advantage here is that the analysis occurs at compile time, thus allowing for the running of a program to be deterministic. The downside, of course, is that the programmer has to do more deliberate thinking about memory.&lt;/p&gt;
&lt;p&gt;A key question then, as posed by Lattner is this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Chris Lattner&lt;/strong&gt;: You said GC [garbage collection] means that you don’t have to think about memory. Is that true?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Frankly, before hearing the rest, I would have said “yes, it’s true”. But Lattner continues (emphasis added):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Lattner&lt;/strong&gt;: The stutter problem, to me, isn’t really the issue, even though that’s what GC-haters will bring up all the time. It’s more about &lt;strong&gt;being able to reason about when the memory goes away&lt;/strong&gt;. The most important aspect of that is that ARC gets rid of finalizers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;If you use a garbage-collected language, you use finalizers. Finalizers are the thing that gets run when your object gets destroyed. Finalizers have so many problems that there are entire bodies of work talking about how to work around problems with finalizers.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;For example, the finalizer gets run on the wrong thread, it has to get run multiple times, the object can get resurrected while the finalizer’s running. It happens non-deterministically later. You can’t count on it, and so you can’t use it for resource management for database handles and things like that, for example. There are so many problems with finalizers that ARC just defines [it] away by having deterministic destruction.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Even without knowing what a finalizer is, it’s clear that there’s a lot of complexity involved with using a garbage collector. Lattner’s final point is critical:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Lattner&lt;/strong&gt;: There’s this question of if you’re building a large scale system, do you want people to “never think about memory?” Do you want them to think about memory all the time, like they did in Objective-C’s classic manual retain-and-release? Or do you want something in the middle?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;His argument is that ARC is that “something in the middle”.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Lattner&lt;/strong&gt;: I think that ARC strikes a really interesting balance, whether it’s in Objective-C or Swift. I look at manual retain-and-release as being a very imperative style of memory management…where you’re telling the code, line by line…this is what you should do at this point in time.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;ARC then takes that model and bubbles it up a big step, and it makes it be a very declarative model…. The cool thing about that to me is that not only does it get rid of the mechanics of maintaining reference counting and define away tons of bugs by doing that, it also means that it is now explicit in your code what your intention was. That’s something that people who maintain your code benefit from.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The promise of garbage collection is clear: &lt;em&gt;the programmer doesn’t have to think about memory&lt;/em&gt;. Lattner’s criticism is that when building large-scale systems the programmer &lt;em&gt;always&lt;/em&gt; has to think about memory, and as such, garbage collection makes it &lt;em&gt;harder&lt;/em&gt; to do so. The goal of ARC is to make it easier for other people to understand your code and to allow programmers to reason clearly about memory.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;what-about-data&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;What About Data?&lt;/h2&gt;
&lt;p&gt;What does any of this have to do with data analysis? Well, nothing, directly. But I think there is an analogous spectrum of techniques in data analysis. In programming, one can think of garbage collection (“no thinking”) on one end of the spectrum and manual memory management (“constantly thinking”) on the other end. With data analysis, there are certain black box-type procedures proposed on one end and, well, just an uncoordinated jumble of procedures on the other end of the spectrum.&lt;/p&gt;
&lt;p&gt;When I mention “black box-type” procedures, I’m not referring to machine learning prediction models, which are often derided as “black boxes” because of their complexity. Rather, I’m thinking of a way of doing data analysis that focuses primarily on outcomes and results. With these kinds of approaches, the discussion is almost entirely focused on whether the outcomes are “correct” or not, which I think is misguided in many scientific contexts. With prediction models, at least initially, it makes sense to focus on outcomes. But with data analysis, we often want to know more about how the data are connected to those outcomes.&lt;/p&gt;
&lt;p&gt;One famous example of how seemingly equivalent methods can diverge is &lt;a href=&#34;https://en.wikipedia.org/wiki/Anscombe&amp;#39;s_quartet&#34;&gt;Anscombe’s Quartet&lt;/a&gt;. Anscombe presented four datasets that have exactly the same summary statistics but appear very different when plotted. In particular, the correlations for the four datasets are the same. My take from his paper is that computing a correlation coefficient provides a &lt;em&gt;result&lt;/em&gt; and the correlation will provide you some information about the data. We could have endless discussions about whether this result is correct, whether it truly exists in the population, whether it might replicate in the next study, or whether we should have used some other correlation metric. But none of that matters once you make a scatterplot of the data. The scatterplots show you &lt;em&gt;how&lt;/em&gt; the data inform the result. In this case, there are four different ways in which the data can inform a given correlation coefficient, some of which are perhaps more concerning than others.&lt;/p&gt;
&lt;p&gt;The scatterplots in Anscombe’s Quartet allow us to reason about the data in a way that the correlation coefficient alone does not. They tell us more about what is going on with the data and aid us in interpreting the correlation coefficient. In this case, I think an analysis that includes the scatterplots is a &lt;em&gt;better data analysis&lt;/em&gt; than one that does not. Of course, the scatterplots alone may not be sufficient because they don’t actually give you a number, which may be needed in subsequent analyses. But there’s nothing that says you can’t do both.&lt;/p&gt;
&lt;p&gt;This is more than simply saying that you should make plots (although you &lt;em&gt;should&lt;/em&gt;). When you run a simple linear regression, there are two contributing parts: (a) the data and (b) the assumption of linearity. Reporting the regression coefficient gives you a sense of the strength of the relationship between the predictor and the response, but does that relationship arise from the data or from the model’s assumptions? Any analysis that can help the reader elicit the relative contributions of those two components is better than an analysis that doesn’t.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;evaluating-data-analysis&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Evaluating Data Analysis&lt;/h2&gt;
&lt;p&gt;Interestingly, Anscombe laid out four “myths” that he hoped to debunk:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;&lt;p&gt;Numerical calculations are exact, but graphs are rough;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For any particular kind of statistical data there is just one set of calculations constituting a correct statistical analysis;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Performing intricate calculations is virtuous, whereas actually looking at the data is cheating.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Unfortunately, I think these three ideas are alive and well in much of the world of data analysis, especially points 2 and 3. In discussions with various people about what makes for a good data analysis, I’ve found there’s a common focus on “correctness”. For example, if a data analysis leads to a result that later replicates, then the original analysis is a good one. It’s hard to be against correctness, but I think it’s misguided. In particular, the correctness of a scientific claim cannot usually be evaluated with a single study, so this would imply that you cannot evaluate the data analysis that went into making that claim. If a replication study occurs 10 years later, that would imply that we will be waiting 10 years to determine if a data analysis is good.&lt;/p&gt;
&lt;p&gt;I think it should be possible to evaluate the quality of a data analysis once it’s done, not 10 years later when a replication study verifies a scientific claim. One way to do so is to ask whether the analysis allows us to reason about the data relative to another possible analysis. If we can answer the question, “How do the data in this study inform the result?” then I think we are in good shape.&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>How do you convince other people to use R?</title>
      <link>https://simplystatistics.org/2017/10/30/how-do-you-convince-others-to-use-r/</link>
      <pubDate>Mon, 30 Oct 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/10/30/how-do-you-convince-others-to-use-r/</guid>
      <description>

&lt;p&gt;I just got back from the &lt;a href=&#34;http://ozunconf17.ropensci.org&#34;&gt;rOpenSci OzUnconf&lt;/a&gt; that was run in Melbourne last week. I’d like to give a big thanks to the organizers (Nick Tierney, Di Cook, Rob Hyndman and others) for putting on a great unconference. These events are always a great opportunity to meet people just getting started in the R community and to get them involved.&lt;/p&gt;

&lt;p&gt;As is typical for these unconferences, topic ideas were pitched via issues on the &lt;a href=&#34;https://github.com/ropensci/ozunconf17/issues/&#34;&gt;OzUnconf GitHub repo&lt;/a&gt;. One issue that I filed was titled &lt;a href=&#34;https://github.com/ropensci/ozunconf17/issues/30&#34;&gt;“How do you pitch R to new users?”&lt;/a&gt;. While this issue was not taken up during the unconference (for good reason, I think), Nick was kind enough to initiate a lunch time discussion of the topic (with &lt;a href=&#34;http://twitter.com/adaptive_plant&#34;&gt;Daniel Falster&lt;/a&gt; kindly taking notes).&lt;/p&gt;

&lt;p&gt;The topic came up in my mind because I’ve found that I’ve had to change the way that I “sell” R to new users. Through various discussions at the unconference and in many other venues, I’ve found that many R users, even today, are the “lone R user” in their group/institution/organization. While they may enjoy using R, it’s often made difficult by the fact that others in their group do not use R and therefore there is some negotiation over “how things get done”. Convincing others in the group to use R is one way to go (I suppose abandoning R is the other) and the question of how best to do this for different audiences is the question that arose in my mind. As a teacher, you can usually design the curriculum so that the students are forced to use R. But in most other environments, a different approach is needed.&lt;/p&gt;

&lt;p&gt;As part of the introduction to the topic, I talked about how I used to convince others to use R. Bear in mind, this was almost 20 years ago and the majority of people I was talking to were using SAS, Stata, SPSS, Excel, or some other commercial package. These were largely interactive packages, perhaps with graphical user interfaces, designed to do more or less traditional statistical analyses. My pitch usually involved three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Free&lt;/strong&gt;. R was both free as in cost and free as in &lt;a href=&#34;http://www.fsf.org&#34;&gt;free software&lt;/a&gt;. The free cost part made it a highly accessible package and the free software part allowed for anyone to tinker with the package, inspect its code, and make improvements.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Graphics&lt;/strong&gt;.  R was able to produce high quality “publication ready” graphics and it gave you detailed control over all the graphical elements. S-PLUS could also do this but S-PLUS didn’t come with the free part mentioned above.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Programming language&lt;/strong&gt;. Unlike packages like SAS, Stata, or SPSS, R came with a robust and sophisticated Lisp-like programming language that was well-suited for data analysis applications. In addition, you could use it to build packages that could extend the core R system.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Much has changed since those early days and I’ve varied my pitch quite a bit to focus on a few different things (that didn’t exist back then). In particular, the audience has changed—I talk to many more people who are just getting started in data analysis and therefore are a bit more open-minded about which software to use. Also, python has come on the scene as a viable alternative to R for data science and so there are even more arguments to consider. Some of the things I focus on now are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reproducibility  and Reporting&lt;/strong&gt;. With the development of knitr and its combination with R Markdown, the writing of reproducible reports was made infinitely easier. (Markdown itself, probably deserves its own discussion, but it’s not specifically R-related.)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;RStudio&lt;/strong&gt;. The development of the RStudio IDE has made getting started with R much easier. Having a powerful IDE was important to me for learning other languages and I’m glad R finally has something solid for itself. RStudio has significantly simplified the development of R packages via devtools and roxygen2. While it’s not yet perfect, these tools have changed what used to be a labor-intensive and finicky process into a more manageable and easier to learn work flow.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Graphics&lt;/strong&gt;. R still has the ability to make great data graphics and with the introduction of &lt;code&gt;ggplot2&lt;/code&gt;, it has become easier to make good graphics.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;R Packages and Community&lt;/strong&gt;. With over 10,000 packages on CRAN alone, &lt;a href=&#34;https://youtu.be/yhTerzNFLbo&#34;&gt;there’s pretty much a package to do anything&lt;/a&gt;. More importantly, the people contributing those packages and the greater R community have expanded tremendously over time, bringing in new users and pushing R to be useful in more applications. Eveyr year now there are probably hundreds if not thousands of meetups, conferences, seminars, and workshops all around the world, all related to R.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;discussion&#34;&gt;Discussion&lt;/h2&gt;

&lt;p&gt;At the unconference, a number of people had different approaches to how to convince others to use R. Here are just a summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Someone mentioned the &lt;a href=&#34;http://bioconductor.org&#34;&gt;Bioconductor&lt;/a&gt;, which is a huge resource for those doing research in the world of high throughput biology. Not many other packages have something similar so it makes an obvious selling point to people working in this area&lt;/li&gt;
&lt;li&gt;The idea of using R end-to-end came up, meaning using R to clean up messy data and taking it all the way to some interactive Shiny app on the other end. The idea that you can use the same tool to do all the things in between made for a compelling case for R.&lt;/li&gt;
&lt;li&gt;For the spreadsheet audience, the &lt;code&gt;dplyr&lt;/code&gt; package was sometimes a good selling point. The idea here was that you could show people how much time could be saved by automating analyses and using &lt;code&gt;dplyr&lt;/code&gt; to clean up data.&lt;/li&gt;
&lt;li&gt;The open source nature of R came up a few times, primarily as a means for developing transferable skills. If you work at a company/institution that specializes in some proprietary package, it’s often difficult to transfer those skills somewhere else if your new job doesn’t use that package. The fact that R is open source means that, in theory, you could use it anywhere and the skills that you build up in R are (again, in theory) applicable everywhere.&lt;/li&gt;
&lt;li&gt;Someone mentioned that if you want to convince someone to learn/use R, just show them the multitude of jobs available to R programmers (and in particular, the salaries attached to them).&lt;/li&gt;
&lt;li&gt;The fact that R is obtainable for free is still important, given that Matlab and SAS licenses have not gotten any cheaper over time. In my experience, this is particularly important in non-industrialized countries where for many people paying for expensive licenses is not an option.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This just a brief summary of our discussion at the unconference and I was heartened to see all of the enthusiasm for R there. Even with R’s incredible growth over the last 20 years, there will still come a time when a case needs to be made to use R over something else. I’m just glad that we have so many more reasons today than we used to.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>It Costs Money to Get It Right</title>
      <link>https://simplystatistics.org/2017/10/09/it-costs-money-to-get-it-right/</link>
      <pubDate>Mon, 09 Oct 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/10/09/it-costs-money-to-get-it-right/</guid>
      <description>

&lt;p&gt;On the latest episode of &lt;a href=&#34;http://nssdeviations.com/46-uncanny-valley-of-stickerness&#34;&gt;Not So Standard Deviations&lt;/a&gt; I talked with Hilary about Apple&amp;rsquo;s efforts to train machine learning algorithms in their Face ID technology in the iPhone X. The gist of Face ID is that it recognizes your face using a mathematical representation and then unlocks the phone when it can confirm that it is you. In its keynote presentation, Apple mentioned that it&amp;rsquo;s using machine learning to do this and even had developed its own custom chips to do the computations.&lt;/p&gt;

&lt;p&gt;There were many questions regarding Face ID, including how exactly Apple had trained this machine learning model without it ever being released to the public. There were natural concerns that the system would only recognize certain kinds of faces, perhaps of certain ethnic backgrounds or of certain shapes or sizes. Two bits of evidence indicate that Apple likely spent a lot of money in this training process. The first bit comes from Craig Federighi, Senior Vice President for Software Engineering, in an &lt;a href=&#34;https://techcrunch.com/2017/09/15/interview-apples-craig-federighi-answers-some-burning-questions-about-face-id/&#34;&gt;interview with Tech Crunch&lt;/a&gt;,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Phil [Schiller] mentioned that we&amp;rsquo;d gathered a billion images and that we&amp;rsquo;d done data gathering around the globe to make sure that we had broad geographic and ethnic data sets. Both for testing and validation for great recognition rates,&amp;rdquo; says Federighi. &amp;ldquo;That wasn’t just something you could go pull off the internet.&amp;rdquo;&lt;/p&gt;

&lt;p&gt;Especially given that the data needed to include a high-fidelity depth map of facial data. So, says Federighi, Apple went out and got consent from subjects to provide scans that were &amp;ldquo;quite exhaustive.&amp;rdquo; Those scans were taken from many angles and contain a lot of detail that was then used to train the Face ID system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The second bit of information comes from the &lt;a href=&#34;http://atp.fm&#34;&gt;Accidental Tech Podcast&lt;/a&gt; where a listener wrote in to describe a study that he had recently enrolled in that took very detailed images of his face. Although there is no explicit connection, it would sound by the description that this study could have been related to the Face ID efforts (you can hear Casey Liss discuss the study &lt;a href=&#34;Accidental Tech Podcast: 240: Undefined Wait Period
https://overcast.fm/+CdQoBnmk/1:15:23&#34;&gt;here&lt;/a&gt;). Apparently, the study was being conducted by &lt;a href=&#34;https://www.exponent.com&#34;&gt;Exponent&lt;/a&gt; which from its web site appears to be a scientific and technical consulting firm.&lt;/p&gt;

&lt;p&gt;Given the two bits of information, I don&amp;rsquo;t think it&amp;rsquo;s a stretch to say that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Apple decided it needed a huge dataset to train the Face ID algorithm and that no such dataset existed that they could access&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Having no real desire to collect such data themselves, Apple outsourced the study to a third party company (in much the same way a biotech company might outsource a clinical trial to a clinical research organization) to collect the data to their specifications. The outsourcing also allowed Apple to shield its identity in the process so that they could keep the whole Face ID system secret.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;The collected dataset (and the subsequently trained model) effectively serve as the &amp;ldquo;prior&amp;rdquo; distribution in a complex classification scheme that is adapted to a specific user once a user allows the iPhone X to collect their face data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Apple claims that user data is not sent back to Apple for privacy reasons, so that the &amp;ldquo;big&amp;rdquo; model is not updated according to user data. Perhaps Apple will continue to collect data separately from user data, but there was no mention of that.&lt;/p&gt;

&lt;p&gt;If any of this is true, there are a few things worth noting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;This is not the way things are done Silicon Valley these days. A perhaps less costly way would be to give some app away for free (like a fun game or something similar), let the app take a bunch of pictures of you from different angles, and then gather all the data to train a model. Of course, such an approach would be subject to the selection bias that all approaches like this suffer from, because the data only represents the people whom the company could get to use the product.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;It must have been very expensive to conduct this study, although that is less of a big deal when you have &lt;a href=&#34;https://www.aboveavalon.com/notes/2017/8/15/apple-has-the-best-business-model-for-generating-cash&#34;&gt;over $150 billion in net cash&lt;/a&gt;. That said, only a handful of companies could afford to do this and certainly not your average startup.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;If the Face ID system works well and is capable of recognizing the diversity of faces that represent the iPhone customer base, then it would suggest that getting this kind of machine learning right &lt;em&gt;costs a lot of money&lt;/em&gt;. In particular, it highlights the limitations of crowdsourcing-as-data-collection and it would suggest that old-fashioned ideas of sampling and experimental design are still needed once in a while.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&#34;is-it-research&#34;&gt;Is It Research?&lt;/h2&gt;

&lt;p&gt;On Twitter, someone mused that wouldn&amp;rsquo;t it be nice if they released all this data to the public? Certainly, it would be a valuable and unique resource if they did and would likely spur a wealth of new innovations. Of course, this will almost certainly not happen, if only because Apple considers this dataset a key to their competitive advantage in the area of face detection, which they believe is the future of authentication. Why give this up to their competitors? Indeed, I don&amp;rsquo;t think anyone would expect Apple to give up this dataset any more than we might expect Google to give up data it collects from its search engine.&lt;/p&gt;

&lt;p&gt;On the other hand, if I had conducted a study collecting similar face information (albeit on a smaller scale!) and published a paper about my findings about face morphology, there would likely be an expectation of me to release my data to the public along with the findings. And &lt;em&gt;rightly so&lt;/em&gt;! Reproducibility is critical to moving science forward and releasing the data allows others to reproduce the findings. Furthermore, such a dataset would likely be useful to others investigations and would benefit all of science.&lt;/p&gt;

&lt;p&gt;But why is there is no expectation for Apple to release data from its study but there is an expectation on me to release data from my study?&lt;/p&gt;

&lt;p&gt;In my opinion, Apple is not conducting research, even though it kind of looks like it is. Rather, Apple is doing product development, which requires some gathering of information as part of the process. The fact that the information gathering was done on such a large scale isn&amp;rsquo;t relevant. Just as any consumer packaged goods company might gather a focus group before developing their next toothpaste, Apple gathered face data in order to develop Face ID.&lt;/p&gt;

&lt;p&gt;I often argue with people over whether companies like Google, Facebook, and Apple do research. My argument is that for the most part, they do not, because they are not interested in creating new knowledge. They do not make any specific public claims or inferences about the data they&amp;rsquo;ve gathered and so there isn&amp;rsquo;t really anything for them to defend. They are interested in taking whatever information they collected and channeling it into products. Yes, all of these companies occasionally publish a paper (I think Apple has a &lt;a href=&#34;https://machinelearning.apple.com&#34;&gt;grand total of five&lt;/a&gt;), and I would say that those papers represent real research. But I would wager that those papers represent a small fraction of the work going on in those companies.&lt;/p&gt;

&lt;p&gt;As a side note, &lt;a href=&#34;https://twitter.com/mdneuman&#34;&gt;Mark Neuman&lt;/a&gt; on Twitter suggested that this kind of work does qualify as research for the purposes of evaluating the ethical treatment of research sbjects. I would have to agree here, and I would hope that all of these companies obtain proper informed consent from subjects before collecting their data (at least their lawyers spend a lot of time thinking about it). The fact that these companies may be collecting these data for product development and not for research doesn&amp;rsquo;t absolve them of the need to treat subjects properly.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Creating an expository graph for a talk</title>
      <link>https://simplystatistics.org/2017/10/02/creating-an-expository-graph-for-a-talk/</link>
      <pubDate>Mon, 02 Oct 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/10/02/creating-an-expository-graph-for-a-talk/</guid>
      <description>&lt;p&gt;I’m co-teaching a &lt;a href=&#34;http://jtleek.com/advdatasci/&#34;&gt;data science class&lt;/a&gt; at Johns Hopkins with &lt;a href=&#34;http://johnmuschelli.com/&#34;&gt;John Muschelli&lt;/a&gt;. I gave the lectures on EDA and he just gave a lecture on how to create an &lt;a href=&#34;http://jtleek.com/advdatasci/slides/09-expository-graphs-slides.html&#34;&gt;“expository graph”&lt;/a&gt;. When we teach the class an exploratory graph is the kind of graph you make for yourself just to try to understand a data set. An expository graph is one where you are trying to communicate information to someone else.&lt;/p&gt;
&lt;p&gt;When you are making an exploratory graph it is usually simple, with no axes, legends, fancy colors, or other effort to make it pretty, understandable and clear. John has a &lt;a href=&#34;https://hopstat.wordpress.com/2016/02/18/how-i-build-up-a-ggplot2-figure/&#34;&gt;great blog post&lt;/a&gt; on how to build up a figure that is expository.&lt;/p&gt;
&lt;p&gt;Recently I gave a &lt;a href=&#34;https://docs.google.com/presentation/d/1hzdSDaPPSE9xUYZHhOVfQIRPPdwe0A9SdE7QDsK3bOA/edit?usp=sharing&#34;&gt;talk at McGill University&lt;/a&gt; and needed to create a plot for the talk. I figured one more example is always better for everything, so I thought I’d go through my process here.&lt;/p&gt;
&lt;p&gt;I wanted to show the p-value distribution from the tidy-pvals package. So first I loaded the data:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(tidypvals)
library(ggridges)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Loading required package: ggplot2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(dplyr)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 
## Attaching package: &amp;#39;dplyr&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## The following objects are masked from &amp;#39;package:stats&amp;#39;:
## 
##     filter, lag&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## The following objects are masked from &amp;#39;package:base&amp;#39;:
## 
##     intersect, setdiff, setequal, union&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(ggplot2)
library(forcats)
data(allp)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I knew I wanted to use the &lt;a href=&#34;https://cran.r-project.org/web/packages/ggridges/index.html&#34;&gt;ggridges&lt;/a&gt; package so I read the docs and started with the easiest version:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  ggplot(aes(x = pvalue, y = field)) +
    geom_density_ridges()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Picking joint bandwidth of 0.00413&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Right away I saw there were some problems here. First of all, clearly a p-value greater than one shouldn’t be in there, so that was a mistake. I also don’t like that you can’t really see the values because most of the action is near zero.&lt;/p&gt;
&lt;p&gt;So let’s fix the x-axis a bit. I spent a few minutes fiddling and decided I just wanted to see the values between 0 and 0.25.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  ggplot(aes(x = pvalue, y = field)) +
    geom_density_ridges() + 
  xlim(c(0,0.25))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Picking joint bandwidth of 0.00401&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 359521 rows containing non-finite values
## (stat_density_ridges).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Ok that’s better, but I don’t really like the grey background so let’s pick a different background color&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  ggplot(aes(x = pvalue, y = field)) +
    geom_density_ridges() + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Picking joint bandwidth of 0.00401&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 359521 rows containing non-finite values
## (stat_density_ridges).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-4-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;That’s a bit prettier, but we see that field is sometimes NA so we need to remove those values.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field)) +
    geom_density_ridges() + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Picking joint bandwidth of 0.00404&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 349629 rows containing non-finite values
## (stat_density_ridges).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-5-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;And actually the density plots are a little weird for p-values, lets see if we can turn them into something a little more like a histogram, which I think fits this data type better. To do that we have to change the parameters in &lt;code&gt;geom_density_ridges&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## `stat_binline()` using `bins = 30`. Pick better value with `binwidth`.&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 349629 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Ok but I think it would look better if it was a little bit higher resolution, let’s up the number of bins&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,bins=50) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 349629 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-7-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Ok but as people have pointed out the spike at 0.05 is due to censoring (p-values reported like &lt;span class=&#34;math inline&#34;&gt;\(P &amp;lt; 0.05\)&lt;/span&gt;). So let’s break it down by operator.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field,fill=operator)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,bins=50) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 349629 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-8-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Ok there aren’t that many greater than p-values and it makes the plot messy so let’s drop those&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  filter(operator != &amp;quot;greaterthan&amp;quot;) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field,fill=operator)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,bins=50) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 332965 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-9-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;The histograms overlap a bit so let’s alpha blend the colors.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  filter(operator != &amp;quot;greaterthan&amp;quot;) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field,fill=operator)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,
                        bins=50,alpha=0.25) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 332965 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-10-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;There is some funkiness in how the histogram bins are computed so I went to the internet and figured out I needed to set the boundary at 0 and make the bins be closed on the right.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  filter(operator != &amp;quot;greaterthan&amp;quot;) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field,fill=operator)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,
                        bins=50,alpha=0.25,
                        boundary=0,closed=&amp;quot;right&amp;quot;) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 332965 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-11-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Now we make sure that there isn’t wasted space on the y-axis by using the expand argument.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  filter(operator != &amp;quot;greaterthan&amp;quot;) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field,fill=operator)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,
                        bins=50,alpha=0.25,
                        boundary=0,closed=&amp;quot;right&amp;quot;) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE) + 
  scale_y_discrete(expand=c(0,0))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 332965 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-12-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Remove the baseline from the plot for true ggridges coolness&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;allp %&amp;gt;% 
  filter(!is.na(field)) %&amp;gt;%
  filter(operator != &amp;quot;greaterthan&amp;quot;) %&amp;gt;%
  ggplot(aes(x = pvalue, y = field,fill=operator)) +
    geom_density_ridges(stat = &amp;quot;binline&amp;quot;,
                        bins=50,alpha=0.25,
                        boundary=0,closed=&amp;quot;right&amp;quot;,
                        draw_baseline=FALSE) + 
  xlim(c(0,0.25)) + 
  theme_ridges(grid = FALSE) + 
  scale_y_discrete(expand=c(0,0))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning: Removed 332965 rows containing non-finite values (stat_binline).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-10-02-creating-an-expository-graph-for-a-talk_files/figure-html/unnamed-chunk-13-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;That’s definitely not a perfect plot, but it worked for my talk and was at least able to communicate a couple of the key points (about variation by field, variation by operator, and spikes at critical values).&lt;/p&gt;
&lt;p&gt;If I was going beyond the talk I’d probably reduce the number of fields displayed or really increase the size of the plot. I’d probably make the bin width even smaller and I’d add a title. I’d also probably clean up the “greaterthan” and “lessthan” to be “Greater than” and “Less than”.&lt;/p&gt;
&lt;p&gt;Regardless, I’m always surprised how much work it takes to go from an exploratory plot I’m just looking at myself to one I’d show to other people.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Recording Podcasts with a Remote Co-Host</title>
      <link>https://simplystatistics.org/2017/09/20/recording-podcasts-with-a-remote-cohost/</link>
      <pubDate>Wed, 20 Sep 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/09/20/recording-podcasts-with-a-remote-cohost/</guid>
      <description>

&lt;p&gt;I previously wrote about &lt;a href=&#34;https://simplystatistics.org/2017/09/18/editing-podcasts-logic-pro-x/&#34;&gt;my editing workflow for podcasts&lt;/a&gt; and I thought I&amp;rsquo;d follow up with some details on how I record both &lt;a href=&#34;http://nssdeviations.com&#34;&gt;Not So Standard Deviations&lt;/a&gt; and &lt;a href=&#34;http://effortreport.libsyn.com&#34;&gt;The Effort Report&lt;/a&gt;. This post is again going to be a bit Mac-specific because, well, that&amp;rsquo;s what I do.&lt;/p&gt;

&lt;h2 id=&#34;communication&#34;&gt;Communication&lt;/h2&gt;

&lt;p&gt;Both of my podcasts have a co-host who is not in the same physical location as me. Therefore, we need to use some sort of Internet-based communication software (Skype, Google Hangouts, FaceTime, etc.) to talk with each other. Another simpler option is to use web-based communications platforms that are built for podcasting, including &lt;a href=&#34;https://zencastr.com&#34;&gt;Zencastr&lt;/a&gt; or &lt;a href=&#34;https://tryca.st&#34;&gt;Cast&lt;/a&gt;. These platforms take advantage of &lt;a href=&#34;https://en.wikipedia.org/wiki/WebRTC&#34;&gt;WebRTC&lt;/a&gt; to record audio on each co-hosts machine (more on this later).&lt;/p&gt;

&lt;h3 id=&#34;web-platforms&#34;&gt;Web Platforms&lt;/h3&gt;

&lt;p&gt;For those who are just starting up, I would recommend something like Zencastr or Cast because they are easy to setup and basically &amp;ldquo;just work&amp;rdquo;. (One note: if you are using Safari 10.x on the Mac (which doesn&amp;rsquo;t support WebRTC), these sites won&amp;rsquo;t work. Use Google Chrome instead.) For these web sites, you need nothing more than a pair of headphones with a built in microphone (like the ones that likely came with your cell phone) and a computer. Communication occurs over the Internet, as you might expect, but the audio that is recorded is the audio that comes from your microphone. The audio that goes over the Internet is not recorded.&lt;/p&gt;

&lt;p&gt;The advantage of this system is that&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You don&amp;rsquo;t have to worry about synchronization&amp;mdash;the audio is recorded simultaneously.&lt;/li&gt;
&lt;li&gt;The audio quality is good because it is recorded locally.&lt;/li&gt;
&lt;li&gt;Files can be uploaded immediately to the cloud so that the editor can quickly assemble them (i.e. Zencastr uploads files to Dropbox).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The disadvantages of these services are&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;They charge a monthly fee with tiered plans (Zencastr has a free &amp;ldquo;hobbyist&amp;rdquo; plan)&lt;/li&gt;
&lt;li&gt;They only can handle certain host setups&lt;/li&gt;
&lt;li&gt;In my experience, communications noise can still affect the audio (not sure why).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Both Zencastr and Cast are fairly new offerings and therefore occasionally have to work through some bugs and wonkiness. &lt;a href=&#34;https://twitter.com/hspter/&#34;&gt;Hilary&lt;/a&gt; and I started out using Zencastr for Not So Standard Deviations but eventually moved off of it. This was in part because one time we thought we recorded an entire hour-long episode and it turned out the file was corrupted (we had to re-record it the next day). To this day I&amp;rsquo;m not sure what happened, but after that I resolved to have more control over the process.&lt;/p&gt;

&lt;h3 id=&#34;manual-platforms&#34;&gt;&amp;ldquo;Manual&amp;rdquo; Platforms&lt;/h3&gt;

&lt;p&gt;The alternative to the web-based platforms is to use a more manual approach. I have found this system to be more reliable, if not a bit more complicated. Here, you can use Google Hangouts, Skype, FaceTime, or another Internet-based communications program. I&amp;rsquo;ve used most of them and I&amp;rsquo;ve found that Google Hangouts is probably the best (but it is pretty close all around). Obviously, the quality of your Internet connection will be more important than which software you use, and that may depend on exactly where in the world you are.&lt;/p&gt;

&lt;h2 id=&#34;recording&#34;&gt;Recording&lt;/h2&gt;

&lt;p&gt;The basic idea is that there are two types of audio streams: the audio generated by each co-host/speaker and the audio that is passing across the Internet. The basic process here is&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Each speaker/co-host records their own audio file on their computer using a program like Quicktime or Audacity or something similar. On the Mac, this is super simple&amp;mdash;just open up Quicktime Player and goto File &amp;gt; New Audio Recording&amp;hellip;. After that, just click the red circle button and you&amp;rsquo;re recording!&lt;/li&gt;
&lt;li&gt;You can also record the Internet audio using a program like &lt;a href=&#34;http://www.ecamm.com/mac/&#34;&gt;Ecamm&lt;/a&gt; or &lt;a href=&#34;http://rogueamoeba.com/audiohijack/&#34;&gt;Audio Hijack&lt;/a&gt;. This is strictly speaking not necessary but it is useful as a backup audio recording and also for synchronizing the various speaker audio files in the editing phase.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you&amp;rsquo;re going down the road of manual recording (and you use a Mac) I &lt;strong&gt;strongly&lt;/strong&gt; recommend that you invest in getting &lt;a href=&#34;http://rogueamoeba.com/audiohijack/&#34;&gt;Audio Hijack&lt;/a&gt;. It is a phenomenal program that lets you do basically anything on the Mac involving audio. If your Mac makes a sound in any way, you can easily record it.&lt;/p&gt;

&lt;p&gt;With Audio hijack, you can set things up to record audio, save it to a file in various formats, and send the audio to different outputs. Here is my setup:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-19-recording-podcasts-with-a-remote-cohost/audiohijack.png&#34; alt=&#34;Audio Hijack setup&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s how it breaks down:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I am recording my audio using an ATR USB Microphone (the exclamation point is there because my mic is not connect right now)&lt;/li&gt;
&lt;li&gt;I record my co-host&amp;rsquo;s audio through Google Chrome (via Google Hangouts).&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;Both my and my co-host&amp;rsquo;s audio is saved to separate uncompressed 16-bit mono AIFF files that will later be imported into Logic Pro X for editing.&lt;/li&gt;
&lt;li&gt;I then route each audio stream through Peak/RMS meters to make sure our respective microphones are tuned properly and that the audio isn&amp;rsquo;t peaking.&lt;/li&gt;
&lt;li&gt;Then my co-host&amp;rsquo;s audio is routed to my headphones (Internal Speakers) so that I can hear her.&lt;/li&gt;
&lt;li&gt;The combined audio with both my and my co-host&amp;rsquo;s voice is then saved to a single 256 kbps MP3 file. This final file is the backup audio file that I can use to help with synchronization.&lt;/li&gt;
&lt;li&gt;The co-host then sends me her locally recorded audio file through Google Drive or Dropbox.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The advantage of this approach is that it can be adapted and modified in a variety of ways including a combination of in-person and remote guests (the web platforms can only really do remote guests). For example, if you have an in-person guest you can record both in-person audio streams and send it through a loopback device so that the remote person can hear it. &amp;ldquo;Multi-ender&amp;rdquo; podcasts are starightforward because everyone just records their audio separately and sends me the resulting audio file. I still have the combined recording as a backup just in case.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Editing Podcasts with Logic Pro X</title>
      <link>https://simplystatistics.org/2017/09/18/editing-podcasts-logic-pro-x/</link>
      <pubDate>Mon, 18 Sep 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/09/18/editing-podcasts-logic-pro-x/</guid>
      <description>

&lt;p&gt;I thought I&amp;rsquo;d write a brief description of how I edit podcasts using Logic Pro X because when I was first getting into podcasts, I didn&amp;rsquo;t find a lot of useful stuff out there. A lot of it was YouTube videos of advanced editing or very basic stuff. I don&amp;rsquo;t consider myself a sound expert in any way, but I wanted a good workflow that would produce decent quality stuff. When I first started &lt;a href=&#34;http://nssdeviations.com&#34;&gt;Not So Standard Deviations&lt;/a&gt; with &lt;a href=&#34;https://twitter.com/hspter/&#34;&gt;Hilary Parker&lt;/a&gt; I actually edited the first few episodes using Final Cut Pro X, a video editor, because that&amp;rsquo;s just what I was familiar with. Eventually, I learned Logic Pro X, which is Apple&amp;rsquo;s digital audio workstation, largely because of &lt;a href=&#34;https://sixcolors.com/post/2015/02/how-i-podcast-editing/&#34;&gt;this post by Jason Snell&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;On with the show. Unfortunately, this is going to be an Apple-heavy post given that Logic Pro X is only available on Macs. Sorry, rest of world!&lt;/p&gt;

&lt;h2 id=&#34;recording-the-episode&#34;&gt;Recording the Episode&lt;/h2&gt;

&lt;p&gt;I assume you&amp;rsquo;ve recorded your podcast and that you have one file for each speaker. In both &lt;a href=&#34;http://effortreport.libsyn.com&#34;&gt;The Effort Report&lt;/a&gt; and Not So Standard Deviations, I record with a co-host. As of this writing, both podcasts are recorded remotely because of geographic constraints. The way we do this is that each co-host records her microphone input locally and then sends me the audio file (I also record my own microphone input). This way, we don&amp;rsquo;t have to worry about any noise going over the Internet connection (and there is a lot sometimes). Unfortunately, there is no way to deal with the connection delays that inevitably come up (more on that later). As a backup, I also record the combined conversation going over the Internet using &lt;a href=&#34;https://rogueamoeba.com/audiohijack/&#34;&gt;Audio Hijack&lt;/a&gt;. Besides being a backup, this recording is also useful for synchronizing the separate tracks, but at the end of the day, I don&amp;rsquo;t actually use it. I&amp;rsquo;ll probable write a separate post on the details of how I record each podcast.&lt;/p&gt;

&lt;h2 id=&#34;starting-the-project&#34;&gt;Starting the Project&lt;/h2&gt;

&lt;p&gt;I start each project in Logic Pro X by selecting the &amp;ldquo;Multi-Track&amp;rdquo; option after clicking File &amp;gt; New from Template&amp;hellip;. This just opens you up in an empty project with a whole bunch of empty tracks setup.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/startup.png&#34; alt=&#34;Empty Project&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Next I import three audio files: One containing just my voice, another containing just my co-host&amp;rsquo;s voice, and another containing our combined conversation. These tracks are then labeled according to the speaker&amp;rsquo;s name. Below is an example from Episode 54 of The Effort Report after importing the audio.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/import.png&#34; alt=&#34;Initial audio file import&#34; /&gt;&lt;/p&gt;

&lt;p&gt;At this point I don&amp;rsquo;t worry about where the audio tracks are placed, I just get them into the project. This is a good time to &lt;strong&gt;save&lt;/strong&gt; your project (and also give it a name).&lt;/p&gt;

&lt;h2 id=&#34;synchronization&#34;&gt;Synchronization&lt;/h2&gt;

&lt;p&gt;The first problem is that the audio tracks are not synchronized. For the most part this is not such a big deal as long as you have a recollection of how the conversation went. But it&amp;rsquo;s easier if you have a recording of the combined (synchronized conversation). Here I can line up my voice in the separate audio file with the combined audio file, and then line up Elizabeth Matsui&amp;rsquo;s voice in her audio file to the same combined audio. It takes a little trial and error, but doesn&amp;rsquo;t take too long.&lt;/p&gt;

&lt;p&gt;Here is a screenshot after I&amp;rsquo;ve synchronized the audio files. You can see that the waveforms nicely line up with each other in the combined audio file.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/synchronized.png&#34; alt=&#34;Synchronized audio tracks&#34; /&gt;&lt;/p&gt;

&lt;p&gt;At this point I usually delete the combined audio track because it&amp;rsquo;s no longer needed (and is of lower quality because it is recorded over the Internet).&lt;/p&gt;

&lt;h2 id=&#34;strip-silence&#34;&gt;Strip Silence&lt;/h2&gt;

&lt;p&gt;Perhaps the key reason I use Logic Pro X for podcast editing (a task for which is not particularly well-suited) is the strip silence feature. What this does is it takes an audio track and just deletes anything that it considers to be silence. What exactly is &amp;ldquo;silence&amp;rdquo; is configurable and you may need to play with it depending on your recording levels. You can run strip silence by first selecting the track in the window so that it is highlighted and then pressing Ctrl-X. You will be presented with this window:&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/stripsilence1.png&#34; alt=&#34;Strip silence default configuration window&#34; /&gt;&lt;/p&gt;

&lt;p&gt;I find the defaults don&amp;rsquo;t work for me, so I modify them slightly. My parameters are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Threshold: 4%&lt;/li&gt;
&lt;li&gt;Minimum Time to accept as Silence: 1.0 sec&lt;/li&gt;
&lt;li&gt;Pre Attack-Time: 0.1 sec&lt;/li&gt;
&lt;li&gt;Post Release-Time: 0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And I leave the &amp;ldquo;Search Zero Crossing&amp;rdquo; box checked. Once you hit &amp;ldquo;OK&amp;rdquo;, the track will look something like this.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/stripsilence2.png&#34; alt=&#34;After strip silence applied&#34; /&gt;&lt;/p&gt;

&lt;p&gt;After doing it again to my track, your track editor window will look something like this.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/stripsilence3.png&#34; alt=&#34;After strip silence applied&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Now you can see that the only thing that remains of each track are the parts where one of us is talking. We are getting there!&lt;/p&gt;

&lt;h2 id=&#34;dealing-with-delay-cross-talk-and-noise&#34;&gt;Dealing with Delay, Cross talk, and Noise&lt;/h2&gt;

&lt;p&gt;At this point you might think we were done, given that the audio has been synchronized. However, there are a few issues left that need to be dealt with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Cross talk&lt;/strong&gt;. Especially on remote connections with a delay (or on recordings with multiple speakers), there will likely be moments when people talk over each other. This is unpleasant to listen to and it&amp;rsquo;s nice to clean up those moments if possible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Connectivity Delay&lt;/strong&gt;. Often with remote recording, there is a delay as a person&amp;rsquo;s voice is relayed by the Internet gnomes over thousands of miles. The fact that there is &lt;em&gt;only&lt;/em&gt; a 1&amp;ndash;3 second delay in a connection between Melbourne and Baltimore is, frankly, a miracle, but it&amp;rsquo;s still annoying to listen to.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Conversational Noise&lt;/strong&gt;. Often in remote conversations, the person &lt;em&gt;not&lt;/em&gt; doing the talking is prone to say &amp;ldquo;Uh uh&amp;rdquo;, or &amp;ldquo;yeah&amp;rdquo;, just to indicate that they&amp;rsquo;re still listening. This stuff is not necessary in the final recording and it&amp;rsquo;s good to clean that up.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The nice thing about all of the problems above is that they are easily dealt with after running strip silence. In partcular, in sections where a single person is just talking, there is nothing to do. So you can just skip over that. For example, in the section below, Elizabeth is speaking for just over a minute uninterrupted.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/monologue.png&#34; alt=&#34;Monologue&#34; /&gt;&lt;/p&gt;

&lt;p&gt;There&amp;rsquo;s nothing to edit here so you can skip to the next section.&lt;/p&gt;

&lt;p&gt;By contrast in the section below, I am speaking and Elizabeth is agreeing with me by saying &amp;ldquo;right&amp;rdquo; and &amp;ldquo;yeah&amp;rdquo;. With strip silence it&amp;rsquo;s easy to recognize this pattern and I can just delete those little blurbs.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/noise.png&#34; alt=&#34;Conversational noise&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Finally, with connectivity delays, there will often be a gap between when one speaker finishes and another responds. In the example below, when I&amp;rsquo;m done speaking, there&amp;rsquo;s about a 2 second delay between when I stop and when Elizabeth responds. Sometimes that&amp;rsquo;s on purpose, but usually it&amp;rsquo;s because of the connectivity delay.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/gap.png&#34; alt=&#34;Connectivity delay&#34; /&gt;&lt;/p&gt;

&lt;p&gt;This can be easily fixed by clicking on Elizabeth&amp;rsquo;s track at that point, hitting Shift-F, which selects everything after that point, and then dragging the whole thing to the left a little bit. The result is below. It&amp;rsquo;s important to use Shift-F in order to preserve synchronization in the rest of the recording!&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/shift.png&#34; alt=&#34;Shifting a track to close a gap&#34; /&gt;&lt;/p&gt;

&lt;p&gt;The nice thing about the strip slience feature is that you only need to navigate to all the points where one speaker stops and another starts. These boundaries are easy to find in the track editor. That doesn&amp;rsquo;t mean that this process isn&amp;rsquo;t tedious, especially in an hour-long episode. But it&amp;rsquo;s faster than it would be otherwise and it makes for a much cleaner recording and a much more listenable episode.&lt;/p&gt;

&lt;p&gt;Lastly, cross talk is usually easy to spot because it looks something like this.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://simplystatistics.org/post/2017-09-18-editing-podcasts-with-logic-pro-x/crosstalk.png&#34; alt=&#34;Cross talk&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Here, both Elizabeth and I are talking at the same time and it looks messy. In these cases I&amp;rsquo;ll listen to what was happening before and after the cross talk and see if I can clean it up. Usually, I just end up deleting the section with cross talk and try to paste together what came before to what comes after. Or if it makes sense, sometimes I can just shift one person&amp;rsquo;s voice over just a little bit so that both speakers&amp;rsquo; points are made, but just not at the same time.&lt;/p&gt;

&lt;h2 id=&#34;exporting&#34;&gt;Exporting&lt;/h2&gt;

&lt;p&gt;After all the editing is done, I export the final episode by bouncing to a file. You can hit Cmd-B to get the bounce menu. Typically I bounce to MP3 at 160 kpbs and I turn Normalize to &amp;ldquo;Off&amp;rdquo;.&lt;/p&gt;

&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;

&lt;p&gt;That&amp;rsquo;s pretty much it for editing. There are a few extra things that I do (like sound compression), but they&amp;rsquo;re not quite as important as getting the editing right. A lot of stuff out there encourages you to use free editors like Audacity or something similar&amp;mdash;and that&amp;rsquo;s a good place to start&amp;mdash;but I think a professional tool like Logic Pro X is essential for dealing with problems like noise, cross talk, and delay, which I think are a feature of every remotely recorded podcast.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Specialization and Communication in Data Science</title>
      <link>https://simplystatistics.org/2017/09/11/specialization-and-communication-in-data-science/</link>
      <pubDate>Mon, 11 Sep 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/09/11/specialization-and-communication-in-data-science/</guid>
      <description>

&lt;p&gt;I have been interested for a while now in how data scientists can better communicate data analysis activities to each other and to people outside the field. I believe that our current methods are inadequate because they have mostly been borrowed from other areas (notably, computer science). Many of those tools are useful, but they were not developed to communicate data analysis concepts specifically and often fall short. I talked about this problem in my &lt;a href=&#34;https://youtu.be/qFtJaq4TlqE&#34;&gt;Dean&amp;rsquo;s Lecture&lt;/a&gt; earlier this year and how the field of data science could benefit from developing its own theories, to simplify communication as other fields have done.&lt;/p&gt;

&lt;p&gt;One thing that I have noticed is that in other fields, the development of those fields can be viewed in part as a trend towards increasing specialization. With people in a field who increasingly specialize in a certain sub-specialty, there is a parallel need for the specialists to communicate and coordinate with each other in order to produce a whole product. Over time, the separation of a field into an collection of specialists drives the development of communication tools that can serve as clearinghouses of mutually agreed upon information. Without adequate tools, the communications overhead involved with adding more people to a project will become too great and the entire enterprise can collapse. This phenomenon is famously described in Fred Brooks&amp;rsquo;s &lt;a href=&#34;https://en.wikipedia.org/wiki/The_Mythical_Man-Month&#34;&gt;&lt;em&gt;The Mythical Man-Month&lt;/em&gt;&lt;/a&gt; as it relates to software engineering projects.&lt;/p&gt;

&lt;p&gt;I thought it might be useful to talk about some of these other areas and how they have overcome increased specialization and the separattion of duties with communications tools. Tracing the history of other fields is instructive as it potentially provides a basis on which we can discuss data analysis. Listeners of &lt;a href=&#34;http://nssdeviations.com&#34;&gt;my podcast with Hilary Parker&lt;/a&gt; know that we regularly have a segment that we refer to as &amp;ldquo;analogy corner&amp;rdquo; and this is the Simply Statistics version of that.&lt;/p&gt;

&lt;h2 id=&#34;specialization-in-other-areas&#34;&gt;Specialization in Other Areas&lt;/h2&gt;

&lt;p&gt;The first example comes from filmmaking and the development of the screenplay. The Script Lab describes &lt;a href=&#34;https://thescriptlab.com/features/screenwriting-101/3147-the-history-of-the-screenplay/&#34;&gt;The History of the Screenplay&lt;/a&gt; and how filmmaking worked before the development of scripts:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When contemplating the history of screenwriting, one cannot divorce the theories of screenwriting from the evolution of film production. The earliest films were often solo projects, from conception to completion. Referred to as the “cameraman system” this was the most primitive of filmmaking. Soon, directors became central to the process, but most movies were filmed with only a vague idea of what the director wanted to shoot. Often crews were kept waiting while the director planned what to film next.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Films were one-person projects and were developed in a more or less linear fashion. It was an inefficient system&amp;mdash;most films today are produced in a highly nonlinear fashion to accommodate actors&amp;rsquo; schedules and various production processes.&lt;/p&gt;

&lt;p&gt;Today, the screenplay serves as a critical communications hub around which many filmmaking departments (costume, makeup, hair, props, sets) can organize their activity. Imagine if representatives of each of these departments had to individually consult with the screenwriter or director about every detail of their work. It would be a nightmare of exponentially growing complexity. With a written document, such as as screenplay, that everyone can agree on as the authority of &amp;ldquo;what is happening in the film&amp;rdquo;, people can get their jobs done without the need of constant back and forth communication.&lt;/p&gt;

&lt;p&gt;The second analogy comes from finance. In finance there was a similar development of specialization as it relates to &lt;a href=&#34;https://en.wikipedia.org/wiki/Limited_liability&#34;&gt;limited liability&lt;/a&gt;. Here, the &amp;ldquo;specialization&amp;rdquo; refers to the separation of the owners of a company from its managers. As a result, there must be a way for managers of the company to communicate to the investors what exactly is going on with the operations of the company. Thus, the development of financial statements, accounting rules, and various publicly available documents that let investors analyze the health of a company. Graham and Dodd&amp;rsquo;s seminal &lt;a href=&#34;https://en.wikipedia.org/wiki/Security_Analysis_(book)&#34;&gt;Security Analysis&lt;/a&gt; is essentially a plea to investors to evaluate companies based on the publicly available data, rather than on common myths and legends about what makes for a good or safe investment. Today, with the separation of owners from managers and the creation of standardized communication formats between the two (e.g. S-1s, 10-Ks, 10-Qs, etc.), we have the basis of the global capital markets system.&lt;/p&gt;

&lt;p&gt;The last analogy comes from western classical music, where there is often a division between the composer of the music and the performer. In more complex symphonic music, you might say there are three roles: the composer, the performer, and the interpreter/conductor. However, in early classical music, such a division didn&amp;rsquo;t exist and composers typically performed their own music, often by themselves. In this setup, there&amp;rsquo;s not much need to write things down, as the music can be stored in and performed from the composer&amp;rsquo;s head. This concept was well-captured in the movie &lt;a href=&#34;https://youtu.be/Ejv2_CkZRHo&#34;&gt;Amadeus&lt;/a&gt; where Mozart describes his opera &lt;em&gt;The Magic Flute&lt;/em&gt; as being &amp;ldquo;up here in my noodle&amp;rdquo; (the rest is just scribbling and bibbling).&lt;/p&gt;

&lt;iframe width=&#34;560&#34; height=&#34;315&#34; src=&#34;https://www.youtube.com/embed/Ejv2_CkZRHo&#34; frameborder=&#34;0&#34; allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;Of course, opera might be the ultimate example from classical music where some sort of communication tool is needed to coordinate between the musicians, singers, and set designers. Thus, for most classical music, we have the score, which specifies what every instrument and signer is doing at any given time. There is a standardized notation that allows others unfamiliar with the composer to quickly grasp what is going on and to assemble the time and resources needed to perform the work.&lt;/p&gt;

&lt;h2 id=&#34;what-about-data-analysis&#34;&gt;What About Data Analysis?&lt;/h2&gt;

&lt;p&gt;In data science today, or really in science, much of what goes on follows the &amp;ldquo;vertically integrated&amp;rdquo; model, where the same person, asks the question, collects the data, and analyzes the data. The need for communication methods doesn&amp;rsquo;t really arise until that work needs to be disseminated to others (including yourself in the future). In large collaborations where communication over analyses needs to be done from the start, my experience has been that even in the best case scenarios, the methodology is ad hoc and difficult to re-create in another project involving different people.&lt;/p&gt;

&lt;p&gt;Most would agree that the software code that actually does the analysis is an important component of communicate what is being done. However, not everyone needs or wants all of the details provided by the code. Perhaps one concept we could steal from music is the distinction between the score and the parts. In a symphony, the conductor needs the full score because they need to know what everyone is doing at all times. But the first violinist only reads the first violin part&amp;mdash;they don&amp;rsquo;t need to read the entire score in order to play a vital part in creating the finished product.&lt;/p&gt;

&lt;p&gt;Developing appropriate communications tools for data science is critical to scaling data analysis so that more people can be involved and to reproducibility/replicability so that more people can understand what is going on in an analysis. Until then, I think we will continue to jam tools from other fields into the data science process, and that is fine. These tools are useful, but I think ultimately are not a perfect fit.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moon Shots Cost More Than You Think</title>
      <link>https://simplystatistics.org/2017/09/07/moon-shots-cost-more-than-you-think/</link>
      <pubDate>Thu, 07 Sep 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/09/07/moon-shots-cost-more-than-you-think/</guid>
      <description>&lt;p&gt;In a deeply reported article, Casey Ross and Ike Swetlitz report that &lt;a href=&#34;https://www.statnews.com/2017/09/05/watson-ibm-cancer/&#34;&gt;IBM&amp;rsquo;s Watson isn&amp;rsquo;t living up to its hype when it comes to cancer care&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The interviews suggest that IBM, in its rush to bolster flagging revenue, unleashed a product without fully assessing the challenges of deploying it in hospitals globally. While it has emphatically marketed Watson for cancer care, IBM hasn’t published any scientific papers demonstrating how the technology affects physicians and patients. As a result, its flaws are getting exposed on the front lines of care by doctors and researchers who say that the system, while promising in some respects, remains undeveloped.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I thought the article was very well-written, covering many angles and getting into the details. I would encourage reading the entire thing.&lt;/p&gt;

&lt;p&gt;While many issues are covered, I bumped on this one quote about the amount of investment (or lack thereof) that IBM is putting into Watson.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[Peter] Greulich said IBM needs to invest more money in Watson and hire more people to make it successful. In the 1960s, he said, IBM spent about 11.5 times its annual earnings to develop its mainframe computer, a line of business that still accounts for much of its profitability today. If it were to make an equivalent investment in Watson, it would need to spend $137 billion. “The only thing it’s spent that much money on is stock buybacks,” Greulich said.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That Watson hasn&amp;rsquo;t cured cancer overnight&amp;mdash;or lived up to its own marketing material&amp;mdash;should come as no surprise. But I wonder if people are nevertheless up to investing in what it would take to find a cure.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve often heard of curing cancer as a &amp;ldquo;moon shot&amp;rdquo;, in reference to the Apollo program to land a man on the moon and return him safely to Earth. But that project cost a lot of money, &lt;a href=&#34;http://www.thespacereview.com/article/1579/1&#34;&gt;about $112 billion in today&amp;rsquo;s dollars&lt;/a&gt;, or about \$11 billion per year over the roughly 10 year span of the project. The National Cancer Institute&amp;rsquo;s annual budget is about $5 billion&amp;mdash;so, it&amp;rsquo;s less. Also, I would argue we know substantially less about human cancer now than we did about physics and space in 1959 (although there was plenty to learn back then too). How much additional money would we need to make up for that lack of base knowledge?&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Deep Dive - Y. Ogata&#39;s Residual Analysis for Point Processes</title>
      <link>https://simplystatistics.org/2017/09/04/deep-dive-ogata/</link>
      <pubDate>Mon, 04 Sep 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/09/04/deep-dive-ogata/</guid>
      <description>

&lt;p&gt;For a long time now&amp;mdash;actually ever since we started the blog&amp;mdash;I&amp;rsquo;ve wanted to do a series of deep dives into specific papers that I thought were great. Clearly, it&amp;rsquo;s taken a bit longer than I expected, but I figure better late than never. Actually, that&amp;rsquo;s become a bit of a &lt;a href=&#34;https://twitter.com/rdpeng/status/900699027108282368&#34;&gt;theme for my work these days&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;One problem I have with much academic writing on the Internet is that I feel like most of it is devoted to (1) promoting one&amp;rsquo;s own work; or (2) identifying weaknesses in others&amp;rsquo; work. Now, there&amp;rsquo;s absolutely nothing wrong with either activity&amp;mdash;both are essential to the functioning of science. But I think there&amp;rsquo;s room for more activity. In particular, I think putting up examples of good work, and &lt;em&gt;explaining why they are good&lt;/em&gt;, is an important part of producing more good work in the community. I hope to make this entry the first in a series, but we&amp;rsquo;ll see if I can sustain it. Seeing as this is a statistics/data science blog most of the papers will be statistically oriented. But I may try to throw in a few biomedical/environmental papers if I can.&lt;/p&gt;

&lt;p&gt;The first paper I want to write about it is one that had a huge influence on me when I was a grad student, many year ago, doing research on point process models. This is Yosihiko Ogata&amp;rsquo;s paper &lt;a href=&#34;http://amstat.tandfonline.com/doi/abs/10.1080/01621459.1988.10478560&#34;&gt;Statistical models for earthquake occurrences and residual analysis for point processes&lt;/a&gt;, originally published in the &lt;em&gt;Journal of the American Statistical Association&lt;/em&gt; in 1988 (there is a &lt;a href=&#34;http://bemlar.ism.ac.jp/zhuang/Refs/Refs/ogata1988.pdf&#34;&gt;pdf here&lt;/a&gt;). I haven&amp;rsquo;t picked up this paper in quite some time as I no longer do research in point process models, but it remains remarkable in my mind. So let&amp;rsquo;s get into it.&lt;/p&gt;

&lt;h2 id=&#34;a-road-map-for-data-analysis&#34;&gt;A Road Map for Data Analysis&lt;/h2&gt;

&lt;p&gt;One immediately important aspect of this paper is that it presents a road map for how to apply point process models to real data, using a formal likelihood-based inference framework. This may sound unremarkable, but in the point process area, there was a lot of focus on (1) theoretical properties of various estimators; and (2) ad hoc fitting of models to data via 2nd-order methods. A lot of the methodologies in point process modeling were translated from time series, which involved a lot of 2nd order correlation methods. Likelihood methods were far less common, in part because they involved substantial computation. For people who are interested in applying point process models to data to make scientific inferences, I think this is still a great paper to read. In fact, I think it&amp;rsquo;s a great paper to read if you&amp;rsquo;re interested in data analysis at all, for any kind of model.&lt;/p&gt;

&lt;h2 id=&#34;scientific-theory&#34;&gt;Scientific Theory&lt;/h2&gt;

&lt;p&gt;Ogata&amp;rsquo;s paper is focused on a theory of earthquakes that posits that there are main shocks followed by aftershocks. After a long decay in aftershock occurrences, there is a period of &amp;ldquo;quiescence&amp;rdquo;, after which there are foreshocks, followed by another main shock. The problem is, of course, that nature is not kind enough to label all these shocks as &amp;ldquo;main shock&amp;rdquo;, &amp;ldquo;aftershock&amp;rdquo; and &amp;ldquo;foreshock&amp;rdquo;. We need a model to help us infer which is which. The primary goal lying in the background is predicting the next main shock.&lt;/p&gt;

&lt;p&gt;Ogata reviews some of the fundmental theory for earthquakes. There&amp;rsquo;s the famous Gutenberg-Richter law (equation 2) which explains the distribution of earthquake magnitudes, and the modified Omori law (equation 1) which explains the frequency of aftershocks. Given these two laws, Ogata puts them together in an &amp;ldquo;epidemic-type&amp;rdquo; conditional intensity model (equation 10). This model can be thought of as describing the instantaneous rate at which earthquakes occur at any given time. If the model is correct, we can predict the rate at which an earthquake will occur at any time (along with it magnitude), given the entire history of earthquakes to date. These kinds of models would later be described as epidemic-type aftershock sequence, or ETAS, models.&lt;/p&gt;

&lt;p&gt;The bottom line here is that the ultimate model presented in equation 17 of the paper is rooted in formally hypothesized theories of how earthquakes work along with interpretable parameters. These theories may or may not be correct, but they are presented and modeled in a manner where we can determine whether evidence in the data favor them or not. In other words, we have a good chance of knowing whether the theory/model fits the data or not. This aspect is key&amp;mdash;what&amp;rsquo;s important is not whether your model is correct or not, but whether you &lt;em&gt;know&lt;/em&gt; if your model is correct or not. Not every field is so lucky to have parsimoniously specified physical models to go on. But the truth is, if the models are incorrect, or do not fit the data, then the fact that they are parsimonious is not that helpful. Nevertheless, it&amp;rsquo;s worth trying to develop a model that we can understand, and which will teach us something about the underlying phenomena, in this case how earthquakes occur.&lt;/p&gt;

&lt;h2 id=&#34;the-data&#34;&gt;The Data&lt;/h2&gt;

&lt;p&gt;Before getting into how to fit the model to data, Ogata presents the data&amp;mdash;literally. This may seem quaint in today&amp;rsquo;s big data era, but Figure 1 and Table 1 show all the data. Table 1 takes 2 pages just to print out (there was no supplementary material back then). But there&amp;rsquo;s something very visceral and satisfying about being able to flip through the data like that. I feel like I notice details that I never would have noticed in a single plot or a table of summary statistics. The dataset is 483 earthquakes with magnitude 6 or more from 1885&amp;ndash;1980.&lt;/p&gt;

&lt;p&gt;Figures 2 and 3 show more summaries of the data. Figure 3 in particular suggests a reasonable adherence to the Gutenberg-Richter law of magnitudes (i.e. straight line on a log-plot indicating an exponential distribution). Figures 4, 5, and 6 are designed to show whether the earthquake process is purely random (Poisson) or exhibits some clustering behavior. Suffice it to say that all plots show that there is a lot of clustering (non-Poisson). Under the Poisson assumption, Figure 4 should be a straight line, Figure 5 would follow the solid line, and Figure 6 would just be a horizontal scatter (without the little spike up near zero).&lt;/p&gt;

&lt;p&gt;This section is short, but Ogata lets the data do some talking. He couples the literal presentation of the data with some summary statistics, some of which are highly specific to point process data. But ultimately, he takes a light touch to the summarization and tries to present as many angles as feasible/useful to the reader. This is one of my favorite aspects of this paper&amp;mdash;the careful curation of how the data are presented so that you might best assess how the data eventually do or do not fit the hypothesized models.&lt;/p&gt;

&lt;h2 id=&#34;the-modeling&#34;&gt;The Modeling&lt;/h2&gt;

&lt;p&gt;Section 3.2 shows the log-likelihood of the model and how we can compare models using AIC. There&amp;rsquo;s nothing super novel here, except that maximizing the likelihood must have been a pain in the butt at the time.&lt;/p&gt;

&lt;h2 id=&#34;residual-analysis&#34;&gt;Residual Analysis&lt;/h2&gt;

&lt;p&gt;Section 3.3 is the heart and soul of this paper, in my view. Ogata explains that while AIC can be useful for comparing a set of models, it&amp;rsquo;s not useful for determining whether there is a better model &lt;em&gt;outside&lt;/em&gt; that set. Here, we need the point process equivalent of residual analysis for regression models. The problem is that at the time there really wasn&amp;rsquo;t a settled understanding of what residual analysis was for point process models (or even what constituted a &amp;ldquo;residual&amp;rdquo;).&lt;/p&gt;

&lt;p&gt;Ogata uses a theoretical result of Papangelou that says that you can shift the time points of the earthquake occurrences in a 1-to-1 manner dictated by the model so that the rescaled time points follow a Poisson process with rate 1. A Poisson process with constant rate 1 is the &amp;ldquo;white noise&amp;rdquo; of point process modeling. So, in other words, if your model captures the main features of the data, then the rescaled time points, which we will call the &lt;em&gt;residuals&lt;/em&gt;, should essentially be noise. The nice thing about this approach is that there are already a bunch of tests designed to determine if a point process is Poisson or not. So we can apply that battery of tests to the residuals to see if we are missing anything. Furthermore, if we detect anything unusual in the residuals, we can easily map them back to the original data to see what was going on.&lt;/p&gt;

&lt;p&gt;Figures 9-15 look at the residuals carefully and most indicate that the residuals look Poisson. However, Figure 13(a) suggests a violation of the variance assumption, so Figure 15(3a) is used to diagnose that problem. It seems there was an unusual &amp;ldquo;swarm&amp;rdquo; of earthquakes in 1938&amp;mdash;when these are removed, the residuals appear Poisson. Of course, the model will need to be re-examined in light of its inability to model this &amp;ldquo;swarm&amp;rdquo;, but the point is that these residual methods allowed us to easily identify this &amp;ldquo;outlying&amp;rdquo; group of earthquakes.&lt;/p&gt;

&lt;p&gt;Interestingly, the way that Ogata structures the article sets us up for this moment. In Section 3.1 he shows all these plots of the raw data and concludes that the data are highly clustered and definitely not Poisson. Later, in the residual analysis section, he can show us the exact same series of plots and say, &amp;ldquo;Look, they&amp;rsquo;re Poisson now!&amp;rdquo; Or at least, almost Poisson.&lt;/p&gt;

&lt;p&gt;In this section, Ogata develops an entirely new tool for assessing point process models and shows how it can be used to identify interesting aspects of the data that are not captured by existing theories or models, even after evaluating a set of models with AIC. The thoughtful treatment of residuals and the visualization of how they do or do not adhere to the Poisson assumption is important for allowing the reader to evaluate for themselves the adequacy of the model.&lt;/p&gt;

&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;

&lt;p&gt;The remainder of the paper is an assessment of the theory of &amp;ldquo;quiescence&amp;rdquo;, which I will skip as this entry is long enough. In summary, I think this is a great applied statistics and data analysis paper. Some of the things that stand out to me are&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There is a strong reliance on the theory of earthquakes, and Ogata constantly references those theories in each section as he evaluates the data. In other words, the point of the analysis is to develop &lt;strong&gt;evidence for or against the theory&lt;/strong&gt;. Note that there&amp;rsquo;s very little emphasis on formal hypothesis testing. Nevertheless, Ogata puts the reader in a position where they can judge for themselves how well the models fit the data.&lt;/li&gt;
&lt;li&gt;Ogata goes through great lengths to present the data, plainly yet informatively. This is not a data dump. I think the reason he can present the data in this informative manner is again because he is guided by the theory and therefore has a prioritization of what is or is not important to show.&lt;/li&gt;
&lt;li&gt;In a way, Ogata buries the lede in this paper. He waits until Section 3.3 to introduce the idea of residual analysis for point process models, which in reality was a totally new applied statistics method. He could have written an entire paper about that approach. But ultimately, I think in his mind this paper was about earthquakes and earthquake models. Statisticians routinely have to decide whether a paper is about the method or the application&amp;mdash;there is no right or wrong answer. Regardless, Ogata didn&amp;rsquo;t let the novelty of the method get in the way of answering the primary question.&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Data Science on a Chromebook</title>
      <link>https://simplystatistics.org/2017/08/29/data-science-on-a-chromebook/</link>
      <pubDate>Tue, 29 Aug 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/08/29/data-science-on-a-chromebook/</guid>
      <description>&lt;p&gt;About nine months ago &lt;a href=&#34;https://simplystatistics.org/2016/11/08/chromebook-part2/&#34;&gt;I announced&lt;/a&gt; that I was attempting a Chromebook experiment for the 2nd time. At first I thought it was going to be a short term experiment just to see if it was possible to function with only a Chromebook. But in an interesting twist I got used to it and have been working exclusively on a Chromebook for the last few months since the experiment started.&lt;/p&gt;

&lt;p&gt;I set myself the following requirements:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I could only use Chrome OS - no installing/booting to Linux&lt;/li&gt;
&lt;li&gt;I couldn&amp;rsquo;t use another computer for any task&lt;/li&gt;
&lt;li&gt;I had to be &amp;ldquo;fully cloudy&amp;rdquo; in the sense that I didn&amp;rsquo;t run any additional hardware&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One of the reasons I did this was I wanted to see if it was possible to be a functioning/day to day data scientist without using an expensive laptop. This is part of a broader experiment I&amp;rsquo;m just beginning on how to &lt;a href=&#34;https://peerj.com/preprints/3195/&#34;&gt;democratize data science education&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;m not going to go into extreme detail on how I set everything up here (more on that in a second) but I thought I&amp;rsquo;d describe my Chromebook set up that I&amp;rsquo;ve been using for the last couple of months.&lt;/p&gt;

&lt;p&gt;I have been using two &lt;a href=&#34;https://www.amazon.com/dp/B01LZ6XKS6&#34;&gt;Samsung Chromebook Plus&lt;/a&gt; computers, one of which I keep at home and one which I keep at work. One of the best parts about the fully cloudy/Chrome OS requirement is this means that from the user perspective everything is always in sync. I log off the computer at home, come to work, log on and its like I&amp;rsquo;m on the same computer.&lt;/p&gt;

&lt;p&gt;I thought I&amp;rsquo;d just go through at a high level the software I&amp;rsquo;m using to keep everything running.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Google Slides for presentations&lt;/strong&gt; - &lt;em&gt;(Cost:free)&lt;/em&gt; For the most part this has been really easy and is a smooth transition from Powerpoint. One thing I&amp;rsquo;ve found really useful is the laser pointer mode of the Chromebook plus for highlighting things on screen when presenting. I have also found that since they are using USB-C adapters I can participate in &lt;a href=&#34;https://simplystatistics.org/2011/09/23/dongle-communism/&#34;&gt;dongle communism&lt;/a&gt; with Apple users. I had to figure out the display mirroring menus in Chrome OS but after that this was easy.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Docs/Paperpile for writing&lt;/strong&gt; - &lt;em&gt;(Cost:free)&lt;/em&gt; This works great and has been my work flow as I describe &lt;a href=&#34;https://leanpub.com/modernscientist&#34;&gt;in my book&lt;/a&gt; since before the Chromebook experiment started.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DocHub for signing things&lt;/strong&gt; - &lt;em&gt;(Cost:\$4.99/month/billed yearly)&lt;/em&gt; Often I have to &amp;ldquo;sign&amp;rdquo; a document by adding my electronic signature. I used the note feature to create a jpeg of my signature. I can then upload the file to Docub&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Overleaf for writing latex&lt;/strong&gt; - &lt;em&gt;(Cost:free or \$10/month/billed yearly)&lt;/em&gt;  This is not necessary for all data scientists, but it has some nice features, including when I could &lt;a href=&#34;https://twitter.com/jtleek/status/856297030582497281&#34;&gt;live write a grant&lt;/a&gt; and people could watch.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gmail for email&lt;/strong&gt; - &lt;em&gt;(Cost:free)&lt;/em&gt; this one is pretty obvious.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Sheets for data&lt;/strong&gt; - &lt;em&gt;(Cost:free)&lt;/em&gt; this is again a choice I had been making frequently before I moved to Chromebooks. The &lt;a href=&#34;https://github.com/jennybc/googlesheets&#34;&gt;googlesheets&lt;/a&gt; R package lets you do &lt;a href=&#34;https://simplystatistics.org/2016/08/26/googlesheets/&#34;&gt;all sorts of cool things&lt;/a&gt; with google sheets.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Digital Ocean for Rstudio&lt;/strong&gt; - _(Cost: \$20/mo)__ I set up an Rstudio server and run it remotely on Digital Ocean. I currently use the \$20/month option but sometimes scale it up or down as needed. One great thing about the dockerized version of the software is that I can pause the instance, scale up the compute infrastructre, restart and everything is just as I left it but with more computational horsepower. I can then use that for a few hours as needed and scale back down. I use the terminal in Rstudio for most of my management of code/etc. on Github.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Hangouts for video conferencing&lt;/strong&gt; - &lt;em&gt;(Cost:free)&lt;/em&gt; this is the default but honestly I wish I had a better option. I often find it complicated and laggy to work with, but still mostly better than Skype. Would be open to suggestions on that front.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Slack for communication&lt;/strong&gt; &lt;em&gt;(Cost: \$6.67/month)&lt;/em&gt; a variety of different teams here at JHU and around the country use Slack for group communication. I use it through the web browser, although the Chromebook Plus allows you to install Android apps.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Google Music for listening to music/podcasts&lt;/strong&gt; &lt;em&gt;(Cost:\$10/month)&lt;/em&gt; This is an unnecesary expense but I like having something to listen to while I work.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tweetdeck for twitter&lt;/strong&gt; - &lt;em&gt;(Cost:free)&lt;/em&gt; I have a couple of accounts I manage and I do this through the web browser. For the most part this works great.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So my total monthly cost comes to something like \$35 a month for various cloud services.
At first doing this was sort of like writing a Haiku. I could still write, but the constraints made me think hard about how I did things. But after a while I have gotten so used to the form that it feels natural and I don&amp;rsquo;t miss my (really expensive) Apple products anymore.&lt;/p&gt;

&lt;p&gt;The biggest headaches have been:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Wifi connectivity issues&lt;/strong&gt; - this isn&amp;rsquo;t as big as I thought it would be, most places have wifi where I work and it is mostly ok. When I have trouble I stream from my phone.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Wifi blocking my DO server&lt;/strong&gt; - this one has been a headache. I think if I just got a custom domain for the webserver and didn&amp;rsquo;t just use the IP address I could avoid it. When I have trouble I stream from my phone.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;httr and Rstudio on a server&lt;/strong&gt; - when I need to authenticate for websites I have run into trouble, but if I set &lt;code&gt;httr_oob_default==TRUE&lt;/code&gt; (&lt;a href=&#34;https://support.rstudio.com/hc/en-us/articles/217952868-Generating-OAuth-tokens-from-a-server&#34;&gt;documentation here&lt;/a&gt;) then the Oauth process generates a code I can paste into my server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Beyond that it has actually been pretty straightforward to do almost anything I need. Stay tuned because this experiment has inspired a broader effort we are doing with Chromebooks here at the &lt;a href=&#34;http://jhudatascience.org/&#34;&gt;JHU Data Science Lab&lt;/a&gt;. If you want to hear about this effort as it gets underway, sign up for &lt;a href=&#34;http://jhudatascience.us16.list-manage.com/subscribe?u=5ea551600fcdf84334e5aa6b0&amp;amp;id=26c0b7221a&#34;&gt;our weekly newsletter&lt;/a&gt; and you&amp;rsquo;ll be the first to hear new announcements.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Simple Queue Package for R</title>
      <link>https://simplystatistics.org/2017/08/28/simple-queue-package-for-r/</link>
      <pubDate>Mon, 28 Aug 2017 00:00:00 +0000</pubDate>
      
      <guid>https://simplystatistics.org/2017/08/28/simple-queue-package-for-r/</guid>
      <description>&lt;p&gt;I recently coded up a simple package that implements a file-based queue abstract data type. This package was needed for a different package that I’m working on involving parallel processing (more on that in the near future). Actually, this othe package is &lt;a href=&#34;https://twitter.com/rdpeng/status/900699027108282368&#34;&gt;a project that I started almost nine years ago&lt;/a&gt; but was never able to get off the ground. I tried to implement a queue interface in the &lt;a href=&#34;https://github.com/rdpeng/filehash&#34;&gt;filehash&lt;/a&gt; package but it never served the purpose that I needed.&lt;/p&gt;
&lt;p&gt;Recently, I came across Rich FitzJohn’s &lt;a href=&#34;https://github.com/richfitz/thor&#34;&gt;thor&lt;/a&gt; package, which provides an interface to the &lt;a href=&#34;https://github.com/LMDB/lmdb&#34;&gt;LMDB&lt;/a&gt; database, which is a light-weight key-value style database. When I saw this, I realized that it was exactly what I needed because it supports transactions with blocking. So if multiple processes attempt to write to the database at once, it will block the other processes untill the currently writing one is finished, and then move on to the next one.&lt;/p&gt;
&lt;p&gt;The code for the &lt;code&gt;queue&lt;/code&gt; package is &lt;a href=&#34;https://github.com/rdpeng/queue&#34;&gt;available on GitHub&lt;/a&gt; and can be installed in the usual way via &lt;code&gt;devtools&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;devtools::install_github(&amp;quot;rdpeng/queue&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The package just involves four functions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;enqueue()&lt;/code&gt;: add an element to the queue&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dequeue()&lt;/code&gt;: remove an element from the queue (and return it)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;peek()&lt;/code&gt;: return the next element of the queue (but don’t remove it)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;is_empty()&lt;/code&gt;: is the queue empty:&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are also functions&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;create_Q&lt;/code&gt;: create the queue and associated files on the disk&lt;/li&gt;
&lt;li&gt;&lt;code&gt;init_Q&lt;/code&gt;: initialize a queue that has been previously created&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Everything is implemented as S3 classes and methods. Queues are just sub-directories on the filesystem that contain some metadata for the underlying LMDB database.&lt;/p&gt;
&lt;p&gt;You can create a queue with the &lt;code&gt;create_Q()&lt;/code&gt; function.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(queue)
x &amp;lt;- create_Q(&amp;quot;testq&amp;quot;)
is_empty(x)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can then add arbitrary objects to the queue with &lt;code&gt;enqueue()&lt;/code&gt;. Behind the scenes, objects are &lt;code&gt;serialize()&lt;/code&gt;-ed.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;enqueue(x, &amp;quot;hello&amp;quot;)
enqueue(x, 1)
peek(x)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;hello&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Finally, you can remove an object from the front of the queue with &lt;code&gt;dequeue()&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;obj &amp;lt;- dequeue(x)
obj&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;hello&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;peek(x)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The implementation is pretty basic right now but the guts of it are there. I don’t plan to add any more features, but hopefully will round out the documentation and add some tests.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>