  ### 5.4 Random-coeﬃcients stochastic frontier

Mathematical representation

 ${y}_{it}={\mathbf{z}}_{it}^{\prime }{\gamma }_{i}+{\mathbf{x}}_{it}^{\prime }\beta +{v}_{it}±{u}_{it},\phantom{\rule{2em}{0ex}}\phantom{\rule{1em}{0ex}}{v}_{it}\sim \mathrm{N}\left(0,\frac{1}{\tau }\right),\phantom{\rule{1em}{0ex}}{\gamma }_{i}\sim \mathrm{N}\left(\stackrel{̄}{\gamma },{\Omega }^{-1}\right),\phantom{\rule{1em}{0ex}}{u}_{it}\sim \mathrm{D}\left(𝜃\right)$ (5.4)
• the model is estimated using observations from $N$ groups, each group observed for ${T}_{i}$ periods (balanced or unbalanced panels); the total number of observations is ${\sum }_{i=1}^{N}{T}_{i}$ and ${T}_{i}$ could be equal to one for all $i$ (cross-sectional data)
• ${y}_{it}$ is the value of the dependent variable for group $i$, observed in period $t$
• ${\mathbf{z}}_{it}$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector that stores the values of the $K$ independent variables which are associated with group-speciﬁc coeﬃcients, for group $i$, observed in period $t$
• ${\mathbf{x}}_{it}$ is an $L\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector that stores the values of the $L$ independent variables which are associated with coeﬃcients common to all groups, for group $i$, observed in period $t$ ($L$ could be zero)
• ${\gamma }_{i}$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector of parameters associated with group $i$
• $\stackrel{̄}{\gamma }$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector of parameters that represents the mean of the ${\gamma }_{i}$s
• $\Omega$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}K$ precision matrix for the distribution of the ${\gamma }_{i}$s
• $\beta$ is an $L\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector of parameters
• $\tau$ is the precision of the noise component of the error term: ${\sigma }_{v}^{2}=\frac{1}{\tau }$
• ${u}_{it}$ is the ineﬃciency component of the error term for group $i$ in period $t$ and it can have any non-negative distribution, represented in the equation above by $\mathrm{D}\left(𝜃\right)$; BayES supports the following distributions for ${u}_{it}$:
• exponential: $p\left({u}_{it}\right)=\lambda {e}^{-\lambda {u}_{it}}$
• half normal: $p\left({u}_{it}\right)=\frac{2{\varphi }^{1∕2}}{{\left(2\pi \right)}^{1∕2}}exp\left\{-\frac{\varphi }{2}{u}_{it}^{2}\right\}$ When ${u}_{it}$ enters the speciﬁcation with a plus sign then the model represents a cost frontier, while when ${u}_{it}$ enters with a minus sign the model represents a production frontier. For the eﬃciency scores generated by a stochastic frontier model to be meaningful, the dependent variable in both cases must be in logarithms. No time dependence is imposed on the ineﬃciency component of the error term: each ${u}_{it}$ is treated as an independent draw from $\mathrm{D}\left(𝜃\right)$. Calculation of the log-marginal likelihood for the model is performed by integrating-out the ${u}_{it}$s from the complete-data likelihood by simulation. BayES multiplies the number of draws used for the estimation of the parameters by the maximum number of time observations per group ($\underset{i}{max}\left\{{T}_{i}\right\}$) to determine the number of draws to be used for this integration. However, approximation of an integral of dimension ${T}_{i}$ for each group, $i$, by simulation may be imprecise if ${T}_{i}$ is large. Therefore, using a large number of iterations is equired to reduce the Monte Carlo standard error associated with the value of the log-marginal likelihood.

Priors

 Parameter Probability density function Default hyperparameters Common to all models $\stackrel{̄}{\gamma }$ $p\left(\stackrel{̄}{\gamma }\right)=\frac{|{\mathbf{P}}_{\gamma }{|}^{1∕2}}{{\left(2\pi \right)}^{K∕2}}exp\left\{-\frac{1}{2}{\left(\stackrel{̄}{\gamma }-{\mathbf{m}}_{\gamma }\right)}^{\prime }{\mathbf{P}}_{\gamma }\left(\stackrel{̄}{\gamma }-{\mathbf{m}}_{\gamma }\right)\right\}$ ${\mathbf{m}}_{\gamma }={\mathbf{0}}_{K}$, ${\mathbf{P}}_{\gamma }=0.001\cdot {\mathbf{I}}_{K}$ $\Omega$ $p\left(\Omega \right)=\frac{|\Omega {|}^{\frac{n-K-1}{2}}|{\mathbf{V}}^{-1}{|}^{n∕2}}{{2}^{nK∕2}{\Gamma }_{K}\left(\frac{n}{2}\right)}exp\left\{-\frac{1}{2}tr\left({\mathbf{V}}^{-1}\Omega \right)\right\}$ $n={K}^{2}$, $\mathbf{V}=\frac{100}{K}\cdot {\mathbf{I}}_{K}$ $\beta$ $p\left(\beta \right)=\frac{|{\mathbf{P}}_{\beta }{|}^{1∕2}}{{\left(2\pi \right)}^{L∕2}}exp\left\{-\frac{1}{2}{\left(\beta -{\mathbf{m}}_{\beta }\right)}^{\prime }{\mathbf{P}}_{\beta }\left(\beta -{\mathbf{m}}_{\beta }\right)\right\}$ ${\mathbf{m}}_{\beta }={\mathbf{0}}_{L}$, ${\mathbf{P}}_{\beta }=0.001\cdot {\mathbf{I}}_{L}$ $\tau$ $p\left(\tau \right)=\frac{{b}_{\tau }^{{a}_{\tau }}}{\Gamma \left({a}_{\tau }\right)}{\tau }^{{a}_{\tau }-1}{e}^{-\tau {b}_{\tau }}$ ${a}_{\tau }=0.001$, ${b}_{\tau }=0.001$ Exponential model $\lambda$ $p\left(\lambda \right)=\frac{{b}_{\lambda }^{{a}_{\lambda }}}{\Gamma \left({a}_{\lambda }\right)}{\lambda }^{{a}_{\lambda }-1}{e}^{-\lambda {b}_{\lambda }}$ ${a}_{\lambda }=1$, ${b}_{\lambda }=0.15$ Half normal model $\varphi$ $p\left(\varphi \right)=\frac{{b}_{\varphi }^{{a}_{\varphi }}}{\Gamma \left({a}_{\varphi }\right)}{\varphi }^{{a}_{\varphi }-1}{e}^{-\varphi {b}_{\varphi }}$ ${a}_{\varphi }=7$, ${b}_{\varphi }=0.5$

Syntax

$\left[$<model name> = $\right]$ sf_rc( y ~ z1 z2  zK $\left[$$|$ x1 x2 $\dots$ xL$\right]$ $\left[$, <options> $\right]$ );

where:

• y is the dependent variable name, as it appears in the dataset used for estimation
• z1 z2 $\dots$zK is a list of the names, as they appear in the dataset used for estimation, of the independent variables which are associated with group-speciﬁc coeﬃcients; when a constant term is to be included in the set of group-speciﬁc coeﬃcients this must be requested explicitly
• x1 x2 $\dots$xL is is a list of the names, as they appear in the dataset used for estimation, of the independent variables which are associated with coeﬃcients common to all groups; when a constant term is to be included in the set of common coeﬃcients, this must be requested explicitly An independent variable could be included in either the x or the z variable list, depending on whether the parameter associated with this variable is common to all groups or not. However, including a variable in both lists would lead to exact multicollinearity and, in this case, BayES will issue an error. Before using the sf_rc() function the dataset used for estimation must be declared as a panel dataset using the set_pd() function (see section B.13). In the case of cross-sectional data, the dataset still needs to be declared as a panel, but the group-id variable could be constructed as a list of unique integers using, for example, the range() function. For groups observed only once, a group-speciﬁc parameter associated with a constant term cannot be distinguished from the error term (${v}_{it}$). Thus, a warning is produced when a constant term is included in the z list and the dataset contains at least one group which is observed only once.

The optional arguments for the random-coeﬃcients stochastic frontier model are:4

 Gibbs parameters "chains" number of chains to run in parallel (positive integer); the default value is 1 "burnin" number of burn-in draws per chain (positive integer); the default value is 10000 "draws" number of retained draws per chain (positive integer); the default value is 20000 "thin" value of the thinning parameter (positive integer); the default value is 1 "seed" value of the seed for the random-number generator (positive integer); the default value is 42 Model specification "udist" speciﬁcation of the distribution of the ineﬃciency component of the error term; the following options are available, corresponding to the distributions presented at the beginning of this section: "exp" "hnorm" the default value is "exp" "production" boolean specifying the type of frontier (production/cost); it could be set to either true (production) or false (cost); the default value is true Hyperparameters Common to all models "m_gamma" mean vector of the prior for $\stackrel{̄}{\gamma }$ ($K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector); the default value is ${\mathbf{0}}_{K}$ "P_gamma" precision matrix of the prior for $\stackrel{̄}{\gamma }$ ($K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}K$ symmetric and positive-deﬁnite matrix); the default value is $0.001\phantom{\rule{0.3em}{0ex}}\cdot \phantom{\rule{0.3em}{0ex}}{\mathbf{I}}_{K}$ "V" scale matrix of the prior for $\Omega$ ($K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}K$ symmetric and positive-deﬁnite matrix); the default value is $\frac{100}{K}\phantom{\rule{0.3em}{0ex}}\cdot \phantom{\rule{0.3em}{0ex}}{\mathbf{I}}_{K}$ "n" degrees-of-freedom parameter of the prior for $\Omega$ (real number greater than or equal to $K$); the default value is ${K}^{2}$ "m_beta" mean vector of the prior for $\beta$ ($L\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector); the default value is ${\mathbf{0}}_{L}$ "P_beta" precision matrix of the prior for $\beta$ ($L\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}L$ symmetric and positive-deﬁnite matrix); the default value is $0.001\phantom{\rule{0.3em}{0ex}}\cdot \phantom{\rule{0.3em}{0ex}}{\mathbf{I}}_{L}$ "a_tau" shape parameter of the prior for $\tau$ (positive number); the default value is $0.001$ "b_tau" rate parameter of the prior for $\tau$ (positive number); the default value is $0.001$ Exponential model "a_lambda" shape parameter of the prior for $\lambda$ (positive number); the default value is $1$ "b_lambda" rate parameter of the prior for $\lambda$ (positive number); the default value is $0.15$ Half normal model "a_phi" shape parameter of the prior for $\varphi$ (positive number); the default value is $7$ "b_phi" rate parameter of the prior for $\varphi$ (positive number); the default value is $0.5$ Dataset and log-marginal likelihood "dataset" the id value of the dataset that will be used for estimation; the default value is the ﬁrst dataset in memory (in alphabetical order) "logML_CJ" boolean indicating whether the Chib (1995)/Chib & Jeliazkov (2001) approximation to the log-marginal likelihood should be calculated (true$|$false); the default value is false

Reported Parameters

 Common to all models $\stackrel{̄}{\gamma }$ variable_name vector of parameters associated with the independent variables in the z list; these are the means of the group-speciﬁc parameters $\beta$ variable_name vector of parameters associated with the independent variables in the x list $\tau$ tau precision parameter of the noise component of the error term, ${v}_{i}$ ${\sigma }_{v}$ sigma_v standard deviation of the noise component of the error term, ${\sigma }_{v}=1∕{\tau }^{1∕2}$ Exponential model $\lambda$ lambda rate parameter of the distribution of the ineﬃciency component of the error term, ${u}_{i}$ ${\sigma }_{u}$ sigma_u scale parameter of the ineﬃciency component of the error term: ${\sigma }_{u}=1∕\lambda$. For the exponential model the standard deviation of ${u}_{i}$ is equal to the scale parameter. Half normal model $\varphi$ phi precision parameter of the distribution of the ineﬃciency component of the error term, ${u}_{i}$ ${\sigma }_{u}$ sigma_u scale parameter of the ineﬃciency component of the error term: ${\sigma }_{u}=1∕{\varphi }^{1∕2}$. The standard deviation of ${u}_{i}$ for the half-normal model can be obtained as ${\sigma }_{u}\sqrt{1-\frac{2}{\pi }}$.

Stored values and post-estimation analysis
If a left-hand-side id value is provided when a random-coeﬃcients stochastic frontier model is created, then the following results are saved in the model item and are accessible via the ‘.’ operator:

 Samples a matrix containing the draws from the posterior of $\stackrel{̄}{\gamma }$, $\beta$, $\tau$, the unique elements of $\Omega$ and either $\lambda$ (exponential model) or $\varphi$ (half-normal model) z1,$\dots$,zK vectors containing the draws from the posterior of the mean of the group-speciﬁc coeﬃcients ($\stackrel{̄}{\gamma }$s) associated with variables z1,$\dots$,zK (the names of these vectors are the names of the variables that were included in the right-hand side of the model) x1,$\dots$,xL vectors containing the draws from the posterior of the parameters associated with variables x1,$\dots$,xL (the names of these vectors are the names of the variables that were included in the right-hand side of the model) tau vector containing the draws from the posterior of $\tau$ lambda vector containing the draws from the posterior of $\lambda$ (available after the estimation of the exponential model) phi vector containing the draws from the posterior of $\varphi$ (available after the estimation of the half-normal model) Omega_i_j vectors containing the draws from the posterior of the unique elements of $\Omega$; because $\Omega$ is symmetric, only $\frac{\left(K-1\right)K}{2}\phantom{\rule{0.3em}{0ex}}+\phantom{\rule{0.3em}{0ex}}K$ of its elements are stored (instead of all ${K}^{2}$ elements); i and j index the row and column of $\Omega$, respectively, at which the corresponding element is located Omega $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}K$ matrix that stores the posterior mean of $\Omega$ logML the Lewis & Raftery (1997) approximation of the log-marginal likelihood logML_CJ the Chib (1995)/Chib & Jeliazkov (2001) approximation to the log-marginal likelihood; this is available only if the model was estimated with the "logML_CJ"=true option gamma_i $N\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}K$ matrix that stores the group-speciﬁc coeﬃcients for the variables in the z list; the values in this matrix are not guaranteed to be in the same order as the order in which the groups appear in the dataset used for estimation; use the store() function to associate the values in gamma_i with the observations in the dataset eff_i $\left({\sum }_{i=1}^{N}{T}_{i}\right)\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector that stores the expected values of the observation-speciﬁc eﬃciency scores, $E\left({e}^{-{u}_{it}}\right)$; the values in this vector are not guaranteed to be in the same order as the order in which the observations appear in the dataset used for estimation; use the store() function to associate the values in eff_i with the observations in the dataset nchains the number of chains that were used to estimate the model nburnin the number of burn-in draws per chain that were used when estimating the model ndraws the total number of retained draws from the posterior ($=$chains $\cdot$ draws) nthin value of the thinning parameter that was used when estimating the model nseed value of the seed for the random-number generator that was used when estimating the model

Additionally, the following functions are available for post-estimation analysis (see section B.14):

• diagnostics()
• test()
• pmp()
• store()

The random-coeﬃcients stochastic frontier model uses the store() function to associate the group-speciﬁc parameters (gamma_i) or the estimates of the eﬃciency scores (eff_i) with speciﬁc observations and store their values in the dataset used for estimation. The generic syntax for a statement involving the store() function after estimation of a random-coeﬃcients stochastic frontier model and for each of these two quantities is:

store( gamma_i, <new variable name prefix> $\left[$, "model"=<model name>$\right]$ );

and:

store( eff_i, <new variable name> $\left[$, "model"=<model name>$\right]$ );

The ﬁrst statement will generate $K$ additional variables in the dataset used for estimation of the random-coeﬃcients model, with names constructed by prepending the preﬁx provided as the second argument to store() to the names of the variables which are associated with group-speciﬁc coeﬃcients. The second statement will generate one additional variable in the dataset used for estimation of the model and its name will be the one provided as the second argument to store().

Examples

Example 1

myData = import("$BayESHOME/Datasets/dataset2.csv", ","); myData.constant = ones(rows(myData), 1); set_pd( year, id, "dataset" = myData); // all rhs variables are associated with group-specific coefficients sf_rc( y ~ constant x1 x2 x3); Example 2 myData = import("$BayESHOME/Datasets/dataset2.csv", ",");
myData.constant = ones(rows(myData), 1);
set_pd( year, id, "dataset" = myData);

// only the constant term and the coefficient associated with x1 are
// group-specific; the coefficients on x2 and x3 are common to all groups
sf_rc( y ~ constant x1 $|$ x2 x3);

Example 3

myData = import("\$BayESHOME/Datasets/dataset2.csv", ",");
myData.constant = ones(rows(myData), 1);
set_pd( year, id, "dataset" = myData);

// all rhs variables are associated with group-specific coefficients
model1 = sf_rc(y ~ constant x1 x2 x3, "udist"="hnorm",
"burnin"=10000, "draws"=40000, "thin"=4, "chains"=2,
"logML_CJ" = true, "dataset"=myData);
store( gamma_i, rc1_, "model" = model1 );

// only the constant term and the coefficient associated with x1 are
// group-specific; the coefficients on x2 and x3 are common to all groups
model2 = lm_rc( y ~ constant x1 $|$ x2 x3, "udist"="hnorm",
"burnin"=10000, "draws"=40000, "thin"=4, "chains"=2,
"logML_CJ" = true, "dataset"=myData);
store( gamma_i, rc2_, "model" = model2 );

pmp( { model1, model2 } );

4Optional arguments are always given in option-value pairs (eg. "chains"=3).

Share this content:    © 2016–20 Grigorios Emvalomatis