-
Creating an n x n autocorrelation matrix
Between covid-19 news and announcements of imminent Russia-Ukraine wars I needed a bit of a distraction. Sooo, here it is how to create an n x n autocorrelation matrix based on a correlation rho, with a simple 5 x 5 example in R: This produces the following output: [,1] [,2] [,3] [,4] [,5] [1,] 1.0000 […]
-
The beauty of code vectorisation
I came across this problem in Twitter: The basic pieces of the problem are:
-
Recreational programming
I think programming, aka coding, is a fun activity. We are solving a problem subject to a set of constraints that can be time, memory, quantity of code, language, etc. Besides being a part of my work, coding is also a good distraction when doing it for the sake of it. In this type of […]
-
Fixing Rcpp warning in Mac OS
In Mac OS I was getting an annoying warning when compiling Cpp code via Rcpp in R: Adding a file called Makevars in ~/.R defining FLIBS to the actual location of gfortran in my machine fixed the problem. In my case, Makevars only contains the following line: That’s it.
-
Implementing a model as an R package
In our research group we often have people creating statistical models that end up in publications but, most of the time, the practical implementation of those models is lacking. I mean, we have a bunch of barely functioning code that is very difficult to use in a reliable way in operations of the breeding programs. […]