Sunday, May 11, 2008

Moving to LiveJournal

Going to trial LiveJournal. Admittedly the ads are a bit annoying if you're a non-paying user but not too bad. Also I like the way you can surf through people's friend lists in LJ, it seems to foster a bit more of a community spirit. Blogger in contrast seems to be a zillion unconnected blog islands.

Anyway you can catch me over at

Sunday, April 13, 2008

Food Crisis

It seems attention is shifting fairly rapidly from the financial crisis to the food crisis:

Grains Gone Wild
World Bank Leader Urges Action on Food

There are many factors in play here but, as in the financial crisis, complacency and poor judgment are major factors, specifically the allowing of stockpiles to dwindle on the basis that risk was/is spread (financial parallel: allowing of capital cushions to dwindle). This on the basis that if one country's harvests fail then they can simply import from another, or, if one mortgage fails then the impact is diluted by the remaining good mortgages. Umm yeh.

Both systems have exhibited the same flaw which is that risk estimation was based on uncorrelated entities/phenomenon/whatever cancelling each other out, whereas in times of crisis those correlations can break down, and break down in unpredictable ways - often the uncorrelated entities become strongly correlated, why? precisely because they were modelled as being uncorrelated. Such a model, when acted on by governments actually connects the uncorrelated entities - e.g. we need A or B, reduce stockpile of both because we know we will always have one or the other. Both fail, e.g. crops in Oz and continued cheap oil. Now no-one has adequate stockpiles so prices of A and B go up - they become correlated. And when supply is stretched to the limit for a must have resource, then prices can spike dramatically as the poorest people get priced out of the market (or starvation as it's otherwise known when dealing with food supply).

'Clever' mathematical modelling is not a substitute for reserves both in banking, food supply and any other system critical to our security and livelihood.

Ok so Mr. World Bank is calling for funding to lessen tensions in Haiti and elsewhere. Maybe I'm misunderstanding basic economics here but they don't need money, they need food. If we give them money they will buy food on the open market, the price will go up and the next poorest country/purchaser is priced out of the market. There either is enough food for everyone or there isn't, no amount of money is going to change that in the short term. Unlike the financial crisis we cannot just inject new fodo into the system like the Federeal Reserve 'injects' cash. Cash as abstract, food is real.

Monday, April 7, 2008

Shorting Opportunity?

IMHO the recent rise in the markets is just teetering on the edge of sanity right now. Let's take a look at a 2 year chart of my favourite index, the Russell 2000:

Out of context it might be reasonable to assume that a bounce back up to last summer's highs are a real possibility. OK but:

(A) The US economy is largely recognised to have been either in or very near recession in Q1.
(B) Q1 earnings reports are nigh.
(C) The Russell 2000 is currently sporting a dividend yield of 1.42%. (Umm, that's less than inflation folks)
(D) The credit markets are still in disarray and are shrinking.
(E) Property prices *are* falling. The credit crunch isn't just some ethereal event occuring in financial cyberspace, it's affecting 'Real People, Right Now'(TM).

The latest tick upwards in the markets is interesting but certainly not yet outside of 'control limits', for me alarm bells are not ringing. IMHO this is about as good as it gets as far as shorting or put option buying opportunities go, we're certainly not going to be seeing rising profits from ^RUT companies anytime soon + a continuing recession seems very likely indeed + stocks are still overpriced despite the fall from 2007 peaks. The recent move upwards has simply put some juice back into shorting opportunities.

Saturday, March 29, 2008

Good Practice in (Pseudo) Random Number Generation for Bioinformatics Applications


Note that all of these standard generators have been shown to have serious defects:
Standard Perl rand
C-library rand()
Matlab’s rand
Mathematica’s SWB generator

George Marsaglia's KISS algorithm is given the thumbs up, Microsoft dotNet's Random class isn't mentioned almost certainly because it isn't used much in academia - and as I've already discussed here, that algorithm cannot be re-initialised quickly and KISS is alomst certainly going to be faster anyway. Though not quite as fast as XOR-Shift.

Fractional Brownian Motion

Click on the images for larger versions.

Brownian Noise

Fractional Brownian Noise

Brownian Motion

Fractional Brownian Motion

Each plot shows 8000 samples. As the number of samples increases (as we zoom out) the brownian noise plot looks increasingly like a solid bar with straight edges, whereas the Fractional Brownian Motion(FBM) plot exhibits self-affinity, meaning it looks the same at any magnification (barring magnifications below a lower threshold).

FBM data was generated using the Hosking method with a Hurst parameter (H) of 0.7. For source code and an excellent thesis on FBM generation see:

The Hosking method is an exact method and as such has time complexity of O(N^2). The reason for this is that FBM exhibits long term dependence and therefore each new sample is dependent on all previous samples. Faster approximate methods exist, which is largely the subject of the linked thesis.

The hosking.c file was ported to C# and ranlib was substituted with this project which contains a NormalDistribution class:

Thursday, March 27, 2008

World Community Grid Research + Climate Rant

Nice to see some research papers using data from WCG projects:

HPF2 Progress and News

I've always been a bit skeptical about the quality of the research behind some of these projects. E.g. a seemingly knowledgable poster on slashdot claimed the 'Help Conquer Cancer' project were using a grossly inefficient and sloppy technique. I was sufficiently convinced to switch off that particular project.

Despite my doubts I still feel overall that this sort of research (protein folding and interaction predictions) is a better use of CPU resources than the SETI or climate change modelling. Having said that I like the idea that SETI is running, but maybe the balance is wrong.

As for climate change, well I have many issues here. But ultimately I think we need to just look at the big picture (at the political level) and say, y'know we don't and can't know what is happening and to what degree CO2 and other emissions are responsible. We should (I would suggest) be attempting to minimize our modification of the atmosphere and thus minimize the probability that we invoke some change with detrimental consequences.

I seriously doubt that progress will be made on CO2 emmissions, and having spent the last few weeks reading about fractional brownian motion I'm also beginning to realise that the data we have is a very small set of samples from which very little can be derived mathematically. What we do know is that billions of tonnes of CO2 will have *an* effect and anything that rocks the boat is probably going to be bad for something or someone given that so much life on this planet, human or otherwise, teeters on a knife edge.