Ab Initio Statistical Mechanics Of Halide Perovskites