Skip to content
Prev 385751 / 398503 Next

Help with the Error Message in R "Error in 1:nchid : result would be too long a vector"

Hello,

I apologize if the rest of quotes prior to David's email are missing, 
for some reason today my mail client is not including them.

As for the question, there are two other problems:

1) Alt_name is misspelled, it should be ALT_name;

2) the data is in wide, not long, format.

A 3rd, problem is that in ?dfidx it says

alt.var	
the name of the variable that contains the alternative index (for a long 
data.frame only) or the name under which the alternative index will be 
stored (the default name is alt)


So if shape = "wide", alt.var is not needed.
But I am not a user of package mlogit, I'm just guessing.

The following seems to fix it (it doesn't throw errors).


mldata1 <- dfidx(mydata, shape = "wide",
                  #alt.var = "ALT_name",
                  choice = "Choice_binary",
                  id.var = "IND")


Hope this helps,

Rui Barradas


?s 16:15 de 22/09/20, David Winsemius escreveu: