This applies to all forced age changes as well as the natural one applied every midwinter.
If the number of years is negative, simply subtract that from the unit's current age, and don't do anything else.
If your aging rate is greater than 100 (this is measured in years per century), the number of years becomes:
(Age rate * number of years to add + [a random number 0-99]) / 100
With that out the way, do this once for each year to add to the unit:
If your age rate is less than 100, pick a random number between 0 and 99. If this >= your age rate, you skip aging and all its effects this time.
If your age < your max age, increment your age by 1 and suffer no other adverse effects.
Calculate some value: 500 / max age, capped to a maximum value of 10.
If you are on the map (province ID is positive, so not in another plane), the value becomes ((death scale + 10) * (old value) * 10)/100.
If a random number 0-999 is less than (value * 15), you get to ride the affliction train.
35% chance of disease. Cannot happen if already diseased.
Otherwise, there is a 75% chance that you get a random minor affliction. If this doesn't happen you get a random major affliction instead.
If something above gave you battle fright, remove it.
If something above gave you disease, you have a 50% chance per death path (rolled independently) to have your disease removed.
If you are 2x your max age (or older), you take 1 point of damage (no rolls).
If you are diseased and over your maxage, you take 1 point of damage (no rolls).