Okay, here's the connection. If you're familiar with Foundation you know about psychohistory -- the fictional science in the series that allows psychohistorians to predict the future via an intimate understanding and scientific analysis of human behavior. In Foundation, Asimov calls it "a profound statistical science." Predictions of the behaviors of any given individual are not reliable, but become more accurate when applied to larger and larger populations. In the Foundation stories, the population to which psychohistorical analysis is applied are the quadrillions of human beings who inhabit the galaxy as part of the galactic empire. With such a large population, psychohistorical predictions can be quite accurate.
In The Sign of the Four, Doyle writes:
“Winwood Reade is good upon the subject,” said Holmes. “He remarks that, while the individual man is an insoluble puzzle, in the aggregate he becomes a mathematical certainty. You can, for example, never foretell what any one man will do, but you can say with precision what an average number will be up to. Individuals vary, but percentages remain constant. So says the statistician."
When I first read this, it struck me as a very accurate summation of psychohistory! I then wondered whether Doyle had invented psychohistory, or if (probably more likely) Asimov had been influenced by this passage. Then I realized that the idea was not original with Doyle -- he was talking about Winwood Reade's The Martyrdom of Man. I have not read that book, but I've always been fascinated by the similarity of the idea to that of Asimov's psychohistory.