C# port of Stuart Wsrren's logit project