Based on RStan Getting Started R packages Assuming you have the most up to date version of R, the following packages need to be installed. This assumes you have the c2d4u PPA available. See here for more information. sudo apt-get install r-cran-...

Based on RStan Getting Started R packages Assuming you have the most up to date version of R, the following packages need to be installed. This assumes you have the c2d4u PPA available. See here for more information. sudo apt-get install r-cran-...

Problem When a correlation or covariance matrix is not positive definite (i.e., in instances when some or all eigenvalues are negative), a cholesky decomposition cannot be performed. Sometimes, these eigenvalues are very small negative numbers and occ...

Have you ever wanted an easy way to generate continuous color pallettes for a discrete factor? I came across a question over on Stackoverflow about how add color to a ggplot figure. I often find myself with lot’s of categories that are discrete when I want a continuous color plot. This can be achieved by writing a quick...

When I learned about principal component analysis (PCA), I thought it would be really useful in big data analysis, but that's not true if you want to do prediction. I tried PCA in my first competition at kaggle, but it delivered bad results. This post illustrates how PCA can pollute good predictors.When I started examining this problem,...

Here is the list of courses I wish to teach next year at Chiang Mai School of Economics, not so sure about the demand there! Undergraduate (B.Econ.) ECON 304: Economics Statistics (with R) ECON 408: Research Design in Economics ECON 417: Managerial Economics ECON 419: Economic Theory and Entrepreneurship ECON 443: Industrial Economics ECON 4xx: Introduction to

It's a wonderful thing when people make interesting data sets available to the public. When Thomas Jones wrote a paper in Econometrics about the growth of US retail giant Walmart, he made the data he collected about every Walmart store opening in history (location and date) available to the public. Since then, several people have used different techniques to...

So I was trying to figure out a fast way to make matrices with randomly allocated 0 or 1 in each cell of the matrix. I reached out on Twitter, and got many responses (thanks tweeps!). Here is the solution I came up with. See if you can tell why it...

Rather belatedly, I got around to posting a series of posts summarising the Formula One season to date: F1 2012 Mid-Season Review – Grid/Classification Analysis: for example, how do the drivers’ grid and final classifications compare? F1 2012 Mid-Season Review – Pit Stops: for example, how does pit stop performance across the teams compare? F1