I decided that it would be too evil to ask you to write your own affine-invariant MCMC sampler :), so I'm giving you my own code. This code is for the first of our models that we will apply to the DAMPE data. In that model, the spectrum is a simple, single, power law. You can just run the code this time, but you will need to modify it in the next two weeks to apply more complex models. If you want to just run the code, compile it using, for example cc -o affinePL affilePL.c -lm (you could use a different compiler, such as icc or gcc instead of cc). To run it, you should make sure that the attached files data.dat and limits.dat are in the same directory as your code, and then just type ./affinePL 10 100 2 Here "10" is the number of "chains" files you want to produce, 100 is a dummy number that would be useful in other applications but not here, and 2 is the number of parameters in your model (for a simple power law, you have only the normalization and the slope of the power law as parameters, so that's 2). If you have typed the command above, then very quickly you should have files chain1.dat through chain10.dat in your directory. Each file will have thousands of lines; typical lines will look like 7 -3.615175 4.607246 -10739.5657 or 40 -3.926429 2.953193 -639.3846 The first column is the number of the "walker" (which I'll describe in a lecture), the second is the value of the first parameter, the third is the value of the second parameter, and the fourth is the log likelihood of the data for that parameter pair, given the single power law model. Thus if, for example, you want to find what parameter combination gives the largest log likelihood, you could use the inbuilt Unix command "sort". For example: sort -rg -k4 chain*dat |head -n1 Breaking this down: you want to sort in reverse (r, i.e., descending) numerical (g) order, on the fourth column (k4), of all the chain files combined (* is a wildcard), and print out only the first one (n1). Most of this code you won't have to modify, although if you know C I recommend that you check out what I did. Essentially, you need to know how to read in the data in data.dat, and what the limits are on each parameter (in limits.dat). The main modification that would be needed is in the loglikeilhood function, which is at the end of the code. In the version of this function in affinePL.c, you can see that in the loop over the data for (i=0; i