Rules for choosing power rating of a resistor
In engineering for commercial test equipment, we had a default rule that resistors should never be run beyond 50% of their rated power. This rule meant you didn't have to consider their contribution to the overall equipment MTBF, when the resistor manufacturers rate the dissipations for ambient temperature and a X0000 hours lifetime. Every so often, we couldn't meet this generous over-design, and then we'd need to do detailed calculations, including ambient temperature.

For military or auto under-hood electronics, you would derate even further for reliability.