Lattice dynamical methods used to predict phase-transformations in crystals typically evaluate the harmonic phonon spectra and therefore do not work in frequent and important situations where the crystal structure is unstable in the harmonic approximation, such as the $beta$ structure when it appears as a high-temperature phase of the shape memory alloy (SMA) NiTi. Here it is shown by self consistent {it ab initio} lattice dynamical calculations (SCAILD) that the critical temperature for the pre-martensitic $R$ to $beta$ phase-transformation in NiTi can be effectively calculated with good accuracy, and that the $beta$-phase is a result primarily of the stabilizing interaction between different lattice vibrations.