Methodology Note

Modeling Food Consumption Patterns in India

GAM-Based Estimation of Food Consumption Probabilities and Quantities
Dr Shamika Ravi (Member, EAC to PM) & Dr Mudit Kapoor (CECFEE, EPU, ISI-Delhi Center)
February 2026

1. Introduction

This document explains how we model and predict food consumption patterns at the household level — benchmarked against the ICMR-NIN Recommended Dietary Allowances[1] for a reference adult woman (55 kg, moderately active, non-lactating) — using data from the Household Consumer Expenditure Survey (HCES) 2011–12 & 2023–24. The framework uses semi-parametric Generalized Additive Models (GAMs)[2] within a two-stage hurdle structure[3][4] to cover consumption of individual food categories across the population.

1.1 What Do We Estimate?

The analysis produces three families of estimates for each of the ten food categories in the ICMR-NIN recommended diet:

  1. Probability of consumption: What share of the population consumes a given food item, and how does this vary with income, geography, and demographics?

  2. Conditional quantity consumed: Among those who consume the item, how many grams per day per Adult Female Equivalent (AFE) do they consume?

  3. Unconditional quantity consumed: Combining the two above — the expected consumption (including zero consumers) across expenditure deciles and demographic groups.

1.2 Food Categories Analyzed

Based on the ICMR-NIN recommended balanced diet[1] for adult woman (55 kg, moderately active, non-lactating), the analysis covers ten food categories:

Food Category Daily Requirement (grams)
Cereals & Millets 280
Green leafy vegetables 100
Other vegetables 200
Roots & Tubers (excl. potatoes) 100
Fruits 100
Milk & Milk products 300
Fats & Oils 25
Oilseeds & Nuts 40
Pulses & Beans 95 (combined with Flesh Foods)
Flesh foods 95 (combined with Pulses & Beans)

Note on Pulses & Flesh foods. The ICMR-NIN[1] guidelines specify a combined requirement of 95 grams for “Pulses, Beans & Flesh foods.” In the analysis, Pulses & Beans and Flesh foods are modeled separately to capture their distinct consumption patterns, but share the combined requirement when computing dietary adequacy.

1.3 Overview of Analytical Pipeline

Stage 1: Per-Item Hurdle Models
   → For each food category × survey round:
     (a) Fit logit model for P(consumption > 0)
     (b) Fit conditional quantity model (Gamma or Log-Normal, AIC-selected)

Stage 2: Posterior Simulation and Prediction
   → Draw from parameter uncertainty
   → Predict proportion and quantity by group × expenditure decile
   → Summarize with credible intervals

Stage 3: Visualization
   → Engel curves for proportion and quantity
   → Faceted by demographic group, across survey rounds

2. Data and Variable Definitions

2.1 Survey Data

The analysis uses unit-level records from two rounds of the HCES:

Exclusion criterion. Households reporting only cooking fuel expenditure (identified by survey-specific cooking codes) are excluded, as they do not represent regular food consumption patterns.

2.2 Outcome Variables

For each food category \(m\), two household-level outcomes are constructed:

$$q_i = \frac{\text{Quantity}_{i}^{\,\text{HH}}}{\text{HH Size (AFE)}_i}$$

Total household consumption of item \(m\) (grams/day) divided by the number of adult female equivalents.

Why Adult Female Equivalents?

The AFE scaling accounts for the fact that household members differ in their caloric and nutritional requirements. Using AFE rather than simple per capita measures avoids systematically overstating consumption adequacy in households with many children or elderly members.

The energy requirements and corresponding AFE scale factors used in this analysis are shown below. The reference category is the adult woman (moderate activity), whose requirement of 2,130 kcal/day defines one AFE unit.

ICMR-NIN Energy Requirements and AFE Scale Factors
Demographic Profile Activity Level Energy Requirement (kcal/day) AFE Scale Factor
Child 0 to 12 mo—5950.28
Child 1 to 3 yrs—1,1100.52
Child 4 to 6 yrs—1,3600.64
Child 7 to 9 yrs—1,7000.80
Girls 10 to 12 yrs—2,0600.97
Boys 10 to 12 yrs—2,2201.04
Girls 13 to 15 yrs—2,4001.13
Boys 13 to 15 yrs—2,8601.34
Girls 16 to 18 yrs—2,5001.17
Boys 16 to 18 yrs—3,3201.56
Adult women (reference)Moderate2,1301.00
Adult women (lactating)Moderate2,6901.26
Adult menModerate2,7101.27

For example, a household comprising one adult man, one adult woman, and one child aged 4–6 would have an AFE household size of 1.27 + 1.00 + 0.64 = 2.91, rather than a simple headcount of 3. Dividing total household food consumption by this AFE size yields a per-AFE measure that is comparable across households of different demographic compositions.

Implementation Details

The AFE scale is constructed at the individual level from the HCES person-level roster, which records each household member's age and gender. The assignment proceeds in three steps:

Step 1 — Lactation status imputation. The HCES does not directly record lactation status. We proxy it using the presence of a child under 12 months in the household. If at least one child aged <1 is present, the youngest woman aged 19–49 in the household is classified as lactating and assigned the higher energy requirement of 2,690 kcal/day (= 2,130 base + 560 lactation increment, where 560 is the average of the ICMR-NIN increments of 600 kcal for 0–6 months and 520 kcal for 6–12 months postpartum). If there are n children under 1, then up to n women (ordered youngest-first) are assigned lactating status. Remaining adult women, as well as all women aged 50 and above, receive the non-pregnant, non-lactating requirement of 2,130 kcal/day.

Step 2 — Energy requirement assignment. Each household member is mapped to an age-sex-specific energy requirement from the table above using the following rules: children are classified solely by age (the infant category uses the average of the ICMR 0–6 month and 6–12 month values); adolescents aged 10–18 are further stratified by gender; and all adults are assigned the moderate activity level. Adult men (and transgender individuals coded as gender = 3) receive the adult male requirement of 2,710 kcal/day regardless of age.

Step 3 — AFE conversion and household aggregation. Each member's AFE scale factor is computed as AFEk = Ereqk / 2,130. The household AFE size is then the sum across all members: HH Size(AFE)i = ∑k AFEk. An individual's within-household energy share is sharek = AFEk / HH Size(AFE)i, which is used in subsequent food quantity allocation steps.

The R implementation is shown below:

HCES2023_AFE_energy <- HCES2023_level02 %>%
  dplyr::select(hhid, person_sno, gender, age) %>%
  arrange(hhid, gender, age) %>%
  group_by(hhid) %>%
  mutate(under_1_a = ifelse(age < 1, 1, 0)) %>%
  ungroup() %>%
  group_by(hhid) %>%
  mutate(
    child_under_1   = max(under_1_a),
    n_child_under_1 = sum(under_1_a)
  ) %>%
  ungroup() %>%
  mutate(
    women_18_50 = dplyr::case_when(
      (age >= 19 & age < 50) & gender == "2" ~ 1,
      .default = 0
    )
  ) %>%
  group_by(hhid, women_18_50) %>%
  mutate(seq = row_number()) %>%
  ungroup() %>%
  mutate(
    energy_requirement = dplyr::case_when(
      age < 1                                          ~ 595,
      age >= 1  & age <= 3                             ~ 1110,
      age >= 4  & age <= 6                             ~ 1360,
      age >= 7  & age <= 9                             ~ 1700,
      (age >= 10 & age <= 12) & (gender %in% c("1","3")) ~ 2220,
      (age >= 10 & age <= 12) & (gender == "2")        ~ 2060,
      (age >= 13 & age <= 15) & (gender %in% c("1","3")) ~ 2860,
      (age >= 13 & age <= 15) & (gender == "2")        ~ 2400,
      (age >= 16 & age <= 18) & (gender %in% c("1","3")) ~ 3320,
      (age >= 16 & age <= 18) & (gender == "2")        ~ 2500,
      (age >= 19) & (gender %in% c("1","3"))           ~ 2710,
      (age >= 19) & (gender == "2") & (child_under_1 == 0) ~ 2130,
      (age >= 19 & age < 50) & (gender == "2") &
        (child_under_1 == 1) & (seq <= n_child_under_1)   ~ 2690,
      (age >= 19 & age < 50) & (gender == "2") &
        (child_under_1 == 1) & (seq > n_child_under_1)    ~ 2130,
      (age >= 50) & (gender == "2")                    ~ 2130
    )
  ) %>%
  mutate(
    AFE_energy   = energy_requirement / 2130,
    share_energy = AFE_energy / sum(AFE_energy),
    .by = hhid
  )

2.3 Key Covariates

The models include a continuous income measure and multiple categorical covariates:

Variable Description Role in Model
log_mpce_real_afe Log real MPCE per AFE (2023–24 prices) Continuous — Engel curve driver
state_code Indian state (~36 levels) Factor-smooth interaction + random effect
sector Rural (1) or Urban (2) Random effect
nss_region NSS sub-state region (~80+ levels) Random effect
reg_sector Interaction: NSS region × sector Random effect
social Social group: ST (1), SC (2), OBC (3), Others (9), residual (0) Factor-smooth interaction + random effect
rel Religion: Hindu (1), Islam (2), Christian (3), residual (0) Factor-smooth interaction + random effect
child Presence of children in household Factor-smooth interaction + random effect
female_headed Female-headed household indicator Factor-smooth interaction + random effect
seasonal Seasonal/temporary employment indicator Factor-smooth interaction + random effect (select items)

2.4 Survey Weights

Weights are rescaled by household AFE size and then normalized:

$$w_i^{\,\text{pc}} = \frac{w_i \times \text{HH Size (AFE)}_i}{\,\overline{w \times \text{HH Size (AFE)}}\,}$$

This ensures that each household’s weight reflects the number of adult female equivalents it represents.

3. The Hurdle Model for Food Consumption

3.1 Why a Hurdle Model?

Many food items are not consumed by all households. For example, flesh foods may be consumed by only 30–40% of households in certain states. A single regression model would conflate the decision to consume with the quantity decision. The hurdle model[3][4] separates these:

Household decision process:
   Step 1: Does the household consume item m at all?
           → Modeled by logit (participation model)
   
   Step 2: If yes, how much?
           → Modeled by Gamma or Log-Normal (conditional quantity model)

3.2 Part 1: Participation Model (Logit)

The probability that household \(i\) consumes food item \(m\) is a logistic GAM (quasi-binomial, logit link) that shares the exact same right-hand side as the quantity model. Writing \(\ell_i = \log(\text{MPCE}^{\text{AFE},\,2023}_i)\) for log real per-AFE monthly expenditure (2023 rupees):

$$\text{logit}\,P(\text{cons}_i = 1) = \mathbf{x}_i'\boldsymbol\beta \;+\; f(\ell_i) \;+\; f_{\text{state}(i)}(\ell_i) \;+\; \sum_{g} \delta_g(\ell_i) \;+\; u_{\text{state}(i)} + u_{\text{region}(i)} + u_{\text{reg\_sec}(i)}$$

The right-hand side combines five kinds of terms (exactly the make_formula() specification in the code):

1. Parametric fixed effects — \(\mathbf{x}_i'\boldsymbol\beta\): constant level shifts in the log-odds for sector (rural/urban), child (any child present), female_headed, social (social group), and rel (religion). These enter as ordinary parametric terms — not random effects.

2. Global income (Engel) curve — \(f(\ell)\): a thin-plate regression spline (k = 10) giving the income–participation relationship for the reference levels of the factors above.

3. State-specific income deviations — \(f_{\text{state}}(\ell)\): a factor-smooth, s(ℓ, state_code, bs = "fs", k = 5, m = 1), letting each state have its own income curve while shrinking toward the global one.[7]

4. Demographic income-gradient shifts — \(\delta_g(\ell)\): ordered-factor difference smooths s(ℓ, by = g_o, k = 5) for child, female-headship, social group, and religion. Each is the deviation of that group's income gradient from the reference level's, so the Engel curve can bend differently across demographic groups.

5. Geographic random intercepts — \(u\): Gaussian random effects s(state_code, bs="re"), s(nss_region, bs="re"), and s(reg_sector, bs="re"), where reg_sector = nss_region × sector is a derived factor that lets the rural/urban gap vary by region. These partially pool small groups toward the mean.

Seasonal items. For items with strong seasonal consumption patterns (fruits, other vegetables, green leafy vegetables, roots & tubers), the formula additionally includes a parametric seasonal (survey-month) main effect and a seasonal income-gradient difference smooth s(ℓ, by = seasonal_o, k = 5). Non-seasonal items omit these terms entirely.

3.3 Part 2: Conditional Quantity Model

For households with positive consumption (\(q_i > 0\)), the quantity is modeled with the same covariate structure as the logit model, but using a continuous response family.

3.3.1 Model Selection: Gamma vs. Log-Normal

Two candidate models are estimated for each food item:

Model Response Family Link
Gamma \(q_i\) (raw grams) \(\text{Gamma}\) \(\log\)
Log-Normal \(\log(q_i)\) \(\text{Gaussian}\) identity

Selection criterion: The model with the lower AIC is retained, after applying a Jacobian correction to ensure comparability across families. Because the lognormal is parameterised on the log-scale while the Gamma is parameterised on the original scale, their raw log-likelihoods are not directly comparable; the Jacobian of the log-transformation (−Σ log yᵢ) is added to the lognormal log-likelihood before computing its AIC. This corrected, data-driven choice accommodates the fact that different food items have different distributional properties — cereals (consumed daily in large amounts) may suit a different family than oilseeds & nuts (consumed irregularly in small amounts).

Estimation details (common to both candidates):

Setting Value Rationale
Method Fast REML (fREML)[8] Smoothing parameter selection
Discrete method Enabled Computational efficiency for large datasets
Gamma penalty \(\gamma = 1.4\) Guards against overfitting[2]
Selection select = TRUE (participation & Gamma-quantity fits)[9] Adds an extra penalty so unnecessary smooth / random-effect terms can shrink to zero; the log-normal candidate is fit without it
Weights Normalized survey weights \(w_i^{\text{pc}} = w_i / \bar{w}\)

3.4 Why Factor-Smooth Interactions?

The bs = "fs" specification is central to the model. It allows each level of a grouping factor (e.g., each state) to have its own smooth Engel curve, while penalizing deviations from the global curve:

$$f_k(x, g) = f(x) + f_g(x)$$

where \(f_g(x)\) is the group-specific deviation, subject to a first-order penalty that shrinks it toward zero.

This captures important economic realities:

  1. State-level variation: The relationship between income and milk consumption is fundamentally different in Punjab (strong dairy culture) versus Meghalaya (limited dairy tradition). A single national Engel curve would miss this.

  2. Demographic heterogeneity: Households with children may have a steeper income gradient for fruits and vegetables (as income rises, parents invest more in child nutrition) compared to child-free households.

  3. Automatic shrinkage: States or groups with few observations are shrunk toward the national pattern, preventing noisy estimates.

3.5 Near-Universal Participation (Deterministic Hurdle)

Some staples are consumed by essentially every household — for example cereals & millets, where fewer than one household in a thousand reports zero. For such items the binary participation response is almost all ones, so the logistic model is quasi-completely separated: under penalization it can collapse to a meaningless flat probability, and even when its mean is sensible it may fail to converge, leaving a degenerate participation interval that then corrupts the participation × quantity product.

The estimation code guards against this. Before fitting, it computes the survey-weighted share of consumers, \(\hat p = \big(\sum_i w_i^{\text{pc}}\,\text{cons}_i\big) / \big(\sum_i w_i^{\text{pc}}\big)\). If \(\hat p \ge 0.98\) the participation model is skipped entirely and participation is treated as deterministic, \(P_i \equiv 1\). The reported total then reduces to the conditional-quantity mean carrying a proper credible interval, and participation is reported as exactly 1 with a null interval.

For items that are not near-universal but whose penalized fit still collapses — its model-implied mean participation diverging from the observed proportion by more than 5 percentage points — the code falls back to an unpenalized, income-only participation model, \(\text{cons} \sim s(\ell)\), which identifies cleanly on the genuine non-consumers.

4. Prediction Grid Construction

Before generating predictions, the analysis constructs standardized prediction grids that control for confounding when comparing groups. This is a critical step: raw comparisons between, say, rural and urban consumption would conflate the true sector effect with differences in the geographic and demographic composition of each sector.

4.1 The Standardization Problem

Consider comparing fruit consumption between rural and urban India. Urban households are disproportionately located in richer states (Maharashtra, Karnataka) and have different demographic profiles (fewer children, different religious composition). A naive rural–urban comparison would mix three effects: the actual sector effect on consumption, geographic composition differences, and demographic composition differences.

The prediction grid solves this by constructing a counterfactual population where all non-focal variables are held at the same national distribution.

4.2 Grid Construction Logic

The comparison uses g-computation (standardization by prediction), not a re-weighted synthetic grid. The idea is simple: take the entire observed national sample of households — each with its real expenditure, sector, demographics and location — and, for each level of the focal variable, build a counterfactual copy of that same sample in which every household is assigned that level, holding all other covariates at their observed values. The fitted model predicts each household's participation and quantity, and these are averaged (survey-weighted) within each expenditure decile.

Because the same national population underlies every level, the income and demographic composition is identical across levels by construction. Any difference between, say, two states is therefore attributable to the focal variable alone — it cannot come from one state being richer or having more children, because those are held fixed at the national mix.

The only subtlety is the derived geographic terms. Because reg_sector = nss_region × sector (and, for a state counterfactual, nss_region itself) become inconsistent once geography is reassigned — a household's real region no longer matches its counterfactual state — the code excludes those terms from the counterfactual prediction so they contribute nothing. Which terms are dropped depends on the comparison:

Standardization by comparison type (g-computation):

  STATE        set state_code = X for ALL households
               → drop s(nss_region) and s(reg_sector)   [stale under counterfactual]
               → each household keeps its own income, sector, demographics

  NSS REGION   set nss_region = R for ALL households
               → also set state_code = parent state of R (first 2 digits of code)
               → drop s(reg_sector)

  SECTOR       set sector = rural / urban for ALL households
               → drop s(reg_sector)

  DEMOGRAPHIC  set social / religion / child / female_headed = level for ALL
               → geography untouched; nothing excluded

What “drop” means. A household's prediction is a sum of pieces — global mean + income curve + state effect + region effect + region×sector effect + demographics. To drop a term (predict(…, exclude = …)) is to leave it out of that sum, i.e. set its contribution to zero. Since s(nss_region) and s(reg_sector) are random-effect terms (deviations centred at zero), excluding one simply uses its neutral / average value — no region-specific bump. We drop them under a geographic counterfactual because each household still carries its real region, which is now inconsistent with the reassigned state (and a rebuilt region×sector can be a combination never seen in fitting). The result is “the state at the average region,” net of within-state region and region×sector variation. The parametric sector main effect is not dropped — only the region×sector random deviation is — so the rural/urban level shift is retained.

4.3 Worked Example: Comparing States and NSS Regions

State comparison — Bihar vs. Punjab. Begin with all \(N\) households in the survey round, carrying their actual expenditure, sector, religion, household composition and location.

  1. Make a counterfactual copy in which state_code = Bihar for every household — income, sector and demographics are left untouched. Because each household's real NSS region no longer belongs to Bihar, drop the s(nss_region) and s(reg_sector) terms from the prediction.

  2. Predict each household's participation and quantity. Every prediction combines that household's own income and demographics with Bihar's state intercept and Bihar's state-specific income (Engel) curve.

  3. Average the predictions with survey weights within each expenditure decile (and once more overall, at the population-mean income, for the “Overall” summary row).

  4. Repeat the whole procedure with state_code = Punjab.

The Bihar and Punjab curves are computed on the identical national population, so their difference is the pure state effect: what consumption would look like if the whole country faced Bihar's versus Punjab's state-level conditions, at one common income and demographic mix.

NSS region comparison — “BR: Central” vs. “PB: Northern”. The procedure is identical, but the focal variable is nss_region: every household is assigned the chosen region. Because a region code's first two digits identify its state, the code simultaneously sets state_code to that region's parent state (e.g. BR → Bihar), so the region effect and its parent-state effect move together; only s(reg_sector) is dropped. The contrast is therefore the combined region-plus-state effect, again net of income and demographic composition.

Why not simply compare the households actually living in each state? Because states differ in income and demographics: a raw Bihar–Punjab gap would blend the state effect with Punjab being richer and Bihar having a younger population. Assigning the same national population to each state strips out that confounding. This is the same mechanism behind the Christian flesh-food pattern — the unadjusted figure reflects where a group lives, while the standardized figure holds geography at the national mix.

What about income — is it standardized too? No. Income is not reassigned; only the focal variable is. Each household keeps its actual MPCE, and every prediction is made at that real income. The expenditure decile is purely a reporting grouping: households are binned by their real (national) income decile, and the counterfactual predictions are survey-weight-averaged within each bin. Because the compared levels (Bihar, Punjab) use the very same households, the income distribution inside a given decile is identical across levels — which is precisely what “compared at the same income” means. The MPCE printed for a cell is simply the survey-weighted mean income of the households in that decile. Tracing the ten deciles therefore shows how the state (or region) effect varies across the income distribution, without ever moving anyone's income. A separate “Overall” row aggregates across all deciles at each level's population-mean income, giving the marginal group summary shown in the dashboard cards.

4.4 Expenditure Binning

For the standardized comparison, households are assigned to expenditure deciles cut on the national real-MPCE (per-AFE, 2023 ₹) distribution — the same cutpoints for every level being compared, so a given decile denotes the same income band across, say, Bihar and Punjab. (The purely descriptive, unadjusted group breakdowns instead cut deciles within each group.)

Bin Label Definition
1 0–10 Below the 10th percentile of the national real-MPCE distribution
2 10–20 10th to 20th percentile
… … …
10 90–100 Above 90th percentile
Overall Overall Full population (weighted mean MPCE)

The cutpoints (\(q_{10}, q_{20}, \ldots, q_{90}\)) are computed within each group (e.g., separately for rural and urban) to ensure that each bin contains approximately 10% of the group’s weighted population. This means the same income level (say ₹2,000/month) may fall in different deciles for different groups.

4.5 Seasonal Model Variation

Food items with strong seasonal consumption patterns (fruits, other vegetables, green leafy vegetables, roots & tubers) include seasonal as a covariate. The grid construction respects this:

5. Posterior Simulation and Uncertainty Propagation

The prediction pipeline propagates two sources of uncertainty through to the final estimates: model parameter uncertainty (from the GAM coefficients) and survey sampling uncertainty (from the complex survey design).

5.1 Overview of the Prediction Pipeline

Preliminary: Load pre-fitted models (participation + quantity);
             construct standardized (counterfactual) populations
Step 1: Validate each model's covariance matrix (positive-definite)
Step 2: Draw coefficient vectors from the FSU-clustered robust (CR1) sandwich (MVN)
Step 3: Retransform quantity predictions to the raw grams scale (fixed smearing)
Step 4: Compute household-level predictions P and E[Y] (chunked for memory)
Step 5: Aggregate to group × decile level (survey-weighted)
Step 6: Design-based uncertainty carried through the clustered draws (single set)
Step 7: Summarize each cell across draws (mean, 95% credible interval)

5.2 Step 1: Covariance Matrix Validation

Before drawing coefficients, the posterior covariance matrix \(\mathbf{V}_p\) must be positive definite.[2] Numerical issues in large GAM fits can occasionally produce matrices with near-zero or negative eigenvalues. Two repair strategies are available:

Method Approach When used
nearPD Finds nearest positive definite matrix (Frobenius norm) Default; more accurate
jitter Adds \(\varepsilon \cdot \mathbf{I}\) to diagonal Fallback; faster

The validation checks all eigenvalues: \(\lambda_{\min}(\mathbf{V}_p) > 10^{-10}\).

5.3 Step 2: Draw Coefficient Vectors

Let \(\hat{\boldsymbol{\beta}}\) denote the estimated coefficients. Rather than the model-based (penalized) covariance \(\mathbf{V}_p\) — which treats households as independent and so understates uncertainty under a clustered survey design — the draws use a FSU-clustered robust (CR1) sandwich covariance:

$$\mathbf{V}_{\text{robust}} = \mathbf{V}_p\Big(\textstyle\sum_{c} \mathbf{s}_c\,\mathbf{s}_c'\Big)\mathbf{V}_p \cdot \text{(CR1)}, \qquad \boldsymbol{\beta}^{(m)} \sim \mathrm{N}\!\left(\hat{\boldsymbol{\beta}},\; \mathbf{V}_{\text{robust}}\right)$$

where \(\mathbf{s}_c\) is the sum of household score contributions within primary sampling unit (FSU) \(c\), and CR1 is the small-sample cluster correction. The matrix is projected to the nearest positive-definite form and draws are taken with mvnfast::rmvn() (\(M = 200\) by default). Separate draws are made for the participation model (\(\boldsymbol{\alpha}^{(m)}\)) and the quantity model (\(\boldsymbol{\beta}^{(m)}\)). If the clustered sandwich cannot be formed, the code falls back to the penalized covariance \(\mathbf{V}_p\) (with smoothing-parameter uncertainty, unconditional = TRUE).

5.4 Step 3: Retransformation to the Raw Scale

The conditional-quantity model is fit on a transformed scale, so its predictions must be mapped back to grams. The retransformation constant is held at its point estimate — it is not resampled across draws.

Log-Normal model. The conditional mean on the raw scale is \(\mathbb{E}[q \mid q>0] = \exp(\eta_q + \hat{\sigma}^2/2)\), where \(\hat{\sigma}^2\) is the fitted residual variance and \(\delta = \hat{\sigma}^2/2\) is the smearing correction[4] for the log transform. It is computed once from the fitted model and reused for every draw.

Gamma (log-link) model. The conditional mean is already \(\mathbb{E}[q \mid q>0] = \exp(\eta_q)\); because the model is fit directly on the raw grams scale, no smearing term is required (\(\delta = 0\)).

In both cases the household prediction is formed in log space as \(\exp\!\big(\log P_i + \eta_{q,i} + \delta\big)\), which avoids the underflow-\(\times\)-overflow that can otherwise produce NaN from an extreme sandwich draw.

5.5 Step 4: Compute Household-Level Predictions (Chunked)

Predictions are computed in memory-efficient blocks (default: 2,000 rows per block) to handle the large prediction grids. For each block of rows in the grid:

4a. Linear predictors via the lpmatrix:

$$\boldsymbol{\eta}_L = \mathbf{X}_L \cdot \mathbf{B}_L^\top \qquad \boldsymbol{\eta}_Q = \mathbf{X}_Q \cdot \mathbf{B}_Q^\top$$

where \(\mathbf{X}_L\) and \(\mathbf{X}_Q\) are the design matrices from predict(..., type = "lpmatrix"), and \(\mathbf{B}_L\), \(\mathbf{B}_Q\) are the \(M \times p\) matrices of coefficient draws. The matrix cross-product tcrossprod() yields an \(n_{\text{block}} \times M\) matrix of predictions in a single operation.

4b. Transform to response scale:

Probability: \(\hat{p}_i^{(m)} = \text{logit}^{-1}(\eta_{L,i}^{(m)})\)

Conditional mean (log-normal): \(\hat{\mu}_i^{(m)} = \exp(\eta_{Q,i}^{(m)} + \delta^{(m)})\)

Conditional mean (Gamma): \(\hat{\mu}_i^{(m)} = \exp(\eta_{Q,i}^{(m)})\)

4c. Expected unconditional quantity:

$$\widehat{EY}_i^{(m)} = \hat{p}_i^{(m)} \times \hat{\mu}_i^{(m)}$$

4d. Posterior predictive draws (full distributional draws, not just means):

For the log-normal case:

$$Y_{\text{pos},i}^{(m)} \sim \text{LogNormal}\!\left(\eta_{Q,i}^{(m)},\; (\sigma^{(m)})^2\right)$$

For the Gamma case:

$$Y_{\text{pos},i}^{(m)} \sim \text{Gamma}\!\left(\text{shape}^{(m)},\; \hat{\mu}_i^{(m)} \cdot \phi^{(m)}\right)$$

The unconditional posterior predictive combines a Bernoulli draw with the conditional draw:

$$Z_i^{(m)} \sim \text{Bernoulli}(\hat{p}_i^{(m)}), \qquad Y_{\text{uncond},i}^{(m)} = Z_i^{(m)} \times Y_{\text{pos},i}^{(m)}$$

5.6 Step 5: Weighted Aggregation to Group × Decile Level

Within each block, predictions are accumulated into group-level weighted sums. For each group \(g\) (defined by the grouping variable × expenditure bin):

$$\bar{p}_{g}^{(m)} = \sum_{i \in g} \tilde{w}_i \cdot \hat{p}_i^{(m)}$$

where \(\tilde{w}_i = w_i / \sum_{j \in g} w_j\) are the normalized within-group weights. The same weighted averaging is applied to \(\hat{\mu}_i^{(m)}\), \(\widehat{EY}_i^{(m)}\), \(Y_{\text{pos},i}^{(m)}\), and \(Y_{\text{uncond},i}^{(m)}\).

The result is a set of \(M\) draws for each group × bin combination, stored as list-columns:

Draw variable Description
p_pos_g Group-level probability draws (M values)
mu_pos_g Group-level conditional mean draws
EY_uncond_g Group-level unconditional mean draws (\(p \times \mu\))
Ypos_ppc_g Group-level conditional posterior predictive draws
Yuncond_ppc_g Group-level unconditional posterior predictive draws

5.7 Step 6: Design-Based Uncertainty (Clustered Sandwich)

The complex-survey sampling uncertainty is already built into the coefficient draws: the FSU-clustered robust (CR1) sandwich of Step 2 replaces the independence-assuming model covariance, so every one of the \(M\) draws propagates the design clustering directly. There is therefore a single set of draws and no separate survey-variance pass — the clustered sandwich together with the survey weights delivers design-consistent standard errors in one step.

Concretely, for each draw \(m\) the household predictions (Step 4) are aggregated with the survey weights (Step 5) into a group × decile mean; the \(M\) resulting values form the sampling distribution of that cell's estimate. No post-hoc “injection” of additional survey noise is applied.

Why one source suffices. Drawing coefficients from the clustered sandwich already reflects both the imprecision of the smooth Engel curves / random effects and the fact that households are sampled in clusters (FSUs) rather than independently. For well-identified quantities (e.g. national cereal consumption) the intervals are tight; for thin cells (e.g. tribal households in small north-eastern states) they widen accordingly.

5.8 Step 7: Final Summary Statistics

The \(M\) survey-adjusted draws for each group × bin are summarized into:

Statistic Description
mean Posterior mean of unconditional consumption (grams/day)
median Posterior median
q2.5 2.5th percentile (lower bound of 95% credible interval)
q97.5 97.5th percentile (upper bound of 95% credible interval)
mean_p Posterior mean of probability of consuming
q2.5_p Lower bound of 95% CI for probability
q97.5_p Upper bound of 95% CI for probability

6. Output Variables

The prediction pipeline produces the following variables for each food item × grouping variable × group level × decile bin:

Variable Description
nss Survey round (HCES2011 or HCES2023)
var_n Grouping variable name (e.g., “sector”, “religion”)
group_n Group level name (e.g., “Rural”, “Hindu”)
item_n Food item category
bin MPCE decile bin (0–10, 10–20, …, 90–100, Overall)
log_mpce_real_afe Mean log real MPCE per AFE in the bin
mpce_real_afe_2011 Mean real MPCE per AFE (₹, 2023–24 prices)
mean Posterior mean of unconditional consumption (grams/day)
q2.5 2.5th percentile (lower bound of 95% credible interval)
q97.5 97.5th percentile (upper bound of 95% credible interval)
mean_p Posterior mean of probability of consuming
q2.5_p Lower bound of 95% CI for probability
q97.5_p Upper bound of 95% CI for probability
mean_ess Effective sample size for the group × bin cell

7. Visualization

7.1 Engel Curve Plots

The primary visualization is a pair of Engel curves — the relationship between household expenditure and food consumption — plotted for each food item across demographic groups:

Top panel: Proportion consuming (%)
   → Y-axis: Estimated share of people consuming the food item
   → X-axis: Monthly per capita expenditure (₹, 2023-24 prices, log scale)
   → Faceted by group level within grouping variable

Bottom panel: Average quantity consumed (grams)
   → Y-axis: Estimated daily consumption per AFE
   → X-axis: Same as above
   → Reference lines at ICMR-NIN daily requirements

Key visual elements:

7.2 Cross-Sectional Plots (Single Survey Round)

For state-level comparisons within HCES 2023–24, an alternative visualization displays:

These are combined into multi-panel grids (3 × 2 for six regions, or 3 × \(n\) for demographic variables) using the magick package for image composition.

7.3 Suite of Analyses

The batch processing generates figures across all combinations of:

Dimension Levels
Food items 10 categories
Grouping variables sector, social, religion, child, female_headed, seasonal, state
Metrics proportion, quantity
Survey rounds 2011–12, 2023–24 (combined) or 2023–24 only

For state-level analyses, figures are further organized by geographic region.

8. Computational Implementation

8.1 Parallel Model Estimation

Each of the 10 food items requires two models (logit + quantity) for each of two survey rounds, yielding 40 model fits. These are estimated in parallel:

Architecture:
   → future_lapply() with 4 worker processes
   → Each worker: fits models for one food item × both rounds
   → Models saved to item-specific directories

Directory structure:

~/data/bam_models/CoAHD/
   ├── cereal_millets/
   │   ├── cereal_millets_model.RData
   │   ├── data_prop_quantity_cereal_millets_sector.RData
   │   ├── data_prop_quantity_cereal_millets_rel.RData
   │   └── ...
   ├── green_leafy_vegetables/
   │   └── ...
   └── ...

Each model .RData file contains a list with:

Object Contents
HCES2011_model Models and data for the 2011–12 round
HCES2023_model Models and data for the 2023–24 round
model_l Logit (participation) model
model_q Quantity model (Gamma or Log-Normal, AIC-selected)
model_info String: “Gamma (log link)” or “log normal”
data Analysis dataset used for fitting

8.2 Prediction Data Generation Pipeline

The figure data generation is the most computationally intensive step. It is orchestrated by a batch processing function that runs across all item × grouping variable combinations in parallel.

Batch Processing Architecture:

   Input: 10 food items × 7 grouping variables = 70 jobs
          (each job = 2 survey rounds)

   For each job (item × grouping_var):
      1. Load pre-fitted models for the item (participation + quantity)
      2. Load MPCE decile cutpoints for the grouping variable
      3. Construct the standardized (counterfactual) population
      4. Draw M=200 coefficient vectors (MVN) from the FSU-clustered
         robust (CR1) sandwich covariance
      5. Compute household predictions in chunks (P and E[Y])
      6. Aggregate to group × decile with survey weights
      7. Summarize each cell across draws (mean + 95% credible interval)
      8. Save to item-specific .RData file

   Parallelization:
      → parallel::mclapply() across jobs (auto-detected workers)
      → Each job: a few minutes per item × group × round

8.3 System Resource Management

The pipeline includes adaptive resource management to prevent memory exhaustion:

Constraint Calculation Purpose
Core limit detectCores() - 1 Leave one core for system
Memory limit (total RAM - 4 GB) / 2 GB per job Prevent swapping
Job limit Number of remaining jobs Don’t oversubscribe
Optimal workers min(core, memory, job) Balance throughput and stability

8.4 Output File Organization

Each food item × grouping variable combination produces a prediction file:

~/data/bam_models/CoAHD/<item>/
   ├── <item>_model.RData                              (fitted models)
   ├── data_prop_quantity_<item>_sector.RData           (sector predictions)
   ├── data_prop_quantity_<item>_rel.RData              (religion predictions)
   ├── data_prop_quantity_<item>_social.RData           (social group predictions)
   ├── data_prop_quantity_<item>_child.RData            (child presence predictions)
   ├── data_prop_quantity_<item>_female_headed.RData    (female headship predictions)
   ├── data_prop_quantity_<item>_seasonal.RData         (seasonal predictions)
   └── data_prop_quantity_state_<item>_sector.RData     (state-level predictions)

All results are also compiled into a single Excel workbook (data_prop_quantity.xlsx) with two sheets: the full dataset and a variable descriptions sheet.

9. Summary of Model Assumptions

The key assumptions underlying this framework:

  1. Hurdle structure: The decision to consume and the quantity consumed are modeled as separate processes. This is appropriate when many households report zero consumption for a given food item.

  2. Smooth Engel curves: The relationship between income and consumption is assumed to be a smooth (but potentially nonlinear) function. The factor-smooth specification allows this curve to vary by group while borrowing strength across groups.

  3. Distributional assumption for quantity: The conditional quantity follows either a Gamma or Log-Normal distribution (selected by AIC). Both accommodate positive, right-skewed data typical of consumption quantities.

  4. Fixed vs. random effects: Sector, child presence, female-headship, social group, and religion enter as parametric fixed effects; only the geographic factors — state, NSS region, and region × sector — enter as Gaussian random effects, implying partial pooling (shrinkage) toward the grand mean for those.

  5. Posterior normality of coefficients: Coefficients are drawn from a multivariate normal centered at the penalized MLE — the standard Laplace approximation, accurate for large samples.

References

[1] ICMR-NIN (2024). Recommended Dietary Allowances and Estimated Average Requirements for Indians. Indian Council of Medical Research – National Institute of Nutrition, Hyderabad.
[2] Wood, S.N. (2017). Generalized Additive Models: An Introduction with R (2nd ed.). Chapman and Hall/CRC.
[3] Cragg, J.G. (1971). Some statistical models for limited dependent variables with application to the demand for durable goods. Econometrica, 39(5), 829–844.
[4] Mullahy, J. (1998). Much ado about two: reconsidering retransformation and the two-part model in health econometrics. Journal of Health Economics, 17(3), 247–281.
[5] National Sample Survey Office (2013). Household Consumer Expenditure Survey 2011–12 (68th Round). Ministry of Statistics and Programme Implementation, Government of India.
[6] Ministry of Statistics and Programme Implementation (2024). Household Consumer Expenditure Survey 2023–24. Government of India.
[7] Gelman, A. (2006). Multilevel (hierarchical) modeling: What it can and can't do. Technometrics, 48(3), 432–435.
[8] Wood, S.N., Goude, Y. & Shaw, S. (2015). Generalized additive models for large data sets. Journal of the Royal Statistical Society: Series C, 64(1), 139–155.
[9] Li, R. & Shively, T.S. (2008). Variable selection in semiparametric regression modeling. Annals of Statistics, 36(1), 261–286.

Appendix: Glossary of Terms

AFE (Adult Female Equivalent): A standardization method to account for different caloric needs based on age and gender. The reference unit is an adult woman weighing 55kg.

AIC (Akaike Information Criterion): A measure of model fit that penalizes complexity. Lower AIC indicates a better trade-off between fit and parsimony. Used here to select between Gamma and Log-Normal quantity models.

bam(): The mgcv package function for fitting generalized additive models to large datasets, using discretized covariates and fast REML for efficiency.

Credible Interval: The Bayesian analogue of a confidence interval. A 95% credible interval contains the true parameter value with 95% posterior probability, given the model and data.

Coefficient of Variation (CV): The ratio of the standard error to the mean, \(\text{CV} = \text{SE}/\bar{x}\) — a unitless measure of relative precision.

Decile: Division of population into 10 equal groups based on expenditure levels (Decile 1 = poorest 10%).

Delta Method: A statistical technique for approximating the variance of a transformed variable. If \(g(\hat{\theta})\) is a function of an estimator, then \(\text{Var}(g(\hat{\theta})) \approx [g'(\hat{\theta})]^2 \cdot \text{Var}(\hat{\theta})\).

Engel Curve: The relationship between household income (or expenditure) and consumption of a particular good. Named after the 19th-century statistician Ernst Engel.

Factor-Smooth Interaction (bs = "fs"): A penalized smooth term in mgcv that allows each level of a factor to have its own smooth curve, with deviations from the global curve penalized. Achieves group-specific nonlinear effects with automatic shrinkage.

fREML (Fast REML): Fast restricted maximum likelihood — the method used for smoothing parameter estimation in mgcv::bam().

GAM (Generalized Additive Model): A flexible regression framework that allows non-linear relationships and random effects through penalized smooth terms.

Geographic Standardization: A technique for making group comparisons fair by holding the geographic distribution (state, region, sector) constant across groups. Without standardization, rural–urban differences would partly reflect the geographic concentration of rural populations in poorer states.

HCES: Household Consumer Expenditure Survey conducted by the National Sample Survey Office.

Hurdle Model: A two-part model that separately models (a) whether an event occurs and (b) the magnitude conditional on occurrence. Appropriate for data with excess zeros.

ICMR-NIN: Indian Council of Medical Research – National Institute of Nutrition. The body that establishes dietary guidelines for India (see [2]).

lpmatrix (Linear Predictor Matrix): The design matrix \(\mathbf{X}\) such that \(\mathbf{X}\boldsymbol{\beta}\) gives the linear predictor. Obtained from predict(..., type = "lpmatrix") in mgcv. Essential for posterior simulation because it allows vectorized computation of predictions across all coefficient draws simultaneously via matrix multiplication.

MPCE: Monthly Per Capita Expenditure — total household expenditure divided by household size (or by AFE units).

Posterior Predictive Draw: A simulated observation from the model’s predictive distribution, incorporating both parameter uncertainty (from coefficient draws) and observation-level randomness (from the assumed distribution). Distinguished from “posterior mean draws” which only reflect parameter uncertainty.

Survey Weights: Statistical weights assigned to each sampled household to make the sample representative of the population.

Last updated: February 2026