The reason the factor is 38 is because that character would gain 38 levels in total from level 1. So if they were at level 2, it's be 37, at level 6, it's be 33, etc.
So for Eliwood's Lv 20/10 averages:
(stat growth/10) * 28 + (promotion bonuses)
unless stat > stat cap, in which case the stat would be at it's cap.
That formula would be for "simple" averages. The calculations for slowed averages (I don't know what people usually refer to them as) is slightly more complicated.