Where are New Zealand’s bellwether electorates?
I was reading a piece by Graeme Edgeler who, near the end, asked “Where are New Zealand’s bellwether electorates?”. I didn’t know where the data came from or how was the “index of disproportionality...
View ArticleCollecting results of the New Zealand General Elections
I was reading an article about the results of our latest elections where I was having a look at the spatial pattern for votes in my city. I was wondering how would I go over obtaining the data for...
View ArticleCalculating parliament seats allocation and quotients
I was having a conversation about dropping the minimum threshold (currently 5% of the vote) for political parties to get representation in Parliament. The obvious question is how would seat allocation...
View ArticleReading a folder with many small files
One of the tools we use in our research is NIR (Near-Infrared Spectroscopy), which we apply to thousands of samples to predict their chemical composition. Each NIR spectrum is contained in a CSV text...
View ArticleImplementing 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...
View ArticleRecreational 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,...
View ArticleThe beauty of code vectorisation
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...
View ArticleCreating 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...
View ArticleAnyone using other than RStudio?
I asked both in Mastodon and Twitter “Anyone using other than #RStudio as their main #rstats IDE?” and—knowing that some programmers are literal and would probably reply ‘Yes’—I added “What is it?” Of...
View ArticleSome love for Base R. Part 4
Following on parts 1, 2 & 3—yes, a series—we arrive to part 4 revisiting Base R. See part 1 for the rationale, in case you’re wondering Whyyyy? A typical question going back to Base from the...
View Article