使用GLM在R中的大数据集上运行Logit函数
我尝试使用GLM构建一个简单的logit函数,但找不到使其正常工作的方法。主要原因是我是R的新手,因此,如果太简单,请原谅我的天真问题。
我面对的问题是,我找不到一种用于运行数据的简单logit函数命令的方法。我做以下内容。
mydata< - read.csv(“ c:/users/gp/tabtransformernets/pneu_features_pivoted.csv”)
mylogit< -glm(target〜mydata [target〜mydata [,1:2169],data =,data =,data =,data =,数据mydata,family =“二项式”)
myData中的目标列是我想在其上运行logit以计算赔率比的因变量。但是,我会收到以下错误:
model.frame.default中的错误(公式= target〜mydata [,1:2169],:: 变量'mydata [,1:2169]的无效类型(列表)“
我找不到解决此问题的方法,请您提供帮助吗?
I try to construct a simple Logit function using glm but I can't find a way to make it work. The main reason is that I am totally new to R, hence please forgive my naive question if that's too simple.
The issue I face is that I can't find a way to run the simple Logit function command for my data. I do the following.
mydata<- read.csv("C:/Users/gp/TabTransformerNets/Pneu_features_pivoted.csv")
mylogit <- glm(target ~ mydata[,1:2169], data = mydata, family = "binomial")
The target column in mydata is the dependent variable on which I want to run the Logit for calculating odds ratios. However, I get the following error:
Error in model.frame.default(formula = target ~ mydata[, 1:2169], :
invalid type (list) for variable 'mydata[, 1:2169]'
I can't find a way to solve this, could you please help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如上面@andy baxter所建议的那样,对此的快速解决方案是:
glm(target〜。,data = mydata,family,family =“ binomial”)
As suggested by @Andy Baxter above, the quick solution for this is:
glm(target ~ ., data = mydata, family = "binomial")