farmPartial

farmPartial provides a focused toolkit for farm partial-budget analysis in R. It is designed for farm-management economics, agricultural extension, on-farm experiments, and technology-adoption appraisal.

Economic framework

Only items that change between a baseline farm plan and an alternative plan are included. The central calculation is

[ NR = (AR + RC) - (AC + RR), ]

where AR = added returns, RC = reduced costs, AC = added costs, and RR = reduced returns. A positive value is an economic signal in favor of the alternative, conditional on the assumptions used. It is not, by itself, a full farm-planning or risk-preference decision rule.

Main functions

Function Purpose
partial_budget() Build the standard four-quadrant partial budget
farm_budget() Create baseline or alternative farm-budget tables
compare_budgets() Convert two plans into incremental changes automatically
budget_summary() Return a tidy one-row economic summary
break_even_component() Find the component value that makes net change zero
sensitivity_analysis() One-way sensitivity analysis
two_way_sensitivity() Two-way sensitivity surface
scenario_analysis() Named multi-item scenarios
simulate_partial_budget() Monte Carlo uncertainty and probability of gain
annualize_investment() Equivalent annual cost of a capital change
trial_budget() Calculate adjusted yield, gross benefit, and net benefit
dominance_analysis() Identify economically dominated treatments
marginal_analysis() Marginal rate-of-return analysis for treatments
wheat_example() Illustrative wheat-management example

The core package has no non-base runtime dependency beyond standard R packages. testthat, knitr, and rmarkdown are suggested for tests and the vignette.

Quick start

library(farmPartial)

changes <- wheat_example("changes")
pb <- partial_budget(changes, currency = "INR", unit = "per ha")

pb
budget_summary(pb)
plot(pb)

For the included example, the calculation is:

The values are illustrative, not survey estimates or official recommendations.

Compare two farm plans

base <- wheat_example("baseline")
alternative <- wheat_example("alternative")

pb2 <- compare_budgets(base, alternative)
pb2
pb2$comparison

You can build your own plans from values:

base <- farm_budget(
  item = c("Grain", "Seed", "Irrigation"),
  category = c("return", "cost", "cost"),
  value = c(120000, 6500, 9000),
  currency = "INR",
  unit = "per ha"
)

or from quantities and unit prices:

farm_budget(
  item = c("Grain", "Seed"),
  category = c("return", "cost"),
  quantity = c(50, 100),
  unit_price = c(2500, 65)
)

Sensitivity and break-even analysis

s <- sensitivity_analysis(
  pb,
  item = "Higher grain return",
  multipliers = seq(0.7, 1.3, by = 0.1)
)
plot(s)

break_even_component(pb, "Additional herbicide")

Two-way sensitivity is also available:

s2 <- two_way_sensitivity(
  pb,
  item_x = "Higher grain return",
  item_y = "Additional herbicide"
)
plot(s2)

Scenario analysis

scenarios <- data.frame(
  scenario = c(
    "Output price stress", "Input price stress",
    "Combined stress", "Combined stress"
  ),
  item = c(
    "Higher grain return", "Additional herbicide",
    "Higher grain return", "Additional herbicide"
  ),
  multiplier = c(0.75, 1.30, 0.75, 1.30)
)

sc <- scenario_analysis(pb, scenarios)
sc
plot(sc)

Monte Carlo uncertainty

uncertainty <- data.frame(
  item = c("Higher grain return", "Additional herbicide"),
  distribution = c("normal", "triangular"),
  mean = c(6000, NA),
  sd = c(900, NA),
  min = c(NA, 900),
  mode = c(NA, 1200),
  max = c(NA, 1700)
)

sim <- simulate_partial_budget(pb, uncertainty, n = 5000, seed = 2026)
summary(sim)
plot(sim)

The plotted interval is a Monte Carlo uncertainty interval under the specified component distributions, not a sampling-theory confidence interval.

On-farm trial economics

trials <- trial_budget(
  treatment = c("Farmer practice", "Treatment A", "Treatment B", "Treatment C"),
  yield = c(3.0, 3.4, 3.8, 4.1),
  price = 22000,
  variable_cost = c(18000, 22000, 28000, 39000),
  yield_adjustment = 0.90
)

dominance_analysis(trials)
marginal_analysis(trials, minimum_mrr = 50)

Methodological caution

Partial budgeting is deliberately partial. It is most appropriate when a change affects a limited set of returns and costs while the rest of the farm plan is unchanged. Opportunity costs of family labor and non-market inputs should be valued when they change. Whole-farm resource constraints, liquidity, farmer risk preferences, tax consequences, and major interactions across enterprises may require a broader whole-farm or investment analysis.

Reference

CIMMYT. (1988). From agronomic data to farmer recommendations: An economics training manual (completely revised edition). CIMMYT. ISBN 968-6127-19-4.