Controlling for confounding network properties in hypothesis testing and anomaly detection