  The Earth occultation technique has broad applications in both astronomy and
atmospheric density measurements. We construct the background model during the
occultation of the Crab Nebula observed by the Insight-Hard X-ray Modulation
Telescope (Insight-HXMT) at energies between 6 keV and 100 keV. We propose a
Bayesian atmospheric density retrieval method based on the Earth occultation
technique, combining Poisson and Gaussian statistics. By modeling the
atmospheric attenuation of X-ray photons during the occultation, we
simultaneously retrieved the neutral densities of the atmosphere at different
altitude ranges. Our method considers the correlation of densities between
neighboring atmospheric layers and reduces the potential systematic bias to
which previous work may be subject. Previous analyses based on light curve
fitting or spectral fitting also lost some spectral or temporal information of
the data. In contrast to previous work, the occultation data observed by the
three telescopes onboard Insight-HXMT is fully used in our analysis, further
reducing the statistical error in density retrieval. We apply our method to
cross-check the (semi-)empirical atmospheric models, using 115 sets of
occultation data of the Crab Nebula observed by Insight-HXMT. We find that the
retrieved neutral density is ~10%, ~20%, and ~25% less than the values of the
widely used atmospheric model NRLMSISE-00, in the altitude range of 55--80 km,
80--90 km, and 90--100 km, respectively. We also show that the newly released
atmospheric model NRLMSIS 2.0 is generally consistent with our density
measurements.
