[R] Error computing mlogit model

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Wed Aug 26 12:43:09 CEST 2020


Hi Eric,
There are a few mysteries in your request. As we don't know what "des"
is, it is difficult to see why it does not have the correct number of
dimensions. It looks like it should be an n x 6 matrix, but is that
what it really is and does the mlogit function expect such a matrix?

JIm

On Wed, Aug 26, 2020 at 6:09 PM Nyarko Eric <nyarkoeric5 using gmail.com> wrote:
>
> Hi
>
>
>
> Please, I get this error message “Error in data[theorder, ] : incorrect
> number of dimensions” when I run the mlogit model presented below.
>
>
>
> Best regards,
>
> Eric
>
>
>
>
>
> library(mlogit)
>
> library(idefix)
>
> idefix.data *<- *aggregate_design
>
> idefix.data
>
> des *<- *as.matrix(idefix.data[, 3*:*8], ncol = 6)
>
> des
>
> y *<- *idefix.data[, 9]
>
> y
>
>
>
> mlogit.data *<- *Datatrans(pkg = "mlogit", des = des, y = y,
>
> n.alts = 2, n.sets = 8, n.resp = 7, bin = TRUE)
>
>
>
> gh3aP <- mlogit(y ~ -1 + par.1 +par.2 +par.3 +par.4+ par.5 +par.6, data =
> des)
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list