  We address the long-standing question of the nature of oxygen vacancies in
strontium titanate, using a combination of density functional theory and
dynamical mean-field theory (DFT+DMFT) to investigate in particular the effect
of vacancy-site correlations on the electronic properties. Our approach uses a
minimal low-energy electronic subspace including the Ti-$t_{2g}$ orbitals plus
an additional vacancy-centered Wannier function, and provides an intuitive and
physically transparent framework to study the effect of the local
electron-electron interactions on the excess charge introduced by the oxygen
vacancies. We estimate the strength of the screened interaction parameters
using the constrained random phase approximation and find a sizeable Hubbard
$U$ parameter for the vacancy orbital. Our main finding, which reconciles
previous experimental and computational results, is that the ground state is
either a state with double occupation of the localized defect state or a state
with a singly-occupied vacancy and one electron transferred to the conduction
band. The balance between these two competing states is determined by the
strength of the interaction both on the vacancy and the Ti sites, and on the
Ti-Ti distance across the vacancy. Finally, we contrast the case of vacancy
doping in SrTiO$_3$ with doping via La substitution, and show that the latter
is well described by a simple rigid-band picture.
