输入如下程序
>choice=c('choice1','choice2','choice3')
>sex=c('f','m','f')
> income=c(30,40,50)
>time1=c(23,46,57)
> time2=c(34,44,34)
> time3=c(45,64,56)
> cost1=c(45,35,56)
> cost2=c(40,64,46)
> cost3=c(30,31,75)
> comfort1=c(34,34,46)
> comfort2=c(44,13,43)
> comfort3=c(56,35,64)
> moss=data.frame(choice=choice,sex=sex,income=income,time1=time1,time2=time2,
time3=time3,cost1=cost1,cost2=cost2,cost3=cost3,comfort1=comfort1,comfort2=comfort2,comfort3=comfort3)
接下来使用mlogit.data函数,把moss改为long表示形式,出现如下蓝色字体的错误提示,请高手解答一下,不甚感激!
moslong=mlogit.data(moss,choice='choice',varying=4:12,shape='wide',alt.levels=1:3)
错误于guess(varying):
failed to guess time-varying variables fromtheir names