## The assumed discount rate: r = 0.12 ## The inflation rate: if f==0 (no inflation is applied) ##f = 0.04 f = 0.0 old_width = options()$width options(width=10000) n_years = 5 for( f in c(0.0, 0.04) ){ ## ## All prices are in NOMINAL dollars(in millions): ## print(sprintf('NOMINAL dollars with: f= %.3f; r= %.3f', f, r)) inflation = (1+f)^seq(0, n_years-1) unit_price = rep(3.3, n_years) * inflation gross_revenue = unit_price * 1 labor_cost = ( 10000 * 30 * inflation ) / 1.e6 material_cost = ( 100 * 100 * inflation ) / 1.e6 net_income = gross_revenue - labor_cost - material_cost deprication = rep(2, n_years) taxable_income = net_income - deprication tax = 0.34 * taxable_income after_tax_income = net_income - tax R = data.frame(year=seq(1, n_years), labor_cost=labor_cost, material_cost=material_cost, net_income=net_income, deprication=deprication, taxable_income=taxable_income, tax=tax, after_tax_income=after_tax_income) print(round(R, 2)) NPV = -10 + sum( after_tax_income/(1+r)^seq(1, n_years) ) print(sprintf('NPV (MM)= %f', NPV)) } options(width=old_width)