## Monday, November 12, 2012

### Video: Bayesian Methods Interpret Data Better

Another 15 minute talk, (to be) presented at the Psychonomic Society Special Session on Improving the Quality of Psychological Science. This talk briefly discusses sequential testing, the goal of achieving precision (as opposed to rejecting a null value), and multiple comparisons. The video can be found here.

1. Hi John,

This is a fantastic video! The baseball example is directly applicable to a problem that I have currently. Would like to see more of these. One general suggestion for future videos: would you be able to post your (R)JAGS code, and/or point to the chapters in your book that best describe the topics?

Very very nice. I appreciate this supplemental information to your text and look forward to the second edition.

Best regards,
Eric

2. Ah, your code is posted in a previous post! Sorry about that. My compliments on the video stand :-)

3. Thanks very much for the kind remarks about the video. Greatly appreciated.

and the links it has to a previous blog post.

Thanks again.

4. Hi John,

Excellent video, and I think the baseball example will prove to be a great motivator and learning tool for me.

In case you or others are interested, I'm including some R code that will create a data.frame of 2012 batting stats for all MLB players (so you don't have to copy/paste from ESPN):

require(XML)

#read in the html page and subset to just player data
#note the MLB could be substituted for NL or AL to get a single league of data
baseball.tbl<-baseball$players_standard_batting baseball.tbl<-baseball.tbl[!(baseball.tbl$Rk %in% c("Rk","")),]

#These variables make the data compatible with the rest of Kruschke's code
baseball.tbl$AB<-as.numeric(as.character(baseball.tbl$AB ))
baseball.tbl$H<-as.numeric(as.character(baseball.tbl$H ))
baseball.tbl$AVG<-as.numeric(as.character(baseball.tbl$BA))
colnames(baseball.tbl)[2]<-"PLAYER"

#Subset to people with at-bats (currently includes those who never came to the plate, or those with PA but not AB)
baseball.ab<-baseball.tbl[as.numeric(as.character(baseball.tbl$AB)) > 0 & is.finite(as.numeric(as.character(baseball.tbl$AB))),]

#remove doppelgangers for traded players--just keep the players' TOTAL line
baseball.ab.total<-baseball.ab[!(baseball.ab$PLAYER %in% baseball.ab[duplicated(baseball.ab$PLAYER),"PLAYER"]) | baseball.ab$Tm=="TOT",] #alternately, only delete the players' TOTAL lines, and keep their partial seasons #baseball.ab.nototal<-baseball.ab[baseball.ab$Tm !="TOT",]

#make it compatible with Kruschke's script
dataFrame<-baseball.ab.total

5. Dear Matthew:

Thank you for the very useful code! Greatly appreciated!

--John

6. Great video it helped me complement the book reading.
Please make more of these, recorded short capsules on those key concepts where people usually get stuck.
Thank you again for your great contributions.
Luis Enrique Romero
Houston Texas

7. This comment has been removed by a blog administrator.