Wednesday, May 13, 2015

The Bayesian New Statistics: Two Historical Trends Converge

If not null hypothesis significance testing, then what? If not p values, then confidence intervals? If not NHST, then Bayes factors? Both? Neither? These issues are addressed in a new manuscript titled The Bayesian New Statistics: Two Historical Trends Converge.

Two trends in data analysis converge on Bayesian estimation. (NHST = null hypothesis significance testing. MLE = maximum likelihood estimate.)

Abstract: There have been two historical shifts in the practice of data analysis. One shift is from hypothesis testing to estimation with uncertainty and meta-analysis, which among frequentists in psychology has recently been dubbed “the New Statistics” (Cumming, 2014). A second shift is from frequentist methods to Bayesian methods. We explain and applaud both of these shifts. Our main goal in this article is to explain how Bayesian methods achieve the goals of the New Statistics better than frequentist methods. The two historical trends converge in Bayesian methods for estimation with uncertainty and meta-analysis.

Excerpt: Our main goal in this article is to explain how Bayesian methods achieve the goals of the New Statistics better than frequentist methods. We will recapitulate the goals of the New Statistics and the frequentist methods for addressing them, and we will describe Bayesian methods for achieving those goals. We will cover hypothesis testing, estimation of magnitude (e.g., of effect size), assessment of uncertainty (with confidence intervals or posterior distributions), meta-analysis, and power analysis. We hope to convince you that Bayesian approaches to all these goals are more direct, more intuitive, and more informative than frequentist approaches. We believe that the goals of the New Statistics, including meta-analytic thinking engendered by an estimation approach, are better realized by Bayesian methods.

The manuscript is available at this link (via SSRN).

Thursday, May 7, 2015

Updated DBDA2E programs for number of MCMC chains and parallel chains in runjags

The DBDA2E programs have been updated so they deal better with parallel chains in runjags and the number of cores available on your computer. The new programs are available as this zip folder also linked at the book's software page. There are 29 modified programs. They check for the number of cores on the computer and set the number of chains and the runjags method appropriately (I hope!).

Thanks go to reader Christoph Schmid, affiliated with Universit├Ąt Regensburg, for notifying me of an error that instigated me to modify the programs. 

AND there is a new version of runjags available! It has many new features.

Saturday, May 2, 2015

Graphics Window for MacOS and RStudio Server

It's been a recurring headache to get graphics windows to open seamlessly in MacOS and Windows, running RStudio locally and RStudio Server. A solution has been proposed by Professor David Zeitler. He has modified the openGraph function in the DBDA2E-utilities.R script. If you use a Mac, or you use RStudio Server, please check it out and let us know whether or not it works for you by entering a comment at the bottom of this post. To make the change, just open DBDA2E-utilities.R in an editing window. Comment out the current definition of openGraph (don't delete it, in case you need to recover the original version). Insert the new function definition listed below, and be sure to save the edited version. Then source the script and try using openGraph or any existing script that calls it.

Update: See the comments for updated versions!

openGraph = function( width=7 , height=7 , mag=1.0 , ... ) {
  if( class( try(RStudioGD(),silent=TRUE) ) == "try-error" ) {
    # Not in RStudio, use graphic windows
    if ( .Platform$OS.type != "windows" ) { # Mac OS, Linux
      if ( .Platform$GUI != "AQUA" ) { # Linux
        tryInfo = try( X11( width=width*mag , height=height*mag , 
                            type="cairo" , ... ) )
        if ( class(tryInfo)=="try-error" ) {
          lineInput = readline("WARNING: Previous graphics windows will be closed because of too many open windows.\nTO CONTINUE, PRESS <ENTER> IN R CONSOLE.\n")
          graphics.off() 
          X11( width=width*mag , height=height*mag , type="cairo" , ... )
        }
      } else {
        # Mac OS - use quartz device
        tryInfo = try( quartz(width=width*mag , height=height*mag ,
                              ... ) )
        if ( class(tryInfo)=="try-error") {
          if ( class(tryInfo)=="try-error" ) {
            lineInput = readline("WARNING: Previous graphics windows will be closed because of too many open windows.\nTO CONTINUE, PRESS <ENTER> IN R CONSOLE.\n")
            graphics.off() 
            quartz( width=width*mag , height=height*mag , ... )
          } 
        }
      }
    } else { # Windows OS
      tryInfo = try( windows( width=width*mag , height=height*mag , ... ) )
      if ( class(tryInfo)=="try-error" ) {
        lineInput = readline("WARNING: Previous graphics windows will be closed because of too many open windows.\nTO CONTINUE, PRESS <ENTER> IN R CONSOLE.\n")
        graphics.off() 
        windows( width=width*mag , height=height*mag , ... )    
      }
    }
  }
}


Thank you, David!