0
$\begingroup$

The Problem

I am trying to estimate a conditional multinomial logit model where each household has an observed house choice outcome given a set of alternatives. Each set of alternatives is unique to the household. The attributes for all houses and households are the same.

The problem is that I cannot include individual specific variables into mlogit without getting a computationally singular error. Why is this?

A Reproducible Example:

Here is some example data:

df = data.frame(t(matrix(
c(4000019, 1, 7787,    2008, 1.4395055, 
4000019, 0, 20751,   1930, 5.7378930,  
4000019, 0, 10417,   1987, 0.8149074,  
4000045, 1, 18369,   2001, 1.3781223,  
4000045, 0, 18026,   1998, 3.1162452,  
4000045, 0, 7319,    1985, 1.6771325,  
4000208, 1, 60,      2002, 0.3783794,  
4000208, 0, 5507,    1984, 0.6589352,  
4000208, 0, 2268,    1983, 0.2505387,  
4000223, 1, 17380,   1924, 0.7830429,  
4000223, 0, 9832,    2006, 2.2911607,  
4000223, 0, 8122,    2000, 6.0207814,  
4000317, 1, 13690,   1997, 3.1613056,  
4000317, 0, 784,     2004, 4.8638361,  
4000317, 0, 14020,   1959, 1.7319478),
nrow = 5,
ncol=15)))
colnames(df) =  c('hh_id', 'y', 'house_id', 'var1',  'var2')

Where,

  • hh_id: houehold id
  • y: choice outcome (1 if household selects house, 0 o/w)
  • var1: alternative specific variable
  • var2: individual specific variable

and each household has a unique set of three alternatives.

When I run a specification with only the alternative specific variable (var1) everything works:

mlogit(y ~
         var1   |# Alternative Specific variables
         0  |# Individual Specific variables without an intercept
         0,
       data = df, 
       chid.var = "hh_id", 
       alt.var = "house_id", 
       choice = "y", 
       shape = "long") %>% summary



Call:
mlogit(formula = y ~ var1  | 0 | 0, data = df, chid.var = "hh_id", 
    alt.var = "house_id", choice = "y", shape = "long", method = "nr")

Frequencies of alternatives:
   60   784  2268  5507  7319  7787  8122  9832 10417 13690 14020 17380 18026 18369 20751 
  0.2   0.0   0.0   0.0   0.0   0.2   0.0   0.0   0.0   0.2   0.0   0.2   0.0   0.2   0.0 

nr method
6 iterations, 0h:0m:0s 
g'(-H)^-1g = 2.09E-07 
gradient close to zero 

Coefficients :
      Estimate Std. Error z-value Pr(>|z|)
var1  0.027668   0.033820  0.8181   0.4133

Log-Likelihood: -4.0664

However, when I try and include an indiviual specific variables (var2) the specification is singular.

mlogit(y ~
         var1   |# Alternative Specific variables
         var2 + 0  |# Individual Specific variables without an intercept
         0,
       data = df, 
       chid.var = "hh_id", 
       alt.var = "house_id", 
       choice = "y", 
       shape = "long") %>% summary

Error in solve.default(H, g[!fixed]) : 
  system is computationally singular: reciprocal condition number = 3.07183e-22
$\endgroup$
0
$\begingroup$

For those in the future who may get stuck on a similar problem: The reason I cannot include an individual specific variable in this model has to do with the fact that each alternative is only observed once. Because of this there is no way to fit an intercept for any alternative, thus interacting an individual specific variable is impossible.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.