简体   繁体   English

使用Zelig进行Logistic回归[R]

[英]Logistic Regression Using Zelig [R]

I'm running a logit model using the zelig package in R: 我正在使用R中的zelig包运行logit模型:

z.out <- zelig(trade961a ~ age962 + education962 + personal962 + economy962 + partisan962 + employment962 + union962 + home962 + market962 + race962 + income962, data=data96, model="logit")

The dependent variable, trade961a, is a dichotomous factor variable. 因变量trade961a是二分因子变量。 All other variables are numeric. 所有其他变量均为数字。

I am interested in personal962, which is: 我对personal962感兴趣,它是:

> str(personal962)
 num [1:1714] 3 3 1 1 1 2 3 2 2 1 ...

so I run the following to simulate the probability of supporting international trade when personal962 is 1 (better): 因此,我运行以下命令来模拟Personal962为1(更好)时支持国际贸易的可能性:

x.out <- setx(z.out, personal962=1)

I get the following error message: 我收到以下错误消息:

#Error in dta[complete.cases(mf), names(dta) %in% vars, drop = FALSE] :
#  incorrect number of dimensions

Any ideas on what I'm doing wrong? 关于我在做什么错的任何想法吗?

You might not be doing anything wrong. 您可能没有做错任何事情。 There's a record on the Zelig mailing list archive of someone having this same problem, and eventually solving it simply by reinstalling Zelig and all the packages it depends on ( see here ). Zelig邮件列表档案中有一条记录,记录了有人遇到相同的问题,最终只需重新安装Zelig及其依赖的所有软件包即可解决此问题( 请参见此处 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM