使用GLM在R中的大数据集上运行Logit函数

发布于 2025-01-27 06:17:57 字数 668 浏览 2 评论 0原文

我尝试使用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?

part of the dataset snap shot, here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瑾夏年华 2025-02-03 06:17:57

正如上面@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")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文