Observations of rotational transitions of interstellar molecules not only contain information about their abundance, but also on the excitation conditions. Moreover, the intensity ratio of lines of one molecule is, in the optically thin case, independant of the abundance of that molecule and can therefore be an excelent diagnostic for the physical conditions, such as temperature and density.
I have written a program to perform statistical equilibrium calculations including spontaneous and stimulated radiative processes and collisional (de)excitation. The radiative transfer is approximated through the mean escape probability method.
In dense clouds, the excitation is dominated by collisions with molecular hydrogen, which is by far the most abundant species. However, in photon--dominated regions (PDRs), the electron abundance may be as high as 10^5, and then collisions with electrons may become significant for some species.