This paper proposes a modified Cochran’s $Q$ statistic to detect horizontal pleiotropy in Mendelian randomization. This extension is quite important when there are many weak genetic instruments.