由于以下错误,可以运行GLM:“可变长度有所不同(发现数据;)
我尝试使用GLM函数运行回归,但是我将获得相同的错误消息:“变量长度有所不同(发现数据')”。我看不出我的数据的长度与我的依赖和自变量的1000个样本的长度没有相同的长度。我进行总数据示例的原因是因为我有超过一百万的观察结果,我想看看该模型是否正常工作。 (用所有数据运行它需要很长时间)这是我使用的代码:
sample = sample(1:nrow(agg), 1000, replace = FALSE)
y=agg$TO_DEFAULT_IN_12M_INDICATOR[sample]
test <- glm(as.factor(y) ~., data = as.factor(agg[sample,]), family = binomial)
#coef(full.model)
这里的AGG包含我的所有数据,而我的y是0和1的指示函数。有人知道我如何解决这个问题吗?
I try to run a regression using the glm function, however I keer getting the same error message: "variable lengths differ (found for 'data')". I can't see how my data does not have the same length as I use a sample of 1000 for both my dependent and independent variables. The reason I take a sample of my total data is because I have more than a million observations and I want to see if the model works properly. (running it with all the data takes a very long time) This is the code I use:
sample = sample(1:nrow(agg), 1000, replace = FALSE)
y=agg$TO_DEFAULT_IN_12M_INDICATOR[sample]
test <- glm(as.factor(y) ~., data = as.factor(agg[sample,]), family = binomial)
#coef(full.model)
Here agg contains all my data, and my y is an indicator function of 0's and 1's. Does anyone know how I could fix this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论