简体   繁体   English

逻辑回归的误差Zelig R

[英]Error from logistic regression Zelig R

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

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

newdata$bes.Turnout is binary, the rest are numerical. newdata$bes.Turnout是二进制的,其余的都是数字的。

I try to set the values of x. 我尝试设置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)

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

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

I have tried the same code for the survival data in Zelig, and here the setx worked. 我曾在Zelig中尝试过用于生存数据的相同代码,而setx在这里起作用。

Any ideas what I am doing wrong and how to fix it? 任何想法我在做什么错以及如何解决?

That call to setx doesn't make sense to me. setx调用对我来说没有任何意义。 My best guess is that you want something like 我最好的猜测是,您想要类似

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

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

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