### 6.3 Random-eﬀects binary Probit

Mathematical representation

 $Prob\left({y}_{it}=1\right)=\Phi \left({\alpha }_{i}+{\mathbf{x}}_{it}^{\prime }\beta \right),\phantom{\rule{2em}{0ex}}{\alpha }_{i}\sim \mathrm{N}\left(0,\frac{1}{\omega }\right)$ (6.5)
• 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}$
• ${y}_{it}$ is the value of the dependent variable for group $i$, observed in period $t$ and it can take two values: 0 and 1
• ${\mathbf{x}}_{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 for group $i$, observed in period $t$
• $\beta$ is a $K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector of parameters
• ${\alpha }_{i}$ is the group-speciﬁc error term for group $i$
• $\omega$ is the precision of the group-speciﬁc error term: ${\sigma }_{\alpha }^{2}=\frac{1}{\omega }$
• $\Phi \left(\cdot \right)$ is the standard-Normal cdf

An equivalent representation uses the latent variable ${y}_{it}^{\ast }$:

 $\begin{array}{cc}\begin{array}{rl}{y}_{it}^{\ast }& ={\alpha }_{i}+{\mathbf{x}}_{it}^{\prime }\beta +{𝜀}_{it},\phantom{\rule{2em}{0ex}}\phantom{\rule{1em}{0ex}}{𝜀}_{it}\sim \mathrm{N}\left(0,1\right),\phantom{\rule{1em}{0ex}}{\alpha }_{i}\sim \mathrm{N}\left(0,\frac{1}{\omega }\right),\\ {y}_{it}& =\left\{\begin{array}{ccc}1\hfill & \hfill \mathrm{if}\hfill & \hfill {y}_{it}^{\ast }>0\\ 0\hfill & \hfill \mathrm{if}\hfill & \hfill {y}_{it}^{\ast }\le 0\end{array}\right\\end{array}& \end{array}$ (6.6)

 The mean of the distribution of the ${\alpha }_{i}$s is restricted to zero and, therefore, these are simply group-speciﬁc errors terms. However, including a constant term in the set of independent variables is valid and leads to a speciﬁcation equivalent to one where the group eﬀects are draws from a normal distribution with mean equal to the parameter associated with the constant term and precision $\omega$.

Priors

 Parameter Probability density function Default hyperparameters $\beta$ $p\left(\beta \right)=\frac{|\mathbf{P}{|}^{1∕2}}{{\left(2\pi \right)}^{K∕2}}exp\left\{-\frac{1}{2}{\left(\beta -\mathbf{m}\right)}^{\prime }\mathbf{P}\left(\beta -\mathbf{m}\right)\right\}$ $\mathbf{m}={\mathbf{0}}_{K}$, $\mathbf{P}=0.001\cdot {\mathbf{I}}_{K}$ $\omega$ $p\left(\omega \right)=\frac{{b}_{\omega }^{{a}_{\omega }}}{\Gamma \left({a}_{\omega }\right)}{\omega }^{{a}_{\omega }-1}{e}^{-\omega {b}_{\omega }}$ ${a}_{\omega }=0.01$, ${b}_{\omega }=0.001$

Syntax

$\left[$<model name> = $\right]$ probit_re( y ~ x1 x2  xK $\left[$, <options> $\right]$ );

where:

• y is the dependent variable name, as it appears in the dataset used for estimation
• x1 x2 $\dots$xK is a list of the $K$ independent variable names, as they appear in the dataset used for estimation; when a constant term is to be included in the model, this must be requested explicitly

 The dependent variable, y, in the dataset used for estimation must contain only two values: 0 and 1 (with 1 indicating “success"). Observations with missing values in y are dropped during estimation, but if a numerical value other than 0 and 1 is encountered, then an error is produced.

 BayES automatically drops from the sample used for estimation groups which are observed only once. This is because for these groups the group eﬀect (${\alpha }_{i}$) cannot be distinguished from the error term (${𝜀}_{it}$).

The optional arguments for the random-eﬀects binary Probit model are:3

 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 Hyperparameters "m" mean vector of the prior for $\beta$ ($K\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector); the default value is ${\mathbf{0}}_{K}$ "P" precision matrix of the prior for $\beta$ ($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}$ "a_omega" shape parameter of the prior for $\omega$ (positive number); the default value is $0.01$ "b_omega" rate parameter of the prior for $\omega$ (positive number); the default value is $0.001$ 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

 $\beta$ variable_name vector of parameters associated with the independent variables $\omega$ omega precision parameter of the group-speciﬁc error term, ${\alpha }_{i}$ ${\sigma }_{\alpha }$ sigma_alpha standard deviation of the group-speciﬁc error term: ${\sigma }_{\alpha }=1∕{\omega }^{1∕2}$

Stored values and post-estimation analysis
If a left-hand-side id value is provided when a random-eﬀects binary Probit 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 $\beta$ and $\omega$ x1,$\dots$,xK vectors containing the draws from the posterior of the parameters associated with variables x1,$\dots$,xK (the names of these vectors are the names of the variables that were included in the right-hand side of the model) omega vector containing the draws from the posterior 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 alpha_i $N\phantom{\rule{0.3em}{0ex}}×\phantom{\rule{0.3em}{0ex}}1$ vector that stores the group-speciﬁc errors; the values in this vector 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 alpha_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()
• mfx()
• predict()

The random-eﬀects binary Probit model uses the store() function to associate the group eﬀects (alpha_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-eﬀects binary Probit model is:

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

The random-eﬀects binary Probit model uses the mfx() function to calculate and report the marginal eﬀects of the independent variables on the probability of success. There are two types of marginal eﬀects which can be requested by setting the "type" argument of the mfx() function equal to 1 or 2:

1. when "type"=1 the marginal eﬀects are calculated marginally with respect to the group eﬀects.

2. when "type"=2 the marginal eﬀects are calculated conditionally on the group-eﬀects being equal to zero (the expected value of the group eﬀects, when treated as group-speciﬁc errors).

The generic syntax for a statement involving the mfx() function after estimation of a random-eﬀects binary Probit model is:

mfx( $\left[$"type"=1$\right]$ $\left[$, "point"=<point of calculation>$\right]$ $\left[$, "model"=<model name>$\right]$ );

and:

mfx( "type"=2 $\left[$, "point"=<point of calculation>$\right]$ $\left[$, "model"=<model name>$\right]$ );

for calculating these two types of marginal eﬀects. The default value of the "type" option is 1. See the general documentation of the mfx() function (section B.14) for details on the other optional arguments.

The random-eﬀects binary Probit model uses the predict() function to generate predictions of the probability of success. There are two types of predictions which can be requested by setting the "type" argument of the mfx() function equal to 1 or 2:

1. when "type"=1 the predictions are generated marginally with respect to the group eﬀects.

2. when "type"=2 the predictions are generated conditionally on the group-eﬀects being equal to zero (the expected value of the group eﬀects, when treated as group-speciﬁc errors).

The generic syntax for a statement involving the predict() function after estimation of a random-eﬀects binary Probit model is:

$\left[$<id value>$\right]$ = predict( $\left[$"type"=1$\right]$ $\left[$, "point"=<point of calculation>$\right]$ $\left[$,"model"=<model name>$\right]$ $\left[$, "stats"=true|false$\right]$ $\left[$, "prefix"=<prefix for new variable name>$\right]$ );

and:

$\left[$<id value>$\right]$ = predict( "type"=2 $\left[$, "point"=<point of calculation>$\right]$ $\left[$,"model"=<model name>$\right]$ $\left[$, "stats"=true|false$\right]$ $\left[$, "prefix"=<prefix for new variable name>$\right]$ );

for generating these two types of predictions eﬀects. The default value of the "type" option is 1. See the general documentation of the predict() function (section B.14) for details on the other optional arguments.

Examples

Example 1

myData = import("$BayESHOME/Datasets/dataset4.csv"); myData.constant = ones(rows(myData), 1); set_pd( year, id, "dataset" = myData); probit_re( y ~ constant x1 x2 x3 x4 ); Example 2 myData = import("$BayESHOME/Datasets/dataset4.csv");
myData.constant = ones(rows(myData), 1);
set_pd( year, id, "dataset" = myData);

myModel = probit_re( y ~ constant x1 x2 x3 x4,
"m"=ones(5,1), "P"=0.1*eye(5,5), "a_omega"=0.1, "b_omega"=0.01,
"burnin"=10000, "draws"=40000, "thin"=4, "chains"=2,
"logML_CJ" = true );

diagnostics("model"=myModel);

kden(myModel.x3, "title" = "beta3 from the Probit model");

margeff_mean = mfx("point"="mean","model"=myModel,"type"=1);
margeff_mean = mfx("point"="mean","model"=myModel,"type"=2);

predict("type"=1, "prefix"=marg_);
predict("type"=2, "prefix"=cond_);

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