0

I am trying to run a multinominal regression model but I keep getting the same error code (Title) when running the model with control variables (Age, Gender, Degree). Only Salary variable provides me with an output.

enter image description here

CSlayer = CSlayer %>% mutate(netsize_netcomp = netsize*netcomp,
netsize_payapp = netsize*payapp,
netsize_intercon = netsize*intercon,
netsize_Price = netsize*Price)

CSlayer = CSlayer %>%
mutate(Age = recode(CSlayer$Age,
                  "Under 18" = 0, "18-25" = 1, "26-50" = 2, "Over 50" = 3,
                  "Prefer not to answer" = 4))

CSlayer = CSlayer %>%
  mutate(Gender = recode(CSlayer$Gender,
                     "Female" = 0, "Male" = 1, ))

CSlayer = CSlayer %>%
 mutate(Degree = recode(CSlayer$Degree,
                     "Elementary School (7-10 years)" = 0, "High School (13 years)" = 
1, 

                     "Bachelor Degree" = 2, "Masters Degree" = 3,
                     "PhD" = 4, "Prefer not to say" = 5))


CSlayer = CSlayer %>%
  mutate(Salary = recode(CSlayer$Salary,
                     "0 to 100 000 NOK" = 0, "100 000 NOK to 250 000 NOK" = 1,
                     "250 000 NOK to 500 000 NOK" = 2, "500 000 NOK to 750 000 NOK" = 
3,
                     "750 000 NOK to 1 million NOK" = 4, "More than 1 mill NOK" = 5,
                     "Prefer not to answer" = 6))




#logit data
CS <- mlogit.data(data=CSlayer, choice = "choice", 
              shape = "long", alt.var = "Alt", id.var = "id")


#Logit model
model<- mlogit(choice ~ 0  + netsize + netcomp + payapp + 
                 Price + netcomp + intercon + Age + Gender
                 + Degree + Salary, CS)
Phil
  • 7,287
  • 3
  • 36
  • 66
  • Check the correlation between the predictors of your model. There is likely a situation where two predictors are perfectly correlated, or one variable is in fact constant. – Phil May 27 '22 at 15:50
  • Thank you, there is correlation between the variables as you say! Is there anything I can do to in order to get an output on the mlogit then? – Simen Sagli May 28 '22 at 10:51
  • Remove one of the two variables since they provide the same information. – Phil May 28 '22 at 14:48

0 Answers0