I am going to use mlogit package. I run it like example but it still gives me an error and I don't know what to do about it.
data72 = mlogit.data(data, choice ="Hour72motor", shape ="long", ,alt.levels="mode")
simple = mlogit(Hour72motor ~ Hemisphere +Lesionlocation + gender + Age+ DoesHematoma+study, data=data72)
The error is:
Error in contrasts<-(tmp, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels
Thank you for your support.
I add the comment which is recommended; to examine the counts of non-numeric variables in the model
testdat <- na.omit(data72[c("Hour72motor", "Hemisphere", "Lesionlocation",
"gender","Age", "DoesHematoma", "study")]) ;
lapply(testdat[!sapply(testdat, is.numeric)], table)
# $Hour72motor
# FALSE TRUE
# 128 16