0
$\begingroup$

What is the best approach to deal with a dataset that has unranked alternatives? For example, suppose that we have some unranked alternatives on the Games dataset:

set.seed(62617)
data("Game2", package = "mlogit")
library(dplyr)
library(mlogit)
df1 <- Game2 %>% group_by(chid) %>% 
  mutate(ch = ifelse(ch > sample(2:6, size = 1), NA, ch))

For example chid 91 only ranked 4 systems

tail(df1) %>% arrange(ch)

## Source: local data frame [6 x 6]
## Groups: chid [1]
## 
## # A tibble: 6 x 6
##     age hours    platform    ch   own  chid
##   <int> <dbl>       <chr> <dbl> <int> <int>
## 1    21     3 PlayStation     1     1    91
## 2    21     3          PC     2     1    91
## 3    21     3  PSPortable     3     0    91
## 4    21     3        Xbox     4     0    91
## 5    21     3     GameBoy    NA     0    91
## 6    21     3    GameCube    NA     0    91

If i keep the data like that, I cannot run mlogit. But, if i assign a value to the missing data I can run it:

dat <-  df1 %>%  
  mutate(ch = replace(ch, is.na(ch), max(ch, na.rm = T)+1)) %>% 
  arrange(chid, ch) %>% as.data.frame()

tail(dat)


## Source: local data frame [6 x 6]
## Groups: chid [1]
## 
## # A tibble: 6 x 6
##     age hours    platform    ch   own  chid
##   <int> <dbl>       <chr> <dbl> <int> <int>
## 1    21     3 PlayStation     1     1    91
## 2    21     3          PC     2     1    91
## 3    21     3  PSPortable     3     0    91
## 4    21     3        Xbox     4     0    91
## 5    21     3     GameBoy    NA     0    91
## 6    21     3    GameCube    NA     0    91


G <- mlogit.data(dat, shape = "long", 
                 choice = "ch", 
                 alt.var = "platform", 
                 ranked = TRUE)

summary(mlogit(ch ~ own | hours + age, G, reflevel = "PC"))


## 
## Call:
## mlogit(formula = ch ~ own | hours + age, data = G, reflevel = "PC", 
##     method = "nr", print.level = 0)
## 
## Frequencies of alternatives:
##          PC     GameBoy    GameCube PlayStation  PSPortable        Xbox 
##     0.17510     0.15175     0.15564     0.17315     0.16926     0.17510 
## 
## nr method
## 2 iterations, 0h:0m:0s 
## g'(-H)^-1g =   693 
## last step couldn't find higher value 
## 
## Coefficients :
##                            Estimate  Std. Error t-value  Pr(>|t|)    
## GameBoy:(intercept)      0.81628316  1.64927272  0.4949    0.6206    
## GameCube:(intercept)     1.29902401  1.68345414  0.7716    0.4403    
## PlayStation:(intercept)  1.06849268  1.92568209  0.5549    0.5790    
## PSPortable:(intercept)   1.26192353  1.78177573  0.7082    0.4788    
## Xbox:(intercept)         1.12939836  1.87812702  0.6013    0.5476    
## own                      1.08434759  0.19475612  5.5677 2.581e-08 ***
## GameBoy:hours            0.01128504  0.05419063  0.2082    0.8350    
## GameCube:hours           0.01697907  0.05399917  0.3144    0.7532    
## PlayStation:hours        0.00477412  0.05520674  0.0865    0.9311    
## PSPortable:hours         0.01212678  0.05421401  0.2237    0.8230    
## Xbox:hours              -0.00707475  0.05576518 -0.1269    0.8990    
## GameBoy:age              0.01356382  0.08114838  0.1671    0.8673    
## GameCube:age            -0.00811528  0.08228813 -0.0986    0.9214    
## PlayStation:age          0.00682376  0.09558260  0.0714    0.9431    
## PSPortable:age          -0.00067296  0.08774267 -0.0077    0.9939    
## Xbox:age                 0.01865369  0.09296617  0.2007    0.8410    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Log-Likelihood: -485.37
## McFadden R^2:  0.4725 
## Likelihood ratio test : chisq = 869.51 (p.value = < 2.22e-16)

Is this the best appoach to follow when dealing with this problem? If not, could you recommend me an alternative approach?

$\endgroup$
  • $\begingroup$ Why are you interested in ordered logit if your data is not ordered? Also, can't you try and infer the N.A. from the data it self, or is that a category that matters to you analysis? $\endgroup$ – Guilherme Marthe Jun 27 '17 at 21:12
  • $\begingroup$ The data is ordered. In the example chid 91 only provided an ordered ranking for 4 gaming systems and left two empty. $\endgroup$ – Ignacio Jun 27 '17 at 21:14
  • $\begingroup$ You could use some data imputation method for the N.A.s $\endgroup$ – Guilherme Marthe Jun 27 '17 at 21:17

Your Answer

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

Browse other questions tagged or ask your own question.