Never Use a Brain Wallet

May 22, 2019

Among many reasons why people find it hard to use cryptocurrency there’s a simple one – memorising the private key is too hard. So, people invented brain wallet, which turns a string of words into a private key and thus wallet. It’s genius in that now a user needs only to memorise whatever he or she used to create the wallet. You can turn your name, phone number, DoB, favourite quote, lover’s home address, …, literally anything into a cryptocurrency wallet. ...

Computing Jackknifed Coefficient Estimates in SAS

May 20, 2019

Background In certain scenarios, we want to estimate a model’s parameters on the sample for each observation with itself excluded. This can be achieved by estimating the model repeatedly on the leave-one-out samples but is very inefficient. If we estimate the model on the full sample, however, the coefficient estimates will certainly be biased. Thankfully, we have the Jackknife method to correct for the bias, which produces the (Jackknifed) coefficient estimates for each observation. ...

The Valuable Cheap Privacy

May 19, 2019

Recently I’ve been in a project on Australian small loan market. Some fund managers and industry stakeholders actually pointed out some very intriguing perspectives when talking about this small loan business in emerging and developed countries. One that I’m interested in is the value of privacy, to the individual and to the business. The small loan business First, we need to acknowledge that there’s long been the demand for small loans. ...

From to

May 18, 2019

I’m changing the site primary domain from to for some reasons. No Name Shame Mingze, 铭míng泽zé, is my official given name translated from Mandarin. I know that it’s hard to pronounce for native English speakers and it’s honestly nobody’s fault – you’ve to admit that there is simply no such syllable in English that correspond to its correct pronunciation in Mandarin. Though I cannot make it right for a lot of names as well, I dislike as much as everyone else does when people say my name in a strange way. ...


Mar 29, 2019



Call Option Value from Two Approaches

Mar 17, 2019

Suppose today the stock price is $S$ and in one year time, the stock price could be either $S_1$ or $S_2$. You hold an European call option on this stock with an exercise price of $X=S$, where $S_1<X<S_2$ for simplicity. So you’ll exercise the call when the stock price turns out to be $S_2$ and leave it unexercised if $S_1$. 1. Replicating Portfolio Approach Case 1 Case 2 Stock Price $S_1$ $S_2$ Option: 1 Call of cost $c$ Exercise? ...

100 Bitcoins Forgone for Science

Feb 26, 2019

This post is just another piece of my serious nonsense. All of a sudden, I wanted to know how many Bitcoins I could have mined since 2012? This is because I’ve known Bitcoin since its existence in 2009, but have never really put any effort in mining. Instead, I was fascinated by the idea of using distributed (volunteer) computing to solve scientific problems. For example, BOINC and related projects like World Community Grid are using the computing power donated from around the world to find effective treatments for cancer and HIV/AIDS, low-cost water filtration systems and new materials for capturing solar energy efficiently, etc. ...


Feb 14, 2019

最近几天有一篇文章刷爆了朋友圈,《流感下的北京中年》,让人看了以后不是滋味。可以想见一些人会蜂拥去医院做检查,看自己是否有疾病困扰。Baye’s theorem在这里也是有用的,一是检查阳性不代表就真的得病了,二是为了确诊而做许多不同检查是必要的。比如说用甲胎蛋白查肝癌,令: $$C=\text{被检者患肝癌}$$ $$\overline{C}=\text{被检者未患肝癌}$$ $$A=\text{甲胎蛋白检验为阳性}$$ $$\overline{A}=\text{甲胎蛋白检验为阴性}$$ 过去的统计资料显示, $$P(A|C)=0.95$$ $$P(\overline{A}|\overline{C})=0.90$$ 又已知当地居民肝癌发病率, $$P( C )=0.0004$$ 若某人甲胎蛋白检验为阳性,他患有肝癌的概率$P(C|A)$有多大呢?由贝叶斯公式可得: $$P(C|A)=\frac{P( C )P(A|C)}{ P( C )P(A|C)+P(\overline{C})P(A|\overline{C}) }=0.0038$$ 即,虽然他经准确率很高的甲胎蛋白检查为阳性,其实际患有肝癌的概率只有0.38%。这是为什么呢?这是因为虽然$P(A|\overline{C})=0.1$是不大的(这时被检者未患肝癌但是检查为阳性,即检验结果是错误的),但是患有肝癌的人毕竟很少($P( C )=0.0004$),这就使得检验结果是错误的部分$P(\overline{C})P(A|\overline{C})$相对很大,从而造成$P(C|A)$很小。 换个方法表述,假设有10,000人,其中应有约4人患有肝癌,而检验为阳性的人但未患肝癌的人有1,000个,也就是说,当某人甲胎蛋白检验为阳性时,他更有可能是落在了检验错误的人群中而不是真的患了肝癌。这就是已经得到的知识,先验概率$P( C )$的影响——在未怀疑检验对象患有肝癌的时候,准确率很高的测试结果为阳性也不能说明什么问题。但这并不意味着这检查方法就没有用了。通常医生会先采取一些其他的辅助方法来检查,当医生怀疑某个对象有可能患肝癌时候再进行甲胎蛋白检查,此时该对象肝癌的发病率已经显著增加了。你可以理解是人没变,但是他所属的样本群体已经不再是“当地居民”、而是“被怀疑可能患有肝癌的人群”了。如果被怀疑的对象中患有肝癌的概率是0.5,此时的$P( C )=0.5$,可以计算出$P(C|A)$为0.9,这就是相当高的准确度了。 有些人读了一些书,看这个病像是得了这个病、看那个病像是得了那个病,而实际屁事都没有,就是错误地认为自己所属的样本群体已经是了“可疑患者”而不是“当地居民”。而这两个群体的先验概率——发病率$P( C )$的差别是非常大的。当然,但是,身体不舒服了还是要去医院的。专业的事情交给专业的人做。