What parameters effect on voltage regulator's temprature?
Voltage difference between input and output  
  Output current  
  Ground current (only a bit)  
  Package  
  Ambient temperature  
  


Like Oli says a linear regulator behaves as a variable resistor  



and then power dissipation is defined as

\$ P = V \cdot I \$

At 18 V in, 5 V out and a 1 A load current that's 13 W. Note that the load will only consume 5 W, so the linear regulator is not very efficient here. Efficiency can be calculated as  

\$ \eta = \dfrac{V_{OUT} \cdot I}{V_{IN} \cdot (I + I_Q)} \approx \dfrac{V_{OUT}}{V_{IN}} \$ 

\$I_Q\$ is the ground current and will be maximum 8 mA for the LM7805. For a load current of 1 A that's less than 1 % and then we simply ignore it, but for a 50 mA load that's 16 %, and then it's not negligible anymore. More recent regulators, esp. LDOs have a lower ground current, often not more than 1 % of the load, also at lower load currents.

So, when are we going to discuss temperature? I'm getting to that :-). There are resistors in all shapes and sizes, from an 01005 (which is 0.4 mm long and weighs 40 &micro;g!) to resistors which can dissipate kilowatts. This type  



is a 100 W resistor. Even if you haven't experienced this yourself you can imagine that 100 mW dissipation in the 01005 will cause a higher temperature than in the chassis mount 100 W resistor. And this has everything to do with thermal capacity, which is specific heat \$\times\$ weight. A material's specific heat is expressed in J/(g K), and this gives us an idea what it refers to: the energy (in joules) to heat up 1 g of the material by 1 K. 

The 01005 resistor will consist mainly of a ceramic which has a (very convenient) specific heat around 1 J/(g K). So that 40 &micro;g resistor will heat up by 25 °C if you add 1 mJ of energy, that's 1 mW during 1 second. The datasheet says it has a maximum power of 31 mW, won't the temperature rise to 775 °C in 1 second? No, because it will not only dissipate energy, but also lose some of it to the environment, for the SMD resistor mainly the PCB.  

So adding energy will raise the temperature, but the energy loss will decrease it again. The temperature rise is a linear function of the added energy, but the drained energy depends on the temperature difference with the environment: the higher the temperature difference, the more heat will be lost. So as temperature rises, more and more energy will be lost until an equilibrium is reached: the added heat is equal to the drained heat and temperature won't rise any further.  

The heat loss is determined by thermal resistance. Just like electrical resistance determines current flow together with voltage difference, heat flow is determined by thermal resistance and temperature difference. So it makes sense to express thermal resistance in K/W (or °C/W if you want, it's the same because it's a relative value). And here we finally get back to the LM7805. The datasheet says 


  \$ R_{\theta J C} \$ = 5 K/W (Junction to Case)
  \$ R_{\theta J A} \$ = 65 K/W (Junction to Air or Ambient)  


That's a big difference. Junction means the IC's die, case is the package. That reesistance is low because the heat transfer occurs through conduction, the materials are in direct contact. Junction to air occurs through convection and is far less efficient, because the air can't carry much heat. But we'll have to do with the 65 K/W. Read it as "in equilibrium 1 W dissipation will cause the die to be 65 °C hotter than the environment. 

Now there's two ways of doing the calculation. Either you start with the ambient temperature, and say for instance that it won't be higher than 50 °C. (In the enclosure it will be hotter than in the living room.) Then the junction temperature will be 50 °C + 65 °C = 115 °C. The datasheet says Absolute Maximum Range for operating temperature is 125 °C, so that doesn't give us much margin. And we're only dissipating 1 W here!!
Or you calculate back from the maximum allowed 125 °C, and then the ambient temperature may be as high as 60 °C. I don't like this that much, because you have no headroom at all.

Didn't we have 13 W to dissipate? I'm not even going to calculate that; it will be much too hot. Solution: decrease thermal resistance. The 5 K/W junction to case you can't do much about, but the 65 K/W you can: use a heatsink. Because it has much more contact with the air its thermal resistance can be much lower. What do we need? (115 °C - 50 °C)/13 W = 5 K/W. Piece of cake it seems; you can find heatsinks around 1 K/W. But there's also the thermal resistance between case and heatsink, and that may be a few K/W already. It's not specified because it completely depends on how you mount the heatsink on the regulator. You'll have to use heat transfer paste, aka thermal grease.