Creating an n x n autocorrelation matrix

Walking around in old Lisbon.

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: A 5 x 5 autocorrelation matrix… Continue reading Creating an n x n autocorrelation matrix

The beauty of code vectorisation

Garden wind sculpture

I came across this problem in Twitter: Description of the problem by Fermat's Library. The basic pieces of the problem are: We need to generate pseudorandom numbers with an identical distribution, add them up until they go over 1 and report back how many numbers we needed to achieve that condition.Well, do the above "quite… Continue reading The beauty of code vectorisation

Recreational programming

Screenshot of problem 1, Advent of Code 2021

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… Continue reading Recreational programming

Flotsam 14: dev links

Succulent plants at the office.

Back doing some coding, playing with R packages and collaborating with someone else. This is an unusual situation for me, as I write my own code, and never bothered learning to use git (or other code management system). With the help of the Twitter crowd I've been slowly learning to use some git so the… Continue reading Flotsam 14: dev links

Categorized as flotsam

Fixing Rcpp warning in Mac OS

Riccarton market, Christchurch

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.