中的R运行线性回归时警告消息

问题描述 投票:0回答:1

我试图运行R中的线性回归,但得到以下错误:

Warning messages:
1: In model.response(mf, "numeric") :
 using type = "numeric" with a factor response will be ignored
2: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors

该代码是:

reg_ex1 <- lm(V45~TotalScore,data = Combineddatainprogresscsv)

这两个值,V45,和TotalScore是数值。谷歌搜索产生了类似的问题,其中有人认为,CSV文件可能有逗号。但我不是专家,所以不知道该如何检查?

谢谢!

有1300线,所以这里只是输出的最后一部分。让我知道如果你需要更多。

    "50", "60", "70", "80", "90", "Compared to others who may have taken this test, how well do you think you scored? - 1"
), class = "factor"), V46 = structure(c(23L, 6L, 4L, 22L, 
4L, 8L), .Label = c("", "0", "1", "10", "11", "12", "13", 
"14", "15", "16", "17", "18", "19", "2", "20", "3", "4", 
"5", "6", "7", "8", "9", "Score"), class = "factor"), TotalScore = c(0L, 
12L, 10L, 9L, 10L, 14L)), row.names = c(NA, 6L), class = "data.frame")
r
1个回答
0
投票

看来你的应变量V46是一个因素。你可以看到它在你粘贴输出:V46 = structure(c(23L, 6L, 4L, 22L, 4L, 8L), .Label = c("", "0", "1", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "2", "20", "3", "4", "5", "6", "7", "8", "9", "Score"), class = "factor")

我建议将V46字符,然后为数字,最后筛选出这将是由“分数”水平产生的遗漏值。

你一定要倾听人民的意见,以便更容易帮助你:)

© www.soinside.com 2019 - 2024. All rights reserved.