This code requires the R library rpsychi. The Python code will also need rpy2 and SciPy. I wrote the Python code while Nick Brown (@sTeamTraen) wrote the R code.