The csv for the dataframe is here. Basically the column Mode represents the transportation choice available for the user to go to the airport, Choice represents the user's choice, and all the other columns depict the variables affecting the choice. I am posting some code below. the mFormula function just segregates the variables into 3 parts separated by a '|' i.e
alternative dependent w generic coefficients | individual specific w alternative specific coefficients | alternative dependent w alternative specific coefficients
I tried two formulas with the mFormula function one of which outputs the coefficients(f1) but doesn't model the variables for the utility function as it should(f).
library(mlogit)
path=""
a<-read.table(path,sep=",", header=TRUE)
Ta<-mlogit.data(a,shape="long",alt.var="Mode",choice="Choice")
f <- mFormula(Choice ~ CostPersonal+CostTrainBus+CostCarpool+CostTaxi+CostSharedTaxi+CostCS+CostSCS+DistSYR+DistNYC+DistALB+DistEWR+SafteyPersonal+SafteyTrainBus+SafteyCarpool+SafteyTaxi+SafteySharedTaxi+SafteyCS+SafteySCS+PrivacyPersonal+PrivacyTrainBus+PrivacyCarpool+PrivacyTaxi+PrivacySharedTaxi+PrivacyCS+PrivacySCS+ConviniencePersonal+ConvinienceTrainBus+ConvinienceCarpool+ConvinienceTaxi+ ConvinienceSharedTaxi+ConvinienceCS+ConvinienceSCS+payUticaSYR+payUticaALB+flightsYear+daysBreturn+incomeB+familySize+ageB|Airport+TimePersonal+TimeTrainBus+TimeCarpool+TimeTaxi+TimeSharedTaxi+TimeCS+TimeSCS+luggage+ownVehicle+shuttleMaxPersonsB)
f1<- mFormula(Choice ~ 1| +0+CostPersonal+CostTrainBus+CostCarpool+CostTaxi+CostSharedTaxi+CostCS+CostSCS+Airport+DistSYR+DistNYC+DistALB+SafteyPersonal+SafteyTrainBus+SafteyCarpool+SafteyTaxi+SafteySharedTaxi+PrivacyPersonal+PrivacyTrainBus+PrivacyCarpool+PrivacyTaxi+PrivacySharedTaxi+ConviniencePersonal+ConvinienceTrainBus+ConvinienceCarpool+ConvinienceTaxi+ConvinienceSharedTaxi+TimePersonal+TimeTrainBus+TimeCarpool+TimeTaxi+TimeSharedTaxi+flightsYear+daysBreturn+luggage+ownVehicle+incomeB+familySize+ageB+shuttleMaxPersonsB+payUticaSYR+payUticaALB)
ml.a<-mlogit(f,Ta)#does not output coefficients
ml.a<-mlogit(f1,Ta)#does output coefficients
summary(ml.a)`
The error is:
Error in solve.default(H, g[!fixed]) :
Lapack routine dgesv: system is exactly singular: U[3,3] = 0
although mlogit with f1 does output the coefficients with a
Likelihood: -2.2039e-07
Clearly I don't understand which variables should and should not be included and co-relation between which ones is causing the issue.