agriPAM

agriPAM is a dependency-light R toolkit for Agricultural Policy Analysis Matrices. It turns private and social farm budgets into the conventional PAM, calculates competitiveness and protection indicators, and evaluates how the conclusions respond to deterministic and stochastic uncertainty.

The package is authored by Chiranjit Mazumder, Himadri Sekhar Roy, Utkarsh Tiwari, Pramit Pandit, and Bikramjeet Ghose.

What it calculates

For private accounts (A), (B), (C) and social accounts (E), (F), (G), agriPAM calculates:

Result Definition
Private profit (D=A-B-C)
Social profit (H=E-F-G)
Net policy transfer (L=D-H)
Nominal protection coefficient, output (NPCO=A/E)
Nominal protection coefficient, input (NPCI=B/F)
Effective protection coefficient (EPC=(A-B)/(E-F))
Private cost ratio (PCR=C/(A-B))
Domestic resource cost ratio (DRC=G/(E-F))
Profitability coefficient (PC=D/H)
Subsidy ratio to producers (SRP=L/E)
Social cost-benefit ratio (SCB=(F+G)/E)

Installation

From a built source archive:

install.packages("agriPAM_0.1.0.tar.gz", repos = NULL, type = "source")

During development, install from the package directory with:

install.packages(c("testthat", "knitr", "rmarkdown"))
devtools::install("agriPAM")

Basic workflow

library(agriPAM)

pam_result <- pam(
  private_revenue = 150000,
  private_tradable_inputs = 42000,
  private_domestic_factors = 61000,
  social_revenue = 140000,
  social_tradable_inputs = 46000,
  social_domestic_factors = 55000,
  id = "Paddy",
  unit = "ha",
  currency = "INR"
)

pam_matrix(pam_result)
pam_transfers(pam_result)
pam_indicators(pam_result)
pam_classify(pam_result)

An itemised budget can be converted directly:

budget <- agri_pam_example("budget")

pam_result <- pam_from_budget(
  budget,
  quantity = "quantity",
  private_price = "private_price",
  social_price = "social_price",
  category = "category",
  id = "crop",
  unit = "ha",
  currency = "INR"
)

Sensitivity and uncertainty

sensitivity <- pam_sensitivity(
  pam_result,
  parameter = "social_revenue",
  changes = seq(-0.20, 0.20, by = 0.05),
  index = "Paddy"
)
plot(sensitivity, metric = "drc")

switching_value(
  pam_result,
  parameter = "social_revenue",
  metric = "drc",
  index = "Paddy"
)

simulation <- pam_monte_carlo(
  pam_result,
  cv = c(social_revenue = 0.15, social_tradable_inputs = 0.08),
  n = 5000,
  seed = 2026,
  index = "Paddy"
)
simulation$summary
simulation$probabilities

agri_pam_example() contains synthetic teaching data. It is deliberately not presented as an official estimate and should not be used for policy inference.

Methodological references

License

MIT © 2026 Chiranjit Mazumder, Himadri Sekhar Roy, Utkarsh Tiwari, Pramit Pandit, and Bikramjeet Ghose.