Snyd - the Danish version of the liar's dice game

I have never played dice before I came to Denmark. Then a friend introduced me to a quite popular Danish (drinking) game, snyd, which turns out to be an elaborated version of the popular liar's dice game. The game consists in guessing the correct number of dice showing a given face value that the other players hide beneath their cups. At its heart, it is just statistics.

But then, if it is just statistics, why not gain an edge over the brutish business students by applying a bit of probability theory? After all, the probability of observing a certain number of dice showing a given face value is simply a function of the number of dice the other players have, which is known. However, it turns out that because of the peculiar characteristics of snyd, calculating such probabilities is not that easy.

Thus, here's a matlab function that does that for you. It takes as input the vector of the number of dice that the other players still have, e.g. [3 2 1 2] if there are 4 players other than you, and spits out a table showing the unconditional probabilities that the other players hide at least a certain amount of dice showing a given face value, with and without the trappe rule.

Now, I understand that taking a laptop to the bar to play snyd might not be the smartest idea ever. But in a short-ish time I should be able to implement the program in javascript and embed it into the website. Hopefully.

Stata utilities

Developed with Kristoffer Markwardt. These ado files are particularly useful when working in projects containing a lot of raw datasets stored in a given folder (and eventual subfolders), but whose documentation is poor or simply too large to consult each time you need to select a specific variable or take a look at the project as a whole. There are two ados in the downloadable .zip file, together with their respective help files. You can copy them in your personalized ado directory and provide stata its path (adopath + "C://my_ado_directory") at the beginning of a session or simply install them in the system.

checkvars

checks in a given folder all STATA files within it and within its subfolders, and looks for the variables specified in namelist. The program is meant for the system used with data delivered by Denmark Statistics, where datasets are named with the year they refer to at the end, e.g. idas_2003.dta. If this is the case, it is possible to restrict the search between years of interest using the options from(#) and to(#). Otherwise, the option noyear should be specified. Optionally, the program creates an overview of the search results by year, and saves it in a tab-separated txt.file. See option map.

checkfiles

compares two given folders, which are assumed to have the same structure, and checks whether all SAS files in the raw( ) folder are present as STATA files in the work( ) folder. The program then reports which files are missing from the work( ) folder, and optionally transfers them, eventually creating the subfolders needed to preserve the same structure in the two folders.

Timerec

Simple utility to record the running time of your scripts in a txt file of choice. After a few run of the file, you will be able to know how the performance of your script is improving (or worsening) as you develop it. Particularly useful when running times are in the range of hours.