code? example data?  We can only guess based on your vague post.

"PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code."

Moreover, this sounds like a statistical question, not a question about R 
programming, and so might be more appropriate for a statistical list like 
stats.stackexchange.com<http://stats.stackexchange.com>  .

Cheers,
Bert


Bert Gunter



Sorry if I was not clear enough, but  there is hardly any code to show.
The problem is that a parameter or function is lacking (or , mostly likely, I 
can't find it), so in some sense the problem itself is that  there is no code 
to show.

In what follows choice situations , alternatives, wide, and variables have the 
same meaning that they have on the mlogit documentation. All variables are 
alternative specific.

1)I want to estimate a multinomial Logit  using the mlogit package

2)I have a dataset, made of choice situations

3)There is a set of alternatives

4)in some choice situations, not all alternatives were available, but only a 
subset of them. So there are no variables for the unavailable alternatives and 
the chosen alternative evidently  belongs to the set of available ones.

5)I use mlogit.data to prepare the dataset from a "wide" dataframe . There is 
no option to have only a subset of alternatives and the resulting object will 
have them all , that is, there will be a line for every alternative and every 
choice situation, even if in reality some of them were not available. The 
variables of these alternatives did not exist, so must be filled with 0s or any 
other made up value

6) If ones estimate a model from this data it will be wrong

7) It is possible to get an "almost right" model by using a dummy variable 
marking which alternatives are unavailable, for as it is only used in 
alternatives that are never chosen, its coefficient will get negative with big 
absolute value, in practice giving almost 0% probability for them

8)this is a workaround because it obligates the model to estimate a number that 
should be -infinity and this is known in advance, so it's ugly and difficult to 
know what the numeric consequences are as the coefficient can never converge. 
In fact, I don't use it the way I described for these reasons, preferring a 
more complex but almost equivalent formulation. The important point is that I 
want a clean solution, not a workaround

9)I demand simply if mlogit package has such functionality





Hi,
I meant that in some choice situations there are some alternatives missing, but 
the available alternatives are known to everybody(both the one that made the 
choice as well as to who collected the data).
For future reference, I would like to post here that I found the answer.
Apparently it is not possible if one uses mlogit.data  with shape = “wide”, but 
it is if one uses it with shape = “long” .
So basically one can create an alternative specific variable with availability 
(let’s call it is_avaliable) and use mlogit.data  normally that is :
all_avaliable <- mlogit.data(df , shape = “wide” , …)
then one can subset it
real_avaliability <-  all_avaliable[all_avaliable$is_avaliable ,]
and resend it through mlogit.data with format long
mlogit.data(real_avaliability , shape = "long" , alt.var = "alt" ,  chid.var = 
"chid", …)
please observe that alt and chid will have been created by the first call to 
mlogit.data

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to