Adding in variance in do statistics function