mlogit function Error

Hi does anyone know how to fix this error in mlogit function?

# a ranked ordered model
data("Game", package = "mlogit")
g <- mlogit(ch ~ own | hours, Game, varying = 1:12, ranked = TRUE,
            reflevel = "PC", idnames = c("chid", "alt"))

Error in is.recursive(.$object) && !is.primitive(.$object) && n > 0 :
'length = 2' in coercion to 'logical(1)'

Try cutting and pasting the below.

library(mlogit)
#> Loading required package: dfidx
#> 
#> Attaching package: 'dfidx'
#> The following object is masked from 'package:stats':
#> 
#>     filter
data("Game", package = "mlogit")
g <- mlogit(ch ~ own | hours, Game, varying = 1:12, ranked = TRUE,
            reflevel = "PC", idnames = c("chid", "alt"))
g
#> 
#> Call:
#> mlogit(formula = ch ~ own | hours, data = Game, reflevel = "PC",     varying = 1:12, ranked = TRUE, idnames = c("chid", "alt"),     method = "nr")
#> 
#> Coefficients:
#>     (Intercept):GameBoy     (Intercept):GameCube  (Intercept):PlayStation  
#>                0.092797                 0.046072                 0.939225  
#>  (Intercept):PSPortable         (Intercept):Xbox                      own  
#>                0.803055                 1.396700                 0.964402  
#>           hours:GameBoy           hours:GameCube        hours:PlayStation  
#>               -0.235109                -0.186557                -0.129738  
#>        hours:PSPortable               hours:Xbox  
#>               -0.234414                -0.172948

Created on 2023-11-28 with reprex v2.0.2

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.