[R] “Error in if (abs(x - oldx) < ftol)” when using “lognormal” distribution in mixed logit

Dera derawang at udel.edu
Fri Jul 24 00:33:19 CEST 2015


Hi, I have a question about how to use the mlogit package in R to do analysis
of discrete choice survey data. Our survey is about asking people to choose
from different insurance policies(with two attributes of deductible and
premium).

The code I used to fit mixed logit is:


[1] ml <- mlogit.data (mydata, choice="choice", shape = "wide", id =
"individual", 
               opposite =c ('deductible', 'premium'),varying = 5:10)

[2] ml.w5 <- mlogit (choice~deductible+premium|0, ml, panel = TRUE, 
             rpar = c(deductible='ln', premium='ln'), 
             R = 100, halton = NA, print.level=0)

I try to use lognormal because we hope the coefficients for both deductible
and premium are negative. And I use "opposite" in [1] to reverse the sign
because lognormal is always positive.

But I always get the error warning:

"Error in if (abs(x - oldx) < ftol) { : missing value where TRUE/FALSE
needed
In addition: Warning message: In log(start[ln]) : NaNs produced"
I double check the data and am sure there isn't any missing data. And if I
change the lognormal "ln" to "n" or "cn", it will work without any warning.

Does anyone know how to deal with this? Thank you for your help.



--
View this message in context: http://r.789695.n4.nabble.com/Error-in-if-abs-x-oldx-ftol-when-using-lognormal-distribution-in-mixed-logit-tp4710284.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list