  We theoretically study the structural stability of $R$Fe$_{12}$ with the
ThMn$_{12}$ structure ($R$: rare-earth elements, La, Pr, Nd, Sm, Gd, Dy, Ho,
Er, Tm, Lu, Y, or Sc, or group-IV elements, Zr or Hf) based on density
functional theory. The formation energy has a strong correlation with the
atomic radius of $R$. The formation energy relative to simple substances
decreases as the atomic radius decreases, except for $R=$ Sc and Hf, while that
relative to $R_{2}$Fe$_{17}$ and bcc Fe has a minimum for $R=$ Dy. The present
results are consistent with recent experimental reports in which the partial
substitution of Zr at $R$ sites stabilizes $R$Fe$_{12}$-type compounds with
$R=$ Nd or Sm. Our results also suggest that the partial substitution of Y, Dy,
Ho, Er, or Tm for Nd or Sm is a possible way to enhance the stability of the
ThMn$_{12}$ structure. Under hydrostatic pressure, the formation enthalpy
decreases up to $\approx$ 6 GPa and then starts to increase at higher
pressures.
