When I try to fit an Ordered Logit model to a long dataset the functions return an error Error in solve.default(H, g[!fixed]): system is computationally singular: reciprocal condition number = 3.64628e-18.
I've seen this but the data is not available anymore and I couldn't fix my issue. Also, tried this one and this one with no success.
The code that reproduces the dataset I am using is:
# Example of caracteristic dummies caract <- tibble::tribble(~CPU, ~RAM, 1, 1, -1, 1, 1, -1, -1, -1) # Weights for choosing the probabilities weights <- c(0.3954545, 0.2727273, 0.2363636, 0.0954546) # Simulating the choices block block <- caract block$Alternative <- 1:4 # Simulating the dataset df <- NULL n_decisors <- 50 set.seed(123456) i <- 1 for(i in 1:n_decisors){ block$Decisor <- i block$Choice <- sample(1:4, prob = weights) df <- rbind(df, block) } And the model fitting procedure that returns the error is:
library(mlogit) # Creating the model data object df_mlogit <- mlogit.data(data = df, choice = "Choice", shape = "long", alt.var = "Alternative", varying = 1:2, ranked = T) # Fitting the model m <- mlogit(formula = Choice ~ CPU + RAM, rpar = c(CPU = "n", RAM = "n"), data = df_mlogit) When I make the block of choices non-exhaustive by sampling rows from caract in each iteration of the df simulation the error doesn't occur but I need to estimate a case where the data is the format simulates in this example. Also, I know nnet::multinom(Choice ~ CPU + RAM, data=df) solve this, but it won't fit a mixed logit model, which is also necessary for me.
nnet::multinom(Choice ~ CPU + RAM, data=df)might be an alternative for you?nnet::multinom(Choice ~ CPU + RAM, data=df)won't solve this for the mixed logit case.gmnlsuffers from a similar issue. The data objet must be amlogit.dataclass and when fitting it returns the errorError in s + x[[i]] : non-conformable arrays. Guess I will have to try the bayesian approach. Thanks for the help.