There has been research into Fully Homomorphic Encryption, which can be implemented using lattice-based cryptography. Theoretically, FHE lets you run arbitrary computer programs on encrypted data, including the one you want.
It's slow, though. It would take millions of years just to evaluate relatively simple gates using this method.
https://dl.acm.org/citation.cfm?id=1834954
https://www22.in.tum.de/fileadmin/papers/essos15a.pdf
EDIT: If you want the "true" or "false" result of the computation to be visible to anyone who computes it, you can also do the following: Publish the ciphertext of "true" and "false" and create a noninteractive zero-knowledge proof that they were encrypted with the same key as all the published values. (NIZKs can be generated to prove the result of any NEXP computation, as demonstrated by the PCP Theorem and more recently by the Pinocchio compiler, which can take C programs and compile it into a binary that not only executes a program, but also prove that it was executed correctly).
Actually, you could just run the original computation yourself and generate one of these proofs. This will convince people that certain values are "close" to the mean, but it won't allow them to run the computation directly themselves.
EDIT2: You could extend that last solution a little further, and publish a commitment to the list of values of interest, a list of distances from the mean, and an NIZK that verifies that the list of distances is correct. Anyone will be able to see the list of distances and use the NIZK to verify that it is correct. This solution is actually efficient enough, using Pinocchio or IOPs, to be usable in practice.