Publications by Yu-Sung Su
Shading overlapping area of curves in R
I was trying to plot figure in R like the one below, which is basically the veto player model of Tsebelis. Based on my knowledge of R now, I encountered 2 major problems:I don’t know if there is a function that can draw archs, or at least partial curves from circles.I don’t know if there is a good way of shading the overlap area i...
812 sym
R package: codetools
Since the release of R_2.6.0, R package developers were advised to use the “codetools” package to check potential bugs. However, as I am not familiar with computer language, I found the warning messages a bit confusing. For example:> checkUsage(glm.fit): no visible binding for global variable ‘n’I don’t understand what it re...
812 sym
A wraper function to convert coda files into a BUGS object
I used to fit Bayesian model using WinBUGS via R a lot. But now I am more and more prone to run models on OpenBUGS directly. I have document the reason why I like OpenBUGS and wrote a auto OpenBUGS function here. In short, I like to be able to know what’s going on why my MCMC is running. However, exporting MCMC results from OpenBUGS...
808 sym
Ordered logistic model with varying intercepts (random effects)
I coauthor a paper with Ozan, a friend who I know when I was TAing Bayesian Methods in ICPSR. The paper tries to see if the 9/11 has any effect on American’s attitudes on Muslim. We have dataset from different years: 2 from pre-9/11 periods and 2 from post-9/11 periods. The outcome variable y is ordered categorical in that:1: very u...
812 sym
An Example for Just Another Gibbs Sampler (JAGS)
JAGS is a cross platform BUGS. Because it runs in a command mode, it is somewhat faster than other BUGS. However, I found it is a bit tacky to use it as a Windows/PC user. I found the manual very useful but some of the language is a bit uncommon to regular users. For instance, compile [,nthins( < n > )]. Do we need brackets here or do...
813 sym
speed issue in R computing: apply() vs a loop
In R, apply() is NOT faster than a loop!!I don’t know where I pick up this perception about apply() being faster than a loop in R. For a long time, I always think that apply() runs a function (for example, mean()) on a data structure (row or column) in a single shot. So take the mean of each row in the same time. And a loop does ...
813 sym
How to make SVN work on R-Forge and your local driver?
R has a new platform-R-Forge-that enables developers and users to communicate with each other. More importantly, it is a version control platform that enables different developers to keep track on what others have been working on. So that ideally, if developer A revises some code in a package, developer B will notice the change and ...
813 sym
R2jags: A Package for Running jags from R
I have wrote about my experience with jags here. Martyn Plummer has updated jags recently and now jags can get as he claimed. Jags is fast and its source code is more manipulable (It’s written in C++).I and Masanao wrote a package, R2jags, for running jags from R. To be sure, Martyn Plummer has wrote a package, rjags, for this pu...
812 sym
Speed up R! Make R Run Faster!
This is another example of why defaults matter a lot. I got an email of Evan Cooch forward by Matt, saying that there exists a trick to speed up R matrix caculation. He found that if we replace the default Rblas.dll in R with the proper one. It can boost R’s speed in doing matrix caculation. The file is here (This file only works...
812 sym
Smart programming saves computing times
Recently, I tried to learn C language so that I can write a C addon for some R rountines to redress the speed issue in R. In my last post here, I have documented how a simple trick can speed up R. Nonetheless, I had an example which shows that smart programming can really save computing times.I was trying to calculate a distant mat...
813 sym