We construct matrix models for the deconfining phase transition in gauge theories, without dynamical quarks, at a nonzero temperature . We generalize models with zero and one free parameter to study a model with two free parameters: besides perturbative terms , we introduce terms and . The two -dependent parameters are determined by fitting to data from numerical simulations on the lattice for the pressure, including the latent heat. Good agreement is found for the pressure in the semi quark gluon plasma, which is the region from , the critical temperature, to about . Above , the pressure is a sum of a perturbative term, , and a simple nonperturbative term, essentially just a constant times . For the pressure, the details of the matrix model only enter within a very narrow window, from to , whose width does not change significantly with . Without further adjustment, the model also agrees well with lattice data for the ’t Hooft loop. This is notable, because in contrast to the pressure, the ’t Hooft loop is sensitive to the details of the matrix model over the entire semi quark gluon plasma. For the (renormalized) Polyakov loop, though, our results disagree sharply with those from the lattice. Matrix models provide a natural and generic explanation for why the deconfining phase transition in gauge theories is of first order not just for three, but also for four or more, colors. Lastly, we consider gauge theories where there is no strict order parameter for deconfinement, such as for a gauge group. To agree with lattice measurements, in the matrix model, it is essential to add terms that generate complete eigenvalue repulsion in the confining phase.