What is the difference between capacity factor and capacity credit? I know that capacity factor = annual generation / (installed capacity * 8760) but I don't understand how capacity credit is calculated and what it refers to.
Capacity factor refers to ratio of the energy produced by a power system in a year over the maximum energy that can be produced in a year.
Capacity credit (aka Capacity Value) is a more subtle term. It is a metric that depends on the generator and also in the system that it is incorporated. It is used with reference to renewable energy systems. It is a measure of the amount of conventional (thermomechanical) power generating system that can be replaced with the addition of the renewable energy system and maintain the same reliability.
The key concept here is reliabity and one type of measure is Loss-Of-Load expectancy (LOLE) which is the time that the system load exceeds the available generating capacity (There are also other types of measures.)
Since the above is vague, I will give an example. In a few islands in the Mediterrenean, the power grid is not connected to the continental European Power system. In those cases you have a mixture of thermomechanical (TMES hereafter) and renewable energy (RES) power generating sources. To simplify matter I will take the example of wind energy. Wind energy production system (without some storage systems) cannot produce energy that follows the demand. Therefore there is always the concern that at peak demand the RES will not provide peak supply. As a result there has to be a backup of TEMS to provide the additional energy in case RES cannot meet the demand (for grid isolated system not meeting the demand could result in a blackout). So for example if you have a peak demand of 550[MW], and an RES of 200[MW] you probably feel more secure with a TMES of 500[MW], rather that with a TMES of 400[MW].
Trying to measure and make comparisons with that type of concerns, the capacity metric takes slightly different approach. Assuming the same 550[MW] peak system, and lets say 550[MW] of TMES, if you added to the mixture a 100[MW] power wind system, how much of the TMES could you safely retire? In other words, how much power does the RES system, could safely replace the TMES. For a wind power system, Capacity Credit values can be as low as 10% of the rated power. In that case you could remove from the TMES installed power about 10% of the rated power of the RES (10[MW]).
Relationship between capacity factor (CF) and Capacity Credit (CC)
High CF means (usually that there is not much variability within the production. Or if there is variability you usually have high values. As a result, you can expect that most of the time you have higher energy outputs. So you can feel safer about removing higher amounts of MW from the TMES. That means higher CC.
So you can expect that higher CF results in higher CC
Things get a bit murky if you try to consider concepts like penetration (the percentage of a specific power generating source wrt to the annual energy consumption).
In the example of grid isolated systems (like islands) there is an RES (wind) penetration limit of (typically around) 30%. You will find that penetration affects the CC. For the same CF, as penetration increases the CC reduces.
This is due the fact, that if the installed RES is only 1% of the total with CF=0.5 and the power demand variability is in the order of 20%, then the system would be indifferent to the fluctuations of the RES. However, for the same power demand variability, if the installed RES is 50% of the total then you start to worry that your LOL would increase (therefore reliability drop).