Error computing mlogit model

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error computing mlogit model

Nyarko Eric
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Error computing mlogit model

Jim Lemon-4
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 <[hidden email]> 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]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.