BayES BayES

6.8 Conditional Logit

Mathematical representation

pmi = Prob yi = m|zmiδ + xiβm , m = 1,,M p0i = 1 m=1Mpmi, with additional structure on each pmi (6.15)

The latent-variable representation of the conditional Logit is:

y1i = z 1iδ + xiβ1 + 𝜀1i y2i = z 2iδ + xiβ2 + 𝜀2i yMi = z Miδ + xiβM + 𝜀Mi yi = 0 if maxj yji 0 1 if maxj yji = y1i and y1i > 0 M if maxj yji = yMi and yMi > 0 (6.16)

Let:

βJ×1 = δ β 1 β2 β M and𝜀iM×1 = 𝜀1i 𝜀2i 𝜀 Mi

The 𝜀mis are assumed to follow a multivariate Logistic distribution (Malik & Abraham1973) with mean zero.

Priors




Parameter Probability density function Default hyperparameters



β p β = |P|12 2πJ2 exp 1 2 β mP β m m = 0 J, P = 0.001 IJ



Syntax

[<model name> = ] clogit( y ~ z1 z2  zK [| x1 x2 xL] [, <options> ] );

where:

PIC The dependent variable, y, in the dataset used for estimation must contain only consecutive integer values, with the numbering starting at 0 (base category). Observations with missing values in y are dropped during estimation, but if a non-integer numerical value is encountered or if the integer values are not consecutive (for example there are no observations for which yi = 1), then an error is produced.

The optional arguments for the conditional Logit model are:8

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 β (J ×1 vector); the default value is 0J

"P"

precision matrix of the prior for β (J ×J symmetric and positive-definite matrix); the default value is 0.001 IJ

Dataset and log-marginal likelihood


"dataset"

the id value of the dataset that will be used for estimation; the default value is the first 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




δ

variable_name

vector of parameters associated with the independent variables that vary by alternative

β

variable_name

vector of parameters associated with the independent variables which are common to all alternatives; these are broken into groups according to the alternative, m, the parameter is associated with




Stored values and post-estimation analysis
If a left-hand-side id value is provided when a conditional Logit 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 β (including δ and the βs across all alternatives, starting from the first one)

z1,,zK

vectors containing the draws from the posterior of the parameters associated with variables that vary by alternative, z1,,zK; (the names of these vectors are the names of the variables as they were included in the right-hand side of the model, excluding the alternative index)

y_m$x1,,
  y_m$xK

vectors containing the draws from the posterior of the parameters associated with variables that are common to all alternatives, x1,,xK, for m = 1,2,,M (the names of these vectors are the names of the variables that were included in the right-hand side of the model, prepended by y_m$, where y_m is the name of the dependent variable followed by an underscore and the index of the alternative; this is done so that the samples on the parameters associated with the same independent variable but for different alternatives can be distinguished)

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

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 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):

The conditional Logit model uses the mfx() function to calculate and report the marginal effects of the independent variables on the probability of each outcome, m, occurring. Because the model calculates only one type of marginal effects, the only valid value for the "type" option is 1. The generic syntax for a statement involving the mfx() function after estimation of a conditional Logit model is:

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

See the general documentation of the mfx() function (section B.14) for details on the other optional arguments.

The conditional Logit model uses the predict() function to generate predictions of the probability each of the M + 1 outcomes occuring. Because the model generates only one type of predictions, the only valid value for the "type" option is 1. The generic syntax for a statement involving the predict() function after estimation of a conditional Logit model is:

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

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/dataset7.csv"); 
myData.constant = ones(rows(myData), 1); 
 
clogit( y ~ z w v | constant );

Example 2

myData = import("$BayESHOME/Datasets/dataset7.csv"); 
myData.constant = ones(rows(myData), 1); 
 
myModel = clogit( y ~ z w v | constant x1 x2 x3 x4, 
    "m"=ones(3+2*5,1), "P"=0.01*eye(3+2*5,3+2*5), 
    "burnin"=20000, "draws"=40000, "thin"=4, "chains"=2, 
    "logML_CJ" = true ); 
 
diagnostics("model"=myModel); 
 
kden(myModel.z, "title" = "delta1"); 
kden(myModel.y_2$x3, "title" = "beta3 for the 2nd alternative"); 
 
margeff_mean = mfx("point"="mean","model"=myModel); 
margeff_median = mfx("point"="median","model"=myModel); 
margeff_eachpoint = mfx("point"="x_i","model"=myModel); 
x_for_mfx = [ 
    0.0,0.0,0.05,         // z, w, v for the base alternative 
    1.0,1.1,0.16,         // z, w, v for the 1st alternative 
    1.0,1.0,0.14,         // z, w, v for the 2nd alternative 
    1.0,1.0,0.5,2.0,0.0   // x variables 
    ]; 
margeff_atx = mfx("point"=x_for_mfx,"model"=myModel); 
 
predict();

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

Share this content:
Facebook Twitter LinkedIn Email
© 2016–20 Grigorios Emvalomatis