The income for food is the following equation:
[(agriculture infrastructure) * [ 1 + (research lvl / 10) ] * (1 + [race modifier / 100])] * (1 + Planet Bonus/100)
Meaning lvl 100 food production with 1 infra on a fertile is:
[(1) * [ 1 + (100 / 10) ] * (1 + [ 120 / 100 ])] * (1 + 250 / 100) or
(1+10)*(1+.2)*(1+2.5) = (11)(1.2)(3.5) = 46.2 food/RM per turn
Commercial is computed as such:
(commerical infrastructure) x [ 5 + (research lvl/2)] x (1 + [race modifier / 100])
100 infra in commercial would yield:
(1)*(5+(100/2))*(1+0/100) = 5+50 = 55
Using your "cost" formula,
Comm/food & RM produced
Even with food prices of 1:
we get: 55 credits/(46.2 food) - 46.2 RM = -45.01
Which means you will always make more money from agriculture, regardless of the state of the market. The only drawback is that fertiles are needed for a massive income boost (The 3.5x at the end of the formula).
Just as future reference, any time Stephen says +xxx%, the way to calc the overall change is (1+xxx/100). Oh, and try not to go above 7 housing, even with the bonus. 7 has been proved to be the optimal number over and over again. I can provide proof, but you should really just trust me. (1.8% income increase vs 0 infra, no other number goes as high as 1.8% other than 7.)