【问题标题】:Error from logistic regression Zelig R逻辑回归 Zelig R 的误差
【发布时间】:2016-07-14 12:19:45
【问题描述】:

我正在使用 R 中的 zelig 包运行 logit 模型。

m3 <- zelig (newdata$bes.Turnout ~  civicduty + newdata$bes.CivicDuty2+newdata$bes.Age, model="logit", data=newdata)

newdata$bes.Turnout 为二进制,其余为数字。

我尝试设置 x 的值。

mcos<- median(newdata$bes.CivicDuty2)
civicmean<-mean(civicduty)  
mage<-mean(newdata$bes.Age)

test<-setx(m3, civicduty=civicmean, newdata$bes.CivicDuty2=mcos, newdata$bes.Age=mage)

我收到以下错误消息:

Error: unexpected '=' in "test<-setx(m3, civicduty=civicmean, newdata$bes.CivicDuty2="      

我已经为 Zelig 中的生存数据尝试了相同的代码,并且 setx 在这里工作。

任何想法我做错了什么以及如何解决它?

【问题讨论】:

    标签: r


    【解决方案1】:

    setx 的调用对我来说没有意义。我最好的猜测是你想要类似的东西

    test<-setx(m3, 
               civicduty = mean(newdata$civicduty),
               bes.CivicDuty2 = mean(newdata$bes.CivicDuty2,
               bes.Age = mean(newdata$bes.Age))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-01
      • 2018-01-26
      • 1970-01-01
      • 1970-01-01
      • 2013-05-06
      • 1970-01-01
      • 2018-02-12
      • 2014-06-20
      相关资源
      最近更新 更多