Dear all, I am implementing a stochastic utility model that will eventually make use of multinomial logit. I found that there is a package in R called mlogit. I am not sure whether I have already found the correct package or software. May I ask am I correct?
Basically, let's say I have observations of n outcomes, for each outcome 1<=i<=n, they were selected by a choice from a set S_i = { H(i,j) | 1 <= j <= m_i } with utility U(i,j) Assuming each outcome was chosen by maximizing the utility. Let U*(i) = max{ U(i,j) | 1 <= j <= m_i } Therefore, each outcome was chosen among m_i items by finding the index j such that U(i,j) = U*(i). For the utility function U(i,j), there are some independent variables, V_ij(k), 1 <= k <= N i.e. U(i,j) = theta_1 * V_ij(1) + theta_2 * V_ij(2) + ... + theta_N V_ij(N) Further assume the probability of choosing H(i,j) in observations i is: P(i,j) = exp(U(i,j)) / sum_{j=1}^{m_i} ( exp(U(i,j)) Then, I will estimate the parameters of the model theta_1, theta_2, ..., theta_N by maximizing the the log-likelihood function L = log { prod_{i=1}^{n} P*(i) } where P*(i) = exp(U*(i)) / sum_{j=1}^{m_i} ( exp(U(i,j)) I believe I can create a data.frame similar to this: outcome observe V1 V2 V3 V4 1 1 .... 0 1 .... 0 1 .... 0 1 ... 1 2 ... 0 2 ... 0 2 ... 0 2 ... 0 2 .. 0 2 ... 1 3 ... 0 3 ... 0 3 ... and then convert it by mlogit.data method by specifying chld.var="observe" mdata <- mlogit.data(data,choice="outcome",shape="long",chid.var="observe") Am I right? and then I could use mlogit to fit my model. Furthermore, I am also quite puzzled with the mFormula and the probit boolean flag, am I correct to use fit <- mlogit(outcome ~ V1 + V2 + V3 + V4,data=mydata) and then compute my probability estimate from the coefficients? What are the difference if I put variable between the separator | ? Thank you very much. Best regards, WONG Hang. ______________________________________________ R-help@r-project.org mailing list 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.