Capital budgeting
Project NPV, IRR, MIRR, fractional payback, profitability index and equivalent annual annuity.
- Model id
corporate.capital_budgeting, version 2- Domain
- Corporate finance
- Evidence
- standard
- Cost class
- light: A short numerical method; a hosted run may take up to 10 seconds.
Formula
Where
- Net present value
npv - The cash flow at time t; negative when paid out
cash_flows - Discount rate per period
rate - Number of periods after time 0
- Modified internal rate of return
mirr - The positive cash flows
- The negative cash flows
- Reinvestment rate for the positive flows
reinvestment_rate - Financing rate for the negative flows
finance_rate - Future value at period n
- Present value at time 0
- Profitability index
profitability_index - Equivalent annual annuity
equivalent_annual_annuity - The annuity factor: the present value of 1 a period for n periods at rate r
Each symbol's field is named beside it; the inputs and outputs, with their units and bounds, are under Variables, and the citations give each formula's source.
Variables
Rates, returns and yields are decimals: 0.05 is five percent. Bounds in brackets include their end; in parentheses they exclude it.
Inputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
Cash flowscash_flowsmoney (array) · length min 2, max 1201; each [-1e+12, 1e+12] | money (array) | length min 2, max 1201; each [-1e+12, 1e+12] | Signed project cash flows at t=0, 1, ...; negative means paid out |
Rateraterate · [-0.99, 1] | rate | [-0.99, 1] | Discount rate per period |
Finance ratefinance_raterate · [-0.99, 1] | rate | [-0.99, 1] | MIRR financing rate per period for negative flows |
Reinvestment ratereinvestment_raterate · [-0.99, 1] | rate | [-0.99, 1] | MIRR reinvestment rate per period for positive flows |
Outputs
| Name | Unit | Bounds | Description |
|---|---|---|---|
NPVnpvmoney · [-1e+15, 1e+15] | money | [-1e+15, 1e+15] | NPV including the undiscounted t=0 flow |
IRRirrrate · [-0.99, 10] | rate | [-0.99, 10] | Smallest IRR in [-0.99, 10], or null with warning |
MIRRmirrrate · [-0.99, 10] | rate | [-0.99, 10] | Modified IRR per period, or null with warning |
Paybackpaybackperiods · [0, 1200] | periods | [0, 1200] | First nominal cumulative recovery time, fractional periods; null if never reached |
Discounted paybackdiscounted_paybackperiods · [0, 1200] | periods | [0, 1200] | First discounted cumulative recovery time, fractional periods |
Profitability indexprofitability_indexratio · [0, 1e+06] | ratio | [0, 1e+06] | PV of positive flows / absolute PV of negative flows |
Equivalent annual annuityequivalent_annual_annuitymoney · [-1e+15, 1e+15] | money | [-1e+15, 1e+15] | NPV / annuity factor over the project's periods; annual only when periods are years |
Calculator
Run the model on your own inputs, starting from its example. Rates are decimals: 0.05 is five percent. The run goes to the pyeconomics API on this site: your values travel only in the request, and nothing is stored.
Loading the calculator…
Worked example
Example two_year_project. Inputs:
{
"cash_flows": [-100, 60, 60],
"finance_rate": 0.1,
"rate": 0.1,
"reinvestment_rate": 0.1
}Outputs:
{
"discounted_payback": 1.916666666666667,
"equivalent_annual_annuity": 2.3809523809523747,
"irr": 0.13066238629180701,
"mirr": 0.12249721603218215,
"npv": 4.132231404958667,
"payback": 1.6666666666666665,
"profitability_index": 1.0413223140495866
}Assumptions
- Signed cash flows are equally spaced, first at time zero. Rates are decimals per period.
- Payback interpolates the first cumulative recovery; positive t=0 flow gives payback zero.
- PI discounts all inflows and all outflows, not just the initial outlay.
Limitations
- NPV outside +/-1e15 raises DomainError. IRR follows core's sign-change scan and smallest-root policy, which can miss tangent or closely spaced roots.
- Undefined or unrepresentable partial outputs are null with warnings: no IRR, missing MIRR sign, no payback, zero PI denominator, or overflow. MIRR is limited to [-0.99, 10].
- Discounted payback is not shorter for conventional cash flows at nonnegative discount rates; the MIRR interval identity assumes a single initial outlay and subsequent inflows.
Evidence
Status: standard. Textbook consensus, such as bond duration or the CAPM formula.
Every model declares one status: standard (textbook consensus), practitioner (a widely used convention), contested (under active debate), rejected (failed out of sample) or historical (a superseded methodology).
Syllabus
The 2027 CFA® Program's topic areas this model relates to, as factual tags. Each links to CFA Institute's page for its level; pyeconomics holds none of the curriculum's text.
Citations
- Microsoft. MIRR function. https://support.microsoft.com/en-us/excel/functions/mirr-function (Syntax and five-year example)
- Kellison, S. G. (2009). The Theory of Interest, 3rd ed. McGraw-Hill. https://www.mheducation.com/highered/product/theory-interest-kellison.html (Yield rates and investment appraisal). ISBN 9780073382449
Changelog
- Version 1: First version.
- Version 2: Recognize IRR roots at inclusive bracket endpoints (#85).
Use it elsewhere
- Documentation
- The model's reference page
- REST API
GET or POST /v1/models/corporate.capital_budgeting/run- MCP tool
corporate_capital_budgeting, orrun_modelwith the model's id; both give the same result. Connect an assistant- Command line
pyeconomics models run corporate.capital_budgeting --help
The worked example, from Python and from the command line:
import pyeconomics
inputs = {
"cash_flows": [-100, 60, 60],
"finance_rate": 0.1,
"rate": 0.1,
"reinvestment_rate": 0.1,
}
result = pyeconomics.run("corporate.capital_budgeting", inputs)
print(result.to_json())
pyeconomics models run corporate.capital_budgeting --inputs - <<'JSON'
{
"cash_flows": [-100, 60, 60],
"finance_rate": 0.1,
"rate": 0.1,
"reinvestment_rate": 0.1
}
JSON