开发者

Zelig: Error message

开发者 https://www.devze.com 2022-12-23 20:13 出处:网络
I\'m running an logit model using the Zelig package. I get the following error...what could be wrong?

I'm running an logit model using the Zelig package. I get the following error...what could be wrong?

anes96two <- zelig(trade962a开发者_运维知识库 ~ age962 + education962 + personal962 + economy962 + partisan962 + employment962 + union962 + home962 + market962 + race962 + income962, model="mlogit", data=data96)

 #Error in attr(tt, "depFactors")$depFactorVar : 
#  $ operator is invalid for atomic vectors


Are you sure your dependent variable is as factor? I think the error is because your dependent variable is not a factor. Try str(data96), or summary(data96) to see if trade962a has levels and how many levels. If not, then, just set as a factor. For example: data96$trade962a.f = as.factor(data96$trade962a)

Finally, if you wanna run a logistic regression, you should use 'model="logit"', not "mlogit". Mlogit is for multinomial logit. Thus, if your variable is binary, using mlogit may cause the cited error. If so, just use model="logit".

If none of the above solve your problem, try to plot your dependent variable to see if the data is all right.

regards, Manoel

0

精彩评论

暂无评论...
验证码 换一张
取 消