0

any other idea for this? look my case:

library("mlogit")

library(readxl)
DataSet <- read_excel("C:/Users/HP ProBook/OneDrive/OneDrive - Universidad de Costa Rica/Documentos/ECONOMÍA UCR/ECONOMÍA UNIVERSIDAD DE COSTA RICA/Seminario 2/DataSet/DataSet.xlsx")

library("dfidx")

Data <- dfidx(DataSet, idx = list(c("chid", "id")),
                choice = "choice", varying = 5:10, sep = "", shape = "wide")

then I run the mixed logit:

Data.mxl <- mlogit(choice ~ is + mt | 0, Data,
              rpar=c(is = 'n', mt = 'n'), 
              R = 100, halton = NA, panel = TRUE, seed = 1 )

I get the following error:

Error in if (abs(x - oldx) < ftol) { : 
missing value where TRUE/FALSE needed
  • Greetings! Usually it is helpful to provide a minimally reproducible dataset for questions here. One way of doing this is by using the `dput` function. You can find out how to use it here: https://youtu.be/3EID3P1oisg – Shawn Hemelstrand Sep 27 '22 at 14:48
  • Thanks Shawn Hemelstrand for this reminder, I didn't have it on my mind. – David Mora Salazar Sep 28 '22 at 20:35
  • here would be my dput database, if you have any idea of my issue: – David Mora Salazar Sep 28 '22 at 20:48
  • structure(list(v = c(1, 1, 1, 1, 1, 1), qid = c("a", "b", "c", "d", "e", "f"), choice = c(1, 3, 1, 2, 1, 1), id = c(1, 1, 1, 1, 1, 1), is1 = c(1200000, 1350000, 1e+06, 1350000, 1e+06, 1100000 ), is2 = c(1250000, 1300000, 1200000, 1350000, 1100000, 1300000 ), is3 = c(1300000, 1250000, 1100000, 1300000, 9e+05, 1e+06), mt1 = c(2, 4, 2, 4, 3, 2), mt2 = c(3, 3, 4, 2, 4, 4), mt3 = c(4, 2, 3, 3, 1, 1), chid = c(1, 2, 3, 4, 5, 6)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame")) – David Mora Salazar Sep 28 '22 at 20:48
  • Please add this to the question area not the comments :) – Shawn Hemelstrand Sep 28 '22 at 23:23

0 Answers0