melff / mclogit

mclogit: Multinomial Logit Models, with or without Random Effects or Overdispersion
http://melff.github.io/mclogit/
23 stars 4 forks source link

Error in formula #32

Closed g-inglese closed 1 year ago

g-inglese commented 1 year ago

Hi, I've been trying to set up a multinomial model with random effects using mclogit, but I get stuck because no matter which dataset or formula I use, I always get the same error in R "Error in formula[[2]][[1]] : object of type 'symbol' is not subsettable". I've looked for a solution around but could not find one, any ideas how to fix this? Any help would be much appreciated! Thanks!

melff commented 1 year ago

Please give a code example. Otherwise, I will not be able to help. Thank you!

g-inglese commented 1 year ago

Sure thing! This is the code I first tried:

install.packages("mclogit") library(mclogit) model <- mclogit(Construction~Prefix+Spatial+Aspect, random=~1|Lemma, data = recp_lat)

As I said, I tried both with and without random effects, with other datasets and with other variables, but the error is the same. I am using RStudio Version 2023.09.1+494.

Thanks

melff commented 1 year ago

Which RStudio version you are using is not relevant here. Which R version and which mclogit version are you using? Can you please call traceback() after the error occurs and send me the output of this?

melff commented 1 year ago

Your model formula is wrong. The left-hand side must be either cbind(Construction,id) or (Construction|id). Please make sure that you have read and understand the documentation before you file an issue.

g-inglese commented 1 year ago

Sorry, I had overlooked that! Thanks again for the quick response and your support, this helps a lot!