There are reasons to believe that the ground state of the magnetic rare earth pyrochlore Yb$_2$Ti$_2$O$_7$ is on the boundary between competing ground states. We have carried out $mathrm{textit{ab initio}}$ density functional calculations to determine the most stable chemical formula as a function of the oxygen chemical potential and the likely location of the oxygen atoms in the unit cell of the stuffed system. We find that it is energetically favorable in the stuffed crystal (with an Yb replacement on a Ti site) to contain oxygen vacancies which dope the Yb 4$mathrm{textit{f}}$ orbitals and qualitatively change the electronic properties of the system. In addition, with the inclusion of the contribution of spin-orbit-coupling (SOC) on top of the GGA+U approach, we investigated the electronic structure and the magnetic moments of the most stable stuffed system. In our determined stuffed structure the valence bands as compared to those of the pure system are pushed down and a change in hybridization between the O 2$mathrm{textit{p}}$ orbitals and the metal ion states is found. Our first-principle findings should form a foundation for effective models describing the low-temperature properties of this material whose true ground state remains controversial.