DISCLAIMER: If the following text is not compiling for whatever reason, please use the README.pdf file available in the repo.
The package provides estimation and inferential procedures for rank-ordered logit model with agents with heterogeneous taste preferences.
We have
where
For notational convenience, define the functions
An observed ranking for a respondent implies a complete ordering of the underlying utilities. An individual will prefer an item with a higher utility over an item with a lower utility. If we observe a full ranking
Therefore, the probability of observing a particular ranking
In light of this, we can see that the rank-ordered logit is nothing else than a series of multinomial logit (MNL) models: when
In its most general form, we allow the user to model
$$ u_{i\ell} = X_{i\ell}^{\top} \boldsymbol{\beta}{\mathtt{F}} + Z_i^{\top} \boldsymbol{\alpha}{\ell,\mathtt{F}} + W_{i\ell}^{\top} \boldsymbol{\beta}i + V_i^{\top} \boldsymbol{\alpha}{i\ell} + \delta_{\ell} $$
An alternative, handier way to rewrite the model above is to define
$$ u_{i\ell}=X_{i\ell}^\top\boldsymbol{\beta}{\mathtt{F}} + Z{i\ell}^\top\boldsymbol{\alpha}{\mathtt{F}} + W{i\ell}^\top\boldsymbol{\beta}i + V{i\ell}^\top\boldsymbol{\alpha}{i} + \delta\ell, $$
where:
-
$X_{i\ell}$ are covariates varying at the unit-alternative level whose coefficients are modelled as fixed -
$Z_{i}$ are covariates varying at the unit level whose coefficients are modelled as fixed -
$W_{i\ell}$ are covariates varying at the unit-alternative level whose coefficients are modelled as random -
$V_{i}$ are covariates varying at the unit level whose coefficients are modelled as random the random coefficients - The heterogeneous taste coefficients are modeled as a joint multivariate normal and are i.i.d. across units with mean
$\left[\boldsymbol{\alpha_{\mathtt{R}}}^\top,\boldsymbol{\beta_{\mathtt{R}}}^\top\right]^\top$ and variance$\boldsymbol{\Sigma}$ . -
$\delta_\ell$ are alternative-specific fixed effects -
$\epsilon_{i\ell}\sim\mathsf{Gu}(0,1)$ are idiosyncratic i.i.d. shocks
Note that whenever
If instead agents are allowed to have heterogeneous taste, then
The parameter vector to be estimated is thus
The ideal maximum likelihood estimator is defined as
$$ \widehat{\theta}{\mathtt{ML}}:=\mathrm{arg}\max{\theta} \sum_{i=1}^n\log\int \prod_{j=0}^{J-1} \frac{\exp \left(u_{ir_i(j)}(\theta)\right)}{\sum\limits_{j\leq \ell\leq J} \exp \left(u_{ir_i(\ell)}(\theta)\right)} \phi(\beta_i;\beta_{\mathtt{R}},\Sigma) \mathrm{d} \beta_i. $$
We approximate the integral via montecarlo as
$$ \widehat{\mathbb{P}}{(\widehat{\beta},\widehat{\Sigma})}[r_i\mid \mathcal{D}]=\frac{1}{S}\sum{i=1}^S \prod_{j=0}^{J-1} \frac{\exp \left(u_{ir_i(j)}(\theta,\beta_i^{(s)})\right)}{\sum\limits_{j\leq \ell\leq J} \exp \left(u_{ir_i(\ell)}(\theta,\beta_i^{(s)})\right)}, $$
where $\boldsymbol{\beta}i\overset{\mathtt{iid}}{\sim}\mathsf{N}(\widehat{\boldsymbol\beta}{\mathtt{R}},\widehat{\boldsymbol{\Sigma}})$.
You can install the development version of rcrologit from GitHub with:
# install.packages("devtools")
devtools::install_github("filippopalomba/rcrologit")
library(rcrologit)
data <- rcrologit_data
# Rank-ordered logit
dataprep <- dataPrep(data, idVar = "Worker_ID", rankVar = "rank",
altVar = "alternative",
covsInt.fix = list("Gender"),
covs.fix = list("log_Wage"), FE = c("Firm_ID"))
rologitEst <- rcrologit(dataprep)
# Rank-ordered logit
dataprep <- dataPrep(data, idVar = "Worker_ID", rankVar = "rank",
altVar = "alternative",
covsInt.het = list("Gender"),
covs.fix = list("log_Wage"), FE = c("Firm_ID"))
rologitEst <- rcrologit(dataprep, stdErr="skip")