1 Introduction

Food expenditure forms an integral part of the total family (or household) expenditure and is often categorized into food at home (FAH), food away from home (FAFH), and food delivered at home (FDAH). This categorization is relevant from a health perspective and other reasons. First, the division permits us to analyze the nutrition quality of food among families. This is important, because there are health implications of consuming more FAFH, as it is considered to be less nutritious than FAH (Mancino et al. 2009) and more energy dense (Binkley 2008). Some authors have also linked more FAFH to overweight and obesity (Cai et al. 2008). Second, the division allows us to answer interesting policy-oriented questions. For example, what is the effect of a female-headed family on FAH expenditure or does having a home mortgage reduce FAH and/or FAFH expenditures? Third, food assistance programs are often designed to minimize the health risks arising from deficient nutrition particularly among unemployed and lower income groups. This categorization can help assess the efficacy of food assistance program on FAH expenditure of the vulnerable groups, particularly during times of economic crisis.

As a result, the study of expenditure on FAH and FAFH has attracted considerable attention in the literature. Few previous studies using cross-section data include Lee and Brown (1986), Nayga (1996), Aguiar and Hurst (2005), and Liu et al. (2013). Lee and Brown (1986) employ a switching regression model on the 1977–78 Nationwide Food Consumption Survey data to examine expenditures on FAH and FAFH among the US households. Nayga (1996) utilizes the 1992 US consumer expenditure survey (CES) data to estimate the effect of wife’s education and employment on three subcategories of food expenditure—for prepared food, food prepared at home, and food away from home. The modeling scheme utilized is a generalized version of Heckman’s sample selection model (Heckman 1979). Aguiar and Hurst (2005) employs an instrumental variable linear regression to investigate, among other things, the effect of anticipated (i.e., retirement) and unanticipated (i.e., unemployment) shock to income on TF, FAH, and FAFH expenditures. The data are taken from the Continuing Survey of Food Intake of Individuals (CSFII, collected by the US Department of Agriculture) and corresponds to interviews conducted between 1989–1991 and 1994–1996, but the households are different in the two interviews. Liu et al. (2015) use a trivariate sample selection procedure to study patterns in FAFH expenditure among the Chinese households. In studies such as Liu et al. (2013), the use of the sample selection framework is motivated to account for the occurrence of zero expenditures, particularly on FAFH or in its subdivision (e.g., full-service restaurants, fast-food restaurants, and others). To get a more complete picture, readers may look into Table 1 of Davis (2014) for a brief summary of 17 articles (out of 20) on studies related to food expenditure using cross-section data.

The relationship of food expenditure (at home and away from home) to other covariates has been the focus of analysis in several cross-section studies. They include the relation of food expenditure (of various types) to consumer preferences (Stewart et al. 2005), family composition (Liu et al. 2013), race (Lanfranco et al. 2002), homeownership and mortgages (Nayga 1996; Mian et al. 2013), wife’s labor force participation (Redman 1980; Kinsey 1983; Darian and Klein 1989; Yen 1993; Nayga 1996), children’s welfare (Handa 1996), and obesity (Drichoutis et al. 2012). Some authors have also examined the effects of tax on food expenditure. For example, Zheng et al. (2019) examines the impact of tax on expenditure in grocery food (i.e., FAH) and restaurant food (i.e., FAFH) using a weekly data observed between April 2012 and January 2013, collected by United States Department of Agriculture (USDA). They find that tax on grocery (restaurant food) reduces expenditure on grocery (restaurant food) and increases expenditure on restaurant food (grocery).

The above paragraphs clearly indicate that there are ample cross-section studies on food expenditure, but panel or longitudinal studies are rather lacking with few exceptions. Cai et al. (2008) presents a state-level analysis of different types of food expenditure on overweight rates, obesity rates, and combined rates (the sum of overweight and obesity rates) using data from the Behavioral Risk Factor Surveillance System. The primary finding is that FAH (FAFH) expenditure is negatively (positively) associated to obesity and combined rates, and both FAH and FAFH expenditures do not significantly affect overweight rates. The only panel study mentioned in Davis (2014) is the article by Gelber and Mitchell (2012), where they use PSID and time diary data between 1975 and 2004, and find that for a decrease in income tax (i.e., incentive to join the labor force increases), single women are much more likely to increase FAFH expenditure to substitute for housework compared to single men. At the same time, the effect on FAH expenditure is statistically insignificant. Kohara and Kamiya (2016) use a panel data on Japanese households for the period 2004–2006 and find that mothers’ labor supply decision has a negative effect on food produced at home. Moreover, the negative effect is common for all economic classes and more pronounced for the low economic class. Besides, there are abundant studies that examine the impact on food expenditure from participating in Supplemental Nutrition Assistance Program (SNAP), formerly known as Food Stamp Program (FSP)Footnote 1. Few articles from this literatureFootnote 2 include Hoynes and Schanzenbach (2009), Wilde et al. (2009), Beatty and Tuttle (2014), and Burney (2018). However, these studies focus on the conditional mean of the response variable and thus cannot explain the relationship at the quantiles.

The current study takes a broader perspective and looks at expenditures on total food (TF), food at home (FAH), and food away from home (FAFH), and explains its variation based on various demographic, socioeconomic, and geographic factors including mortgage and recession. The data are taken from Panel Study of Income Dynamics (PSID) and are composed of 2174 family units observed over the period 2001–2015. Since ours is a panel data, we exploit a longitudinal or panel regression framework that can accommodate both common (fixed-effects) and individual-specific (random-effects) parameters (hence also known as mixed-effects model in Statistics)Footnote 3. However, mean longitudinal regression is not capable of capturing the heterogeneity in covariate effects across the conditional distribution of the response variable. To overcome this limitation, we study the heterogeneous effect of the covariates on food expenditure (TF, FAH, and FAFH) using a quantile model for longitudinal data that accommodates both common effects and individual-specific effects, also known as quantile mixed models.

This paper contributes to the literature in at least three different ways. First, quantile longitudinal regression provides a comprehensive understanding of food expenditure pattern of family units to variation in covariates by providing estimates at different quantiles. The method is robust compared to standard longitudinal models where the focus is on the mean, because among other things, it is unaffected by the presence of outliers in the data. Second, this study adds to the understanding of the differences in food expenditure pre, during, and after the Great Recession. This enables us to capture patterns linking recession and food expenditure by categories which we explore in this study. To our knowledge, this is the first attempt to examine the effects of the Great Recession on food expenditure at home and away from home within a quantile panel data framework. Third, longitudinal data allow us to model the behavior of family units over time, which provides an advantage to control for unobserved heterogeneity leading to more robust estimates. As shown in this paper, it is important to control for this repeated behavior, because models which treat unobserved heterogeneity as a part of error term often result in inconsistent estimates and may lead to incorrect policy inference.

The remaining paper is organized as follows. Section 2 lays out the basic framework of the mean regression and quantile regression models for longitudinal data that we employ in our analysis. Section 3 presents a descriptive summary of the data and discusses the trends in variables over the time period of our study. Section 4 presents the results from the aforementioned regression models and shows the consequences of not modeling individual-specific heterogeneity. Finally, Sect. 5 presents concluding remarks.

2 Methodology

This section presents the mean regression for longitudinal data model and outlines the Bayesian approach for its estimation (Chib and Carlin 1999; Greenberg 2012). Thereafter, we present the Bayesian quantile regression for longitudinal data model and its estimation algorithm, which is inspired from Luo et al. (2012) and Rahman and Vossmeyer (2019).

2.1 Mean regression for longitudinal data

The longitudinal data model can be expressed in terms of the following equation:

$$\begin{aligned} y_{it} = x'_{it}\beta + s'_{it}\alpha _{i} + \epsilon _{it}, \quad \forall i = 1,\ldots ,n, \quad t = 1,\ldots ,T, \end{aligned}$$
(1)

where \(y_{it}\) denotes the value of the response y for the ith individual at the tth time period, \(x'_{it}\) is a \(1 \times k\) vector of explanatory variables, \(\beta \) is \(k \times 1\) vector of common (fixed-effects) parameters, \(s'_{it}\) is a \(1 \times l\) vector of covariates (often a subset of \(x_{it}\)) with individual-specific effects, \(\alpha _{i}\) is an \(l \times 1\) vector of individual-specific (random-effects) parameters included to capture the marginal dependence between observations on the same individual, and \(\epsilon _{it}\) is the error term assumed to be independently and identically distributed (iid) as a normal distribution, i.e., \(\epsilon _{it} \overset{iid}{\sim } N(0, h^{-1})\) for all values of \(i=1,\ldots ,n\); \(t=1,\cdots ,T\), where \(h^{-1}\) is the variance. The distributional assumption on the error implies that \(y_{it}\) conditional on \(\alpha _{i}\) are independently distributed as a normal distribution, i.e., \(y_{it}|\alpha _{i} \sim N(x'_{it}\beta + s'_{it} \alpha _{i},h^{-1})\) for all \(i=1,\ldots ,n\); \(t=1,\ldots ,T\).

In this paper, the response variable y will either be TF, FAH, or FAFH expenditures. The vector \(x_{it}\) will consist of a common intercept and a host of covariates related to demographic, socioeconomic and geographic factors. Finally, the vector of covariates with individual-specific effects \(s'_{it}\) will consist of an intercept and inverse-hyperbolic sine transformation of income.

To proceed with the Bayesian estimation of the longitudinal model, we first stack the model for each individual i. This is convenient for multiple reasons including reducing the computational burden. We define \(y_{i} = (y_{i1},\ldots ,y_{iT})'\), \(X_{i} = (x'_{i1}, x'_{i2},\ldots ,x'_{iT})'\), \(S_{i} = (s'_{i1}, s'_{i2}, \ldots ,s'_{iT})'\), \(\epsilon _{i} = (\epsilon _{i1}, \ldots ,\epsilon _{iT})'\). The resulting stacked model can be written as:

$$\begin{aligned} \begin{aligned} y_{i} =&X_{i} \beta + S_{i}\alpha _{i} + \epsilon _{i}, \quad \text {for} \; i=1,\ldots ,n, \\&\alpha _{i}|\varSigma \sim N_{l}(0, \varSigma ), \\&\beta \sim N_{k}(\beta _{0}, B_{0}), \qquad \varSigma ^{-1} \sim Wish(\nu _{0}, D_{0}), \qquad h \sim Ga(c_{0}/2, d_{0}/2), \end{aligned} \end{aligned}$$
(2)

where we assume that \(\alpha _{i}|\varSigma \) are mutually independent and identically distributed as \(N_{l}(0, \varSigma )\), and the last line represents the prior distributions, with N, Wish, and Ga denoting the normal, Wishart, and gamma distributions, respectively. The model given by Eq. (2) implies that the conditional density \(y_{i}|\alpha _{i} \sim N( X_{i} \beta + S_{i}\alpha _{i}, h^{-1}I_{T})\) for \(i=1,\ldots ,n\). The complete data density is then given by:

$$\begin{aligned} f(y,\alpha |\beta ,h,\varSigma ) = \prod _{i=1}^{n} f(y_{i},\alpha _{i}|\beta ,h,\varSigma ) = \prod _{i=1}^{n} f(y_{i}|\beta ,\alpha _{i},h) \pi (\alpha _{i}|\varSigma ), \end{aligned}$$

which is equivalent to the complete data likelihood when viewed as a function of the parameters.

Algorithm 1

1. Sample \((\beta , \alpha )\) in one block as follows:

   (a) Let \(\varPsi _{i} = S_{i}\varSigma S_{i}'+ h^{-1}I_{T}\). Sample \(\beta \) marginally of \(\alpha \) from \(\beta |y,h,\varSigma \) \(\sim \) \(N\big ({\widetilde{\beta }}, {\widetilde{B}}\big )\), where,

      \({\widetilde{B}}^{-1} = \bigg (\sum \limits _{i=1}^{n} X'_{i} \varPsi _{i}^{-1} X_{i} + B_{0}^{-1} \bigg ), \quad \mathrm {and} \quad {\widetilde{\beta }} = {\widetilde{B}}\left( \sum \limits _{i=1}^{n}X_{i}'\varPsi _{i}^{-1} y_{i}+ B_{0}^{-1}\beta _{0} \right) .\)

   (b) Sample \(\alpha _{i}|y,\beta ,h,\varSigma \) \(\sim \) \(N\big ({\widetilde{a}}, {\widetilde{A}}\big )\) for \(i=1,\cdots ,n\), where,

      \({\widetilde{A}}^{-1} = \left( hS_{i}'S_{i} + \varSigma ^{-1}\right) , \quad \mathrm {and} \quad {\tilde{a}} = {\widetilde{A}} \Big (h S_{i}'\big (y_{i}-X_{i}\beta \big ) \Big ).\)

2. Sample \(\varSigma ^{-1}|\alpha \sim Wish\big (\nu _{1},D_{1}\big )\), where \(\nu _{1} = (\nu _{0} + n)\), and \(D_{1}^{-1} = \Big ( \displaystyle D_{0}^{-1}+ \sum \limits _{i=1}^{n}\alpha _{i}\alpha _{i}' \Big )\).

3. Sample \(h|y,\beta ,\alpha \) \(\sim \) \(Ga\big (c_{1}/2,d_{1}/2 \big )\) where:

      \(c_{1} = \left( c_{0} + nT\right) , \quad \mathrm {and} \quad d_{1} = d_{0} + \sum _{i=1}^{n}(y_{i}-X_{i} \beta -S_{i}{\alpha }_{i})'(y_{i}-X_{i}\beta -S_{i}{\alpha }_{i})\).

By Bayes’ theorem, the complete data posterior density can be written as product of the complete data likelihood times the prior distributions as follows:

$$\begin{aligned} \begin{aligned}&\pi (\beta , \alpha , \varSigma ^{-1},h|y) \propto \Big \{\prod _{i=1}^{n} f(y_{i}|\beta ,\alpha _{i},h) \pi (\alpha _{i}|\varSigma ) \Big \} \pi (\beta ) \pi (\varSigma ^{-1}) \pi (h)\\&\quad \propto h^{nT/2}\exp \bigg [-\frac{h}{2} \sum \limits _{i=1}^{n}(y_{i}-X_{i}\beta -S_{i} {\alpha }_{i})'(y_{i}-X_{i}\beta -S_{i}{\alpha }_{i})\bigg ]\\&\qquad \times |\varSigma |^{-\frac{n}{2}} \exp \bigg [-\frac{1}{2}\sum \limits _{i=1}^{n}\alpha _{i}'\varSigma ^{-1}\alpha _{i}\bigg ] \exp \Big [-\frac{1}{2}(\beta - \beta _{0})'B_{0}^{-1}(\beta - \beta _{0})\Big ] \\&\qquad \times |\varSigma ^{-1}|^\frac{(\nu _{0}-l-1)}{2} \exp \bigg [-\frac{1}{2}tr(D_{0}^{-1}\varSigma ^{-1})\bigg ] \times h^{\frac{c_{0}}{2}-1} \exp \bigg [-\frac{d_{0}h}{2}\bigg ]. \end{aligned} \end{aligned}$$
(3)

The conditional posterior distributions are derived from the complete data posterior (Eq. 3) and the model is estimated using Gibbs sampling, a well-known Markov chain Monte Carlo method (Geman and Geman 1984; Casella and George 1992). The MCMC algorithm for estimating the model is presented in Algorithm 1. The parameters \((\beta ,\alpha )\) are sampled jointly to avoid correlation between the parameters, because the covariates in \(s_{it}\) are often a subset of \(x_{it}\) (Greenberg 2012, Chap.10). Specifically, we first sample \(\beta \) (marginally of \(\alpha \), but conditional on other model parameters) from an updated normal distribution and then sampled \(\alpha \) (conditional on \(\beta \) and other model parameters) from its updated normal distribution. The precision matrix \(\varSigma ^{-1}\) is sampled from an updated Wishart distribution and, finally, the precision parameter h is sampled from an updated gamma distribution.

2.2 Quantile regression for longitudinal data

The quantile regression for longitudinal data can be expressed in terms of the following equation:

$$\begin{aligned} y_{it} = x'_{it}\beta + s'_{it}\alpha _{i} + \epsilon _{it}, \quad \forall i = 1,\ldots ,n, \quad t = 1,\ldots ,T, \end{aligned}$$
(4)

where all the notations are same as in Sect. 2.1, except that the errors are assumed to be i.i.d. as an asymmetric Laplace (AL) distribution, i.e., \(\epsilon _{it} \overset{iid}{\sim } AL(0,h^{-1},p)\), where \(h^{-1}\) is the inverse of the scale parameter and p denotes a quantile. This implies that \(y_{it}\), conditional on \(\alpha _{i}\), are independently distributed as an AL distribution, i.e., \(y_{it}|\alpha _{i} \sim AL(x'_{it} \beta + s'_{it}\alpha _{i}, h^{-1},p)\) for \(i=1,\cdots ,n\), \(t=1,\ldots ,T\). Note that the error distribution is assumed to be AL to form a working likelihood, because the quantile loss function appears in the exponent of an AL distribution (see Yu and Moyeed 2001; Rahman 2016). The resulting conditional quantile function for response \(y_{it}\) is:

$$\begin{aligned} Q_{y_{it}}(p|x_{it},\alpha _{i}) = x'_{it} \beta + s'_{it}\alpha _{i}, \end{aligned}$$

where \(Q_{y_{it}} \equiv F_{y_{it}}^{-1}(\cdot )\) is the inverse of the cumulative distribution function of the outcome variable conditional on the individual-specific parameters and the covariates.

We can directly work with the AL distribution; however, it is not convenient for Gibbs sampling. Therefore, as proposed in Kozumi and Kobayashi (2011), we make use of the normal–exponential mixture representation of the AL distribution:

$$\begin{aligned} \epsilon _{it} = h^{-1} \theta w_{it} + h^{-1} \tau \sqrt{w_{it}} \, u_{it}, \quad \forall \; i=1,\ldots ,n; \; t = 1, \ldots , T, \end{aligned}$$
(5)

where \(u_{it} \sim N(0,1)\) is mutually independent of \(w_{it} \sim {\mathcal {E}}(1)\), \(\theta = \frac{1-2p}{p(1-p)}\), \(\tau = \sqrt{\frac{2}{p(1-p)}}\), and the symbol \({\mathcal {E}}\) denotes an exponential distribution. The resulting quantile regression for longitudinal data model can be expressed as:

$$\begin{aligned} y_{it} = x'_{it}\beta + s'_{it}\alpha _{i} + \theta \nu _{it} + \tau \sqrt{h^{-1} \nu _{it}} \, u_{it}, \quad \forall i = 1,\ldots ,n, \quad t = 1,\ldots ,T, \end{aligned}$$
(6)

where we have used the transformation \(\nu _{it} = w_{it}/h\), since the presence of the scale parameter in the conditional mean is not conducive to Gibbs sampling (Kozumi and Kobayashi 2011; Rahman and Karnawat 2019). See also Bresson et al. (2020) and Ojha and Rahman (2020), where the scale is fixed at 1 to identify the parameters of quantile regression with binary outcomes.

To proceed with the Bayesian estimation, we again stack the model across i for reasons mentioned earlier. Define \(y_{i} = (y_{i1}, \ldots ,y_{iT})'\), \(X_{i} = (x'_{i1}, x'_{i2},\ldots ,x'_{iT})'\), \(S_{i} = (s'_{i1}, s'_{i2},\ldots ,s'_{iT})'\), \(D_{\tau \sqrt{\frac{\nu _{i}}{h}}} = diag(\tau \sqrt{\frac{\nu _{i1}}{h}}, \ldots ,\tau \sqrt{\frac{\nu _{iT}}{h}})\), \(u_{i} = (u_{i1}, \ldots ,u_{iT})'\), and, finally, \(\nu _{i} = (\nu _{i1}, \ldots ,\nu _{iT})'\). The resulting stacked quantile regression for longitudinal data can be written as:

$$\begin{aligned} \begin{aligned} y_{i} =&X_{i} \beta + S_{i}\alpha _{i} + \theta \nu _{i} + D_{\tau \sqrt{\frac{\nu _{i}}{h}}} \; u_{i}, \quad \text {for} \; i=1,\ldots ,n, \\&\alpha _{i}|\varSigma \sim N_{l}(0, \varSigma ), \qquad \nu _{it} \sim {\mathcal {E}}(1/h), \quad \quad \quad \qquad u_{it} \sim N(0,1), \\&\beta \sim N_{k}(\beta _{0}, B_{0}), \qquad \varSigma ^{-1} \sim Wish(\nu _{0}, D_{0}), \qquad h \sim Ga(c_{0}/2, d_{0}/2), \end{aligned} \end{aligned}$$
(7)

where we assume that \(\alpha _{i}|\varSigma \) are mutually independent and identically distributed as \(N_{l}(0, \varSigma )\), and the last line represents the prior distributions of the model parameters. The quantile model given by Eq. (7) implies that the conditional density \(y_{i}|\alpha _{i} \sim N(X_{i}\beta + S_{i} \alpha _{i} + \theta \nu _{i}, D^{2}_{\tau \sqrt{ \frac{\nu _{i}}{h}}})\) for \(i=1,\ldots ,n\). The complete data density is then given by \( f(y,\alpha |\beta ,v,h,\varSigma ) = \displaystyle \prod _{i=1}^{n} f(y_{i},\alpha _{i}|\beta ,\nu _{i},h,\varSigma ) = \displaystyle \prod _{i=1}^{n} f(y_{i}|\beta ,\alpha _{i},\nu _{i},h) \pi (\alpha _{i}|\varSigma )\).

Algorithm 2

1. Sample \((\beta , \alpha )\) in one block as follows:

   (a) Let \(\varOmega _{i} = \left( S_{i}\varSigma S'_{i} + D_{\tau \sqrt{\frac{\nu _{i}}{h}}}^{2}\right) \). Sample \(\beta \) marginally of \(\alpha \) from \(\beta |y,\nu ,\varSigma ,h\) \(\sim \) \(N\big ({\widetilde{\beta }}, {\widetilde{B}}\big )\), where,

      \({\widetilde{B}}^{-1} = \bigg (\sum \limits _{i=1}^{n} X'_{i} \varOmega _{i}^{-1} X_{i} + B_{0}^{-1} \bigg ), \quad \mathrm {and} \quad {\widetilde{\beta }} = {\widetilde{B}}\left( \sum \limits _{i=1}^{n}X_{i}'\varOmega _{i}^{-1} (y_{i}-\theta \nu _{i})+ B_{0}^{-1}\beta _{0} \right) . \)

   (b) Sample \(\alpha _{i}|y,\beta ,\nu ,h,\varSigma \) \(\sim \) \(N\big ({\widetilde{a}}, {\widetilde{A}}\big )\) for \(i=1,\ldots ,n\), where,

      \({\widetilde{A}}^{-1} = \left( S'_{i} \, D^{-2}_{\tau \sqrt{\frac{\nu _{i}}{h}}} \, S_{i} + \varSigma ^{-1}\right) , \quad \mathrm {and} \quad {\widetilde{a}} = {\widetilde{A}} \left( S'_{i} D^{-2}_{\tau \sqrt{\frac{\nu _{i}}{h}}} \, \big (y_{i} - X_{i} \beta - \theta \nu _{i} \big ) \right) .\)

2. Sample \(\nu _{it}|y_{it},\beta ,\alpha _{i},h\) \(\sim \) \(GIG \, \big (0.5, {\widetilde{\lambda }}_{it}, {\widetilde{\eta }}\big )\) for \(i=1,\ldots ,n\) and \(t=1,\ldots ,T\), where,

      \({\widetilde{\lambda }}_{it} = h\bigg ( \frac{ y_{it} - x'_{it}\beta - s'_{it} \alpha _{i}}{\tau } \bigg )^{2} \quad \mathrm {and} \quad {\widetilde{\eta }} = h \bigg (\frac{\theta ^{2}}{\tau ^{2}} + 2 \bigg ).\)

3. Sample \(\varSigma ^{-1}|\alpha \sim Wish\big (\nu _{1},D_{1}\big )\), where \(\nu _{1} = (\nu _{0} + n)\), and \(D_{1}^{-1} = \Big ( \displaystyle D_{0}^{-1}+\sum \limits _{i=1}^{n} \alpha _{i}\alpha _{i}' \Big )\).

4. Sample \(h|y,\beta ,\alpha , \nu \sim Ga\Big (c_{1}/2,d_{1}/2\Big )\) where,

      \(c_{1} = \left( c_{0}+3nT\right) , \quad \mathrm {and} \quad d_{1} = d_{0}+2\sum \limits _{i=1}^{n}\sum \limits _{t=1}^{T}v_{it}+\sum \limits _{i=1}^{n}\sum \limits _{t=1}^{T} \frac{\big (y_{it} - x_{it}'\beta -s_{it}'\alpha _{i}-\theta \nu _{it}\big )^{2}}{\tau ^{2} \nu _{it}}.\)

Once again, we employ Bayes’ theorem to obtain the complete data posterior as the product of the complete data likelihood times the prior distributions as follows:

$$\begin{aligned} \begin{aligned}&\pi (\beta ,\alpha ,\nu ,\varSigma ^{-1},h|y) \propto \bigg \{\prod \limits _{i=1}^{n} f(y_{i}|\beta ,\alpha _{i},\nu _{i},h) \pi (\alpha _{i}|\varSigma )\pi (\nu _{i})\bigg \} \pi (\beta ) \pi (\varSigma ^{-1}) \pi (h)\\&\quad \propto \prod _{i=1}^{n} \bigg \{ |D^{2}_{\tau \sqrt{\frac{\nu _{i}}{h}}}|^{-\frac{1}{2}} \exp \bigg [-\frac{1}{2} (y_{i}-X_{i}\beta -S_{i}{\alpha }_{i}-\theta \nu _{i})' D^{-2}_{\tau \sqrt{\frac{v_{i}}{h}}} (y_{i}-X_{i}\beta -S_{i}{\alpha }_{i}-\theta \nu _{i})\bigg ] \bigg \} \\&\quad \times |\varSigma ^{-1}|^{\frac{n}{2}}\exp \bigg [-\frac{1}{2} \sum \limits _{i=1}^{n}\alpha _{i}'\varSigma ^{-1}\alpha _{i}\bigg ] \times h^{nT} \exp \bigg [-h\sum \limits _{i=1}^{n} \sum \limits _{t=1}^{T} \nu _{it} \bigg ] \times h^{\frac{c_{0}}{2}-1} \exp \Big (-\frac{d_{0}h}{2}\Big )\\&\quad \times \exp \bigg [-\frac{1}{2}(\beta - \beta _{0})'B_{0}^{-1} (\beta - \beta _{0})\bigg ] \times |\varSigma ^{-1}|^\frac{(\nu _{0}-l-1)}{2} \exp \Big [-\frac{1}{2}tr(D_{0}^{-1}\varSigma ^{-1})\Big ]. \end{aligned} \end{aligned}$$
(8)

The conditional posteriors can be derived from the joint posterior distribution (Eq. 8) and the model can be estimated using Gibbs sampling, as presented in Algorithm 2. Specifically, we sample \(\beta \) and \(\alpha \) in a single block to elude the problem of poor mixing due to correlation between the parameters for reasons mentioned earlier (see also Rahman and Vossmeyer 2019; Bresson et al. 2020). The common effects parameters \(\beta \), marginally of \(\alpha \), are sampled from an updated normal distribution and the individual-specific parameters \(\alpha _{i}\)’s are sampled from their respective updated normal distribution. The mixture variable \(\nu \) is sampled component-wise from an updated generalized inverse Gaussian (GIG) distribution (Devroye 2014). The precision matrix \(\varSigma ^{-1}\) is sampled from an updated Wishart distribution and the parameter h is sampled from an updated gamma distribution.

3 Data

The current study utilizes data from the Panel Study of Income Dynamics (PSID), which began in 1968, and is the longest running longitudinal household survey in the world. We constructed a balanced panel of 2174 family units with data for each alternate year, i.e., 2001, 2003, 2005, 2007, 2009, 2011, 2013, and 2015. This is because beginning 1997, the PSID collects data every alternate year. Our constructed data have information on different types of food expenditures, considered as dependent variables, and a host of socioeconomic, demographic, and geographic variables which are used as covariates or independent variables in our study. Table 1 presents a descriptive summary of the variables considered in our analysis.

The primary variable of interest is the food expenditure of a family unit, which the PSID categorizes into three types: food at home (FAH), food away from home (FAFH), and food delivered at home (FDAH). The sum of these three expenditures yields total food (TF) expenditure of the family unit. The variable FAH represents the annualized expenditure of family unit at home and in our sample lies between $0 and $36400. There are only few observations with zero value for FAH. Similarly, the variable FAFH represents annualized food expenditure away from home and in the sample lies in the range $0 to $44,200. The zero values for FAFH are small at 5.7% of the total number of observations. All observations with zero TF expenditure were removed from the sample. Our study considers expenditure on TF, FAH, and FAFH as the dependent variable in different regressions. The expenditure on FDAH is dropped due to large number of zero values, which makes censoring important and a sample selection framework more appropriate.

Table 1 Data summary

An interesting characteristic about the distribution of food expenditures is that they are positively skewed. Figure 1 presents a box plot of the different types of food expenditure utilized in the study. Each box plot represents the distribution of food expenditure for a particular year. In each box plot, the solid line within the box shows the median value, while the bottom and top of the box represent the 25th and 75th percentiles, respectively. The vertical lines are whiskers and they show either the maximum/minimum values or 1.5 times the interquartile range of the data, whichever is smaller. Points more than 1.5 times the interquartile range below (above) the first (third) quartile are defined as outlier and plotted individually. As seen from Fig. 1, for each box plot (across different types of food expenditure), there are large number of outliers towards the higher values making the distribution positively skewed. Consequently, the mean food expenditure (which is pushed upward due to the presence of high values) and covariate effects at the conditional mean is inadequate for a complete picture. In the literature, studies have used logarithmic transformation of food expenditure to alleviate this problem of heteroscedasticity (Liu et al. 2013). However, taking a logarithmic transformation cannot eliminate the non-normality or the heteroscedasticity problem. Besides, food and nutritional assistance programs (such as Supplemental Nutrition Assistance Program or SNAP) are typically interested in the lower tail (i.e., families/households with low food expenditure) to ensure food security.

Fig. 1
figure 1

Box plot for different types of food expenditure

The covariates or independent variables utilized in this study (see Table 1) include age of the head (Head Age), education of the head (Head Edu), and the spouse (Spouse Edu), measured as the number of years of schooling and takes value between 0 and 17 (17 represents post-graduate level work and above). Family Size represents number of members in a family unit. The variable Family Income indicates the actual value of income including transfer income in the previous year (negative values representing loss). We use the inverse-hyperbolic sine (IHS) transformation on income variable, because it adjusts for skewness and retains 0 and negative values (Friedline et al. 2015; Rahman and Vossmeyer 2019). The indicator for employment status of the head (Head Emp) equals 1 if the head is employed and 0 otherwise (omitted). The omitted category includes respondents that are temporarily laid off, looking for work, retired, permanently/temporarily disabled, keeping house, student, and others.

The indicator for gender of the head (Head Female) is coded as 1 if ‘female’ and 0 if ‘male’, while the marital status (of the head) is categorized into Married, Single, and Separated (omitted). The omitted category (Separated) consists of respondents who are widowed, divorced/annulled, or separated. Other variables included in our study are indicators for homeownership (Homeowner) and mortgages (Mortgage). The variable Homeowner takes the value 1 if the respondent is a homeowner and 0 otherwise. Similarly, we have the Mortgage variable which equals 1 if the respondent has a mortgage on property and 0 otherwise. Race is categorized into White and Non-White composed of Blacks, American Indian, Aleut, Eskimo, Asian, Pacific Islander, and Latino. Besides, we have indicators for recession years and the region in which the family resides. The recession dummy takes the value 1 for the years 2001, 2007, and 2009, because these were years with some recession period. Following the US Census Bureau, the region variable is classified into Northeast, West, South, and Midwest (omitted). Including regional indicators help us to look at differences, if any, in the expenditure behavior of the families across regions.

We now look at the movement in average values of the variables for the sampled period. The average FAH expenditure for a typical family unit is around $4590 in 2001, while the FAFH expenditure is around $1990 for the same year. The average expenditure on TF is approximately $6700 in 2001 and increases to $8900 in 2015. Not surprisingly, the average expenditure on FAFH and TF was lower in the year 2009 compared to its respective values in 2007. This shows the adverse effect of the economic crisis on average food expenditure. The adverse effect seems to persist longer for FAFH expenditure, as its average value in 2011 is lower compared to 2007.

The average age of the head is around 45 years with a family size of approximately 3 members in 2001. In the sample, the family units are predominantly headed by males (about 82%) with an average of 13.38 years of schooling in 2001. The average years of schooling of the spouse are lower than that of the head and stands at 9.5 years in 2001, but increase to approximately 10 years in 2015. The sample clearly shows the effect of the Great Recession (December 2007–June 2009) on the variables Family Income and Head Emp. The mean annual family income is approximately $77,000 in 2001 and increases to $99,300 in 2015. However, there is a drop in average family income for 2011 compared to 2009. The effect of the economic crisis is much more pronounced on employment status of the head. In the sample, about 85% are employed in 2001, which started decreasing in 2005 and stood at 73% during 2009. However, the lowest percentage employed for the sample is 62% in 2015.

A large proportion of the sampled respondents are married (0.68 in 2001) and remain in the range 0.68–0.71 throughout the period of our study, while the proportion of single decreases from 0.15 to 0.09 between 2001 and 2015. Approximately 75% of the families own a house in 2001 and this proportion reaches 81% in 2007, and remains in that region for subsequent years. The proportion of respondents having a mortgage on property decrease from 0.59 to 0.53 between 2001 and 2015. Nonetheless, the mortgage percentage was higher than 0.59 between 2003 and 2009, which is another hallmark of the Great Recession. On the racial aspect, majority of the sampled families (about 68%) are White, while the remaining 32% consists of Blacks and other races, thus giving a diverse sample for the study. Our sample is also geographically heterogeneous. Most of the sampled respondents live in the South (38%), followed by Midwest (26%), West (20%), and Northeast (16%). This percentage is stable over the sample period, suggesting little geographic mobility across regions.

4 Results

This section discusses the results for the three types of food expenditure using the models presented in Sect. 2. In particular, the results from longitudinal mean regression are presented in Table 2, and the results from longitudinal quantile regression are exhibited in Table 3. The posterior estimates are based on 12,000 MCMC iterations after a burn-in of 3,000 iterations. Trace plots of the MCMC draws, not presented for the sake of brevity, mimic that of white noise and confirm that the chains have converged. Moderately diffused priors are utilized for the parameters in both the models: \(\beta \sim N_{k}(0,100*I)\), \(\alpha _{i} \sim N_{l}(0,I)\), \(\varSigma ^{-1} \sim Wish(5,10 *I_{l})\) and \(h \sim IG(10/2, 9/2)\). Note that the definition of h are different in the mean and quantile regression models. Besides, there are two components of \(\alpha _{i}\), individual-specific intercept and individual-specific coefficient for inverse-hyperbolic sine transformation of income. With respect to individual-specific effects, results from Tables 2, 3 show that the standard deviations of \(\alpha _{i}\) (i.e., \((\sqrt{\sigma _{11}}, \sqrt{\sigma _{22}}\)) are different for the mean and quantile regression models. As such, a modeling approach with identical variances should be avoided. We now discuss the results for the common parameters in all the econometric models.

The results from the longitudinal mean regression, presented in Table 2, show that (logarithm of) Head Age positively affects expenditures on TF, FAH, and FAFH. Comparing the coefficients across categories, we observe that the coefficient for logarithm of Head Age in the FAH equation is much higher (more than four times) than its corresponding value in the FAFH equation. The result agrees with the intuition that people prefer eating at home as they get older, because FAH is considered to be much healthier. Another argument put forward by Liu et al. (2013) is that social activity reduces with age leading to lower rise in FAFH expenditure. Other studies that have found a positive coefficient for Head Age include Redman (1980), Nayga (1996), Stewart and Yen (2004), and Zheng et al. (2019). Moving to the results from quantile regression shown in Table 3, we observe that there is considerable variation in the coefficients for logarithm of Head Age. For example, in the FAH (FAFH) equation, the ratio of coefficients from Head Age between 80th and 20th quantiles is 1.86 (3.58). These differences show considerable heterogeneity in the effect of Head Age on different types of food expenditure.

Table 2 Posterior mean (MEAN) and standard deviation (STD) of the parameters from longitudinal mean regression

The two education variables Head Edu and Spouse Edu positively affect TF and FAH expenditures. Zheng et al. (2019) also finds a positive effect of head’s education on FAH expenditure. For the FAFH expenditure, only Head Edu has a positive effect, but Spouse Edu has no effect (statistically speaking), because the credible interval for Spouse Edu contains zero. This implies that higher educated spouses (mostly females in our sample) are more knowledgable to understand the importance of healthy diet and consequently spend more on FAH, but not on FAFH. Our findings are similar to those reported by Redman (1980), and Kohara and Kamiya (2016). The results from quantile regression show considerable heterogeneity in the covariate effects, but a comparison of the coefficients for Head Edu and Spouse Edu seems more interesting. For FAH expenditure, across quantiles, the coefficient for Spouse Edu is always higher than that of Head Edu (at the median, the coefficient of Head Edu is 0.49 and that of Spouse Edu is 0.51). This implies that spouses (mostly female in our sample) have a larger positive impact on FAH expenditure across its distribution. In contrast, for FAFH expenditure, the coefficients for Head Edu are higher across quantiles compared to Spouse Edu). This implies that an increase in head’s education leads to a higher increase in consumption of outside food. A possible explanation of such a result is higher involvement of males in sociable activities (Liu et al. 2013).

Table 3 Posterior mean (MEAN) and standard deviation (STD) of the parameters from longitudinal quantile regression

The variable Family Size positively affects TF and FAH expenditures, but not the FAFH expenditure. The positive effect on FAH is understandable as larger families tend to eat more at home and less outside, and is consistent with results reported by Zheng et al. (2019). However, the statistically zero effect on FAFH expenditure is in contrast to those reported in the literature. While some articles find a positive effect of family size (Stewart and Yen 2004; Liu et al. 2013; Zheng et al. 2019), others have reported a negative effect on FAFH expenditure (Redman 1980; Byrne et al. 1996). The quantile regression results once again show heterogeneity in covariate effects. For TF expenditure, the coefficient of Family Size is larger at higher quantiles, with the ratio of 80th-to-20th quantile coefficients at 1.43. For the FAH expenditure, the coefficient for Family Size is similar in size and sign to those from the TF expenditure equation. Interestingly, Family Size has no impact on FAFH expenditure for lower and middle quantiles.

Total family income is perhaps the most decisive variable that steers food expenditure. We use the IHS transformation of family income for reasons mentioned earlier (see also Friedline et al. 2015; Rahman and Vossmeyer 2019). As seen in Table 2, the transformed income variable positively affects expenditures on TF, FAH, and FAFH. The intuition is clear; increase in income translates to increase in food expenditures of all types. This result finds support in several other works such as Redman (1980), Lee and Brown (1986), Nayga (1996), Ziol-Guest et al. (2006), and Liu et al. (2013). Results from quantile regression show considerable heterogeneity in covariate effects with higher quantiles showing a larger impact of income on food expenditure. The ratios of 80th-to-20th quantile coefficients for IHS Income in the TF, FAH, and FAFH equations are 1.38, 1.41, and 1.71, respectively.

The next three variables in Table 2 are indicator variable for head’s employment (Head Emp), indicator variable for female head (Head Female), and interaction of the two indicators. Head’s employment has a positive effect on TF and FAFH expenditures, but statistically has no effect on FAH expenditure. These findings are similar to those in Aguiar and Hurst (2005), Huang et al. (2016), and Antelo et al. (2017). The indicator for Head Female is negative for all categories, which suggests that female-headed families tend to spend less on overall and each category of food. This can be attributed to two factors: females are better at managing family expenditure and an empowered woman better understands the importance of nutritious food and thus reduces FAFH expenditure. The interaction term (Head Emp \(\times \) Head Female) in all three regressions is positive, which implies that an employed female head spends more on overall and each category of food purchase. Results from quantile regression, presented in Table 3, once again reveal heterogeneity in the covariate effect of the three indicator variables. Heads’s employment positively affects TF expenditure at lower and middle quantiles, but not at upper quantiles. There are no effect on FAH expenditure and a positive effect on FAFH expenditure across quantiles. Head Female has a negative effect on overall and each category of food expenditure, and the negative effect increases at upper quantiles. The interaction term shows a positive effect on TF expenditure across quantiles, but a positive effect on FAH and FAFH expenditures only at lower and middle quantiles. Hence, at higher levels of FAH and FAFH expenditures, the employment of female head does not play an important role.

The impact of marital status on food expenditure is examined through the two indicator variables, Married and Single. The base or omitted category is Separated, explained in Sect. 3. As seen from Table 2, the coefficient for Married is not statistically different from zero. Therefore, being married has statistically no effect on food expenditure relative to the omitted category, Separated. However, being single has a positive effect on overall food expenditure and across categories. Our findings are consistent with results reported by Stewart and Yen (2004) and Liu et al. (2013), but contradictory to those by Byrne et al. (1996) and Zheng et al. (2019). The results from quantile regression reinforce the findings from the mean regression. Across quantiles, being married has no effect on food expenditure as compared to the omitted category. On the other hand, being single has a positive effect on food expenditure and are increasing with quantiles. The ratios of 80th-to-20th quantile coefficients for TF, FAH, and FAFH expenditures are 1.60, 1.70, and 2.35, respectively.

Homeowners having mortgages are resource constrained and have a lower cash flow for a given income. This may negatively affect food expenditure, particularly, FAFH expenditure. To explore this hypothesis, we include an indicator variable for homeowners having mortgages into our regression equations. Results from Table 2 and Table 3 show that families with mortgages have statistically no effect on food expenditure. Our results are opposite to those by Nayga (1996), where he finds that homeowners with mortgages do spend more on food prepared at home and FAFH, but not on prepared foods (e.g., frozen meals and prepared salads). Similarly, Liu et al. (2013) find that homeowners who are married (with and without children) have higher probability of different types of FAFH expenditures (e.g., full-service dining, fast-food and other facilities), but for single-person homeowners, this is true only for full-service dining.

Variations in food expenditure have often been linked to racial disparity. To investigate this conjecture, we include an indicator variable for Non-White, keeping White as the base or omitted category. Results from mean regression, presented in Table 2, exhibit that Non-White tends to have lower expenditure on overall food, as well as FAH and FAFH expenditures. Our findings are consistent with Nayga (1996) who finds that white households are likely to spend more on FAH and FAFH. Similarly, Lee and Brown (1986) report that Non-White are less likely to eat away from home. Our results are also in agreement with findings from other previous works such as Redman (1980), Stewart and Yen (2004), and Liu et al. (2013). Another reason for the negative coefficient, as noted by Byrne et al. (1996), is due to non-availability of ethnic foods at local restaurants. The results from quantile regression, shown in Table 3, largely agree with the finding from mean regression. Non-White have lower TF expenditure compared to White. Moreover, the impact is larger at lower quantiles and decreases as we move to upper quantiles. For, FAH expenditure, the Non-White have lower expenditures only at the lower and middle quantiles, but not at upper quantiles. In contrast, FAFH expenditure for Non-White is lower across quantiles and the negative impact increases with increasing quantiles.

Most expenditures, including consumption, typically decline during times of recession. To explore the negative effect on food expenditure, if any, we include an indicator for recession years (2001, 2007, and 2009) into our regression. Results from mean regression show that the coefficient for Recession is negative for all types of food expenditure, which implies that expected food expenditure (overall and category wise) declined during the recession years. As reported in Table 2, average TF, FAH, and FAFH expenditures declined by $257, $190, and $75, respectively. Our findings are supported by Griffith et al. (2013), where they report decline in expenditure for food items for British households during and post the Great Recession. Similarly, Antelo et al. (2017) also find that food expenditure for Spanish households declined during the crisis period (i.e., 2008−2014) in Spain. Moving to quantile regression, we find that the quantile results reinforces the findings from mean regression. Both TF and FAH expenditures declined across quantiles during the recession years, and the effect is more or less uniform across the considered quantiles. For FAFH expenditure, we observe a decline only at lower and middle quantiles, but not at the upper quantile. Therefore, families whose expenditure on FAFH is high are not affected by recession years.

Finally, we include regional indicators to examine geographical differences in food expenditure. These differences may be due to varying levels of urbanization, climatic conditions, and diverse food culture. We include indicators for Northeast, West, and South into our regression equations. Midwest is used as the base or omitted category. Our regional classification follows the definition of the US Census Bureau. Results from mean regressions (see Table 2) reveal that an average family living in South (relative to Midwest) has higher TF, FAH, and FAFH expenditures. However, for families living in the Northeast and West, the average expenditure is more on TF and FAH but not on FAFH. Other studies, such as Lee and Brown (1986), Nayga (1996), Byrne et al. (1996), and Liu et al. (2013), also find disparity in regional food expenditures. Moving to results from quantile regression (see Table 3), we see that for TF and FAH expenditures, all the quantile coefficients for Northeast, West, and South are positive and increase with quantiles. This suggests that families living in the three regions have higher quantile expenditures (compared to those living in Midwest) and the differential impact increases at higher quantiles. For FAFH expenditure, only South and Northeast (at the upper quantiles only) have a positive effect on FAFH expenditure.

In summary, the results from quantile regression reveal considerable heterogeneity in covariate effects which cannot be uncovered from mean regression. The additional information from quantile regression may be useful for policy making in the government or business, such as aiming sections of the population for welfare schemes or running campaigns to promote business.

4.1 Heterogeneity bias

Unobserved heterogeneity is a large component of food expenditure, and we control for this in our (mean and quantile) regression models with individual-specific parameters in the intercept and income. To demonstrate the heterogeneity bias and poorer model fit that can occur, we estimate the quantile models without including the individual-specific effects (i.e., without including the conditional dependence between observations across time for the same family unit). This model can be estimated as a special case of Algorithm 2, by eliminating Step 1(a) and Step (3), and removing \((\alpha _{i}, \varSigma ^{-1})\) from the conditional posteriors of the remaining parameters.

The results from the longitudinal quantile models without the individual-specific effects are presented in Table 4 and they differ widely compared to those of Table 3, which presents the results from longitudinal quantile regression with individual-specific effects. For example, the coefficients for Head Age, IHS Income, Head Female, and Recession are noticeably different in the two models across quantiles and types of food expenditure. Again, there are variables whose coefficients either become statistically equivalent to or different from zero when the individual-specific parameters are excluded. In the former category, we have the coefficient for Spouse Edu at middle and upper quantiles for total food expenditure. In the latter category, we have the coefficient for homeowners with mortgages (Mort \(\times \) Home) at lower quantiles for expenditures on total food and food at home.

Table 4 Posterior mean (MEAN) and standard deviation (STD) of the parameters from longitudinal quantile regression without random-effects

To highlight the importance of modeling the individual-specific effects (or random-effects), we compare model fitting at the considered quantiles using the conditional log-likelihood, conditional Akaike Information Criterion (cAIC), and conditional Bayesian Information Criterion (cBIC). The calculations of cAIC and cBIC are proposed and explained in Greven and Kneib (2010) and Delattre et al. (2014), respectively. These model comparison measures are presented in Table 5. The table clearly shows that across quantiles, the value of the conditional log-likelihood is higher and those of cAIC and cBIC are lower for each longitudinal quantile regression when individual-specific effects are included. Consequently, there is a strong evidence for modeling unobserved heterogeneity and ignoring it can lead to poor model fitting.

Table 5 Model comparison between the longitudinal quantile regression with random-effects (with RE) and without random-effects (w/o RE). The log-likelihood (\(\log \)-L), conditional Akaike Information Criterion (cAIC) and conditional Bayesian Information Criterion (cBIC) are evaluated at the posterior mean of the parameters

5 Conclusion

This article studies the relationship between different types of food expenditures (total food, food at home, and food away from home) and a host of economic, geographic, and demographic factors using data from the Panel Study of Income Dynamics for the period 2001−2015. Food expenditures are typically right skewed and, thus, covariate effects are likely to be heterogeneous across the conditional distribution of the response variable. Besides, unobserved heterogeneity is a large component of food expenditure. To explore these considerations, we study food expenditure within a longitudinal quantile framework that models dependence between the observations across time for the same family units. Results point to several important aspects including the presence of heterogeneity in the covariate effects. For example, we find that there are notable differences in the food expenditure behavior (of all types) between male and female headed households, expenditures on food away from home by employed female heads are heterogeneous across quantiles, and food expenditures (of all types) decrease during times of economic crisis and vary with quantiles. Besides, the paper provides strong empirical evidence that not considering unobserved heterogeneity can lead to heterogeneity bias and poor model fitting.

While our paper emphasizes the modeling of heterogeneity in food expenditure, the findings reported also provide greater insights on total food expenditure and expenditures on food at home and food away from home, which may be of special interest to policy makers in the health and business sectors. For example, we find that spouse education has a positive effect across the distribution of food at home expenditure. Therefore, policy makers may provide higher incentives to female education to achieve better health outcomes in the country. Similarly, we find that being single or employed female heads have a positive effect on the distribution of food away from home expenditure. Consequently, restaurant and fast food chains may run campaigns targeting these specific groups to increase their sales. The above discussion and other findings reported in the paper may be utilized to better formulate policies and business decisions.