Author Archives: Jason

The Latent Path Model for Social Networks: Polmeth 2013 poster

I was lucky to have the chance to attend Polmeth 2013 at the University of Virgina this July. In addition to presenting a paper with Luke Keele, I also presented a poster related to my dissertation project, titled “The Latent … Continue reading

Posted in Network analysis, Research | Leave a comment

Pearson’s r: Not a good measure of electoral persistence

Pearson’s product-moment correlation, \(r\), is an incredibly useful tool for getting some idea about how two variables are (linearly) related. But there are times when using Pearson’s \(r\) is not appropriate and, even if linearity and all other assumptions hold, … Continue reading

Posted in Data analysis, Graphics, Poland, Political parties, R | 2 Comments

R Tip: Avoid using T and F as synonyms for TRUE and FALSE

By default when you start R, T and F are defined as TRUE and FALSE. When I review other people’s code, I often see functions defined with arguments set to these values by default. This is a very bad idea. … Continue reading

Posted in Hacking, R, Tip | 1 Comment

Closures in R: A useful abstraction

People who have been using R for any length of time have probably become accustomed to passing functions as arguments to other functions. From my experience, however, people are much less likely to return functions from their own custom code. … Continue reading

Posted in R | 1 Comment

Filtering a list with the Filter higher-order function

Last week markbulling over at Drunks & Lampposts posted a method of using sapply to filter a list by a predicate. Today the @RLangTip tip of the day was to use sapply similarly. This made makes me wonder if R‘s … Continue reading

Posted in R | Leave a comment

Announcing boolean3 (beta)

After entirely too long, I am happy to announce the beta release of boolean3, an R package for modeling causal complexity. The package can be downloaded at the following links: Unix/Linux: boolean3_3.0.20.tar.gz Windows: (Please let me know if you have any … Continue reading

Posted in Code, R | 1 Comment

Welford’s method for calculating the sample variance: An implementation in Scheme

John Cook has three entries up on his blog discussing the pitfalls of calculating the sample variance using the mathematical textbook definitions. He provides a Monte Carlo comparison of methods here, and a theoretical discussion here. He also provides a … Continue reading

Posted in Code, Data analysis, Scheme | Leave a comment

Three free books for better programming in R (and any other language)

Like many users and producers of R packages, I have never had any formal training in computer science. I’ve come to to the conclusion that this is a serious omission in a professional researcher’s training. Computer scientists and professional hackers … Continue reading

Posted in Hacking, R | 4 Comments

The performance cost of a for-loop, and some alternatives

I’ve recently been spending a lot of time running various simulations in R. Because I often use snow to perform simulations across several computers/cores, results typically come back in the form of a list object. Summarizing the results from a list … Continue reading

Posted in R | 10 Comments

Emacs-fu: The place to go for useful Emacs tips

After 5 years or so of using Emacs almost exclusively as my “text editor”, somehow I just ran across Emacs-fu for the first time today. It’s an incredibly useful site with numerous Emacs tips and tricks. If you are an Emacs user, you should check the … Continue reading

Posted in Emacs, Hacking | Leave a comment