R语言解多元线性方程R语言中输入test之后,数据如下:>testx1 x2 y1 30.0 760.0 114.52 15.0 901.5 77.03 15.0 698.0 59.54 16.0 595.0 54.05 47.8 589.0 135.0然后输入:> Im.test=Im(test$y~test$x1+test$x2)Error in Im(test$y test$x1 + t

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/12 04:23:59

R语言解多元线性方程R语言中输入test之后,数据如下:>testx1 x2 y1 30.0 760.0 114.52 15.0 901.5 77.03 15.0 698.0 59.54 16.0 595.0 54.05 47.8 589.0 135.0然后输入:> Im.test=Im(test$y~test$x1+test$x2)Error in Im(test$y test$x1 + t
R语言解多元线性方程
R语言中输入test之后,数据如下:
>test
x1 x2 y
1 30.0 760.0 114.5
2 15.0 901.5 77.0
3 15.0 698.0 59.5
4 16.0 595.0 54.0
5 47.8 589.0 135.0
然后输入:
> Im.test=Im(test$y~test$x1+test$x2)
Error in Im(test$y test$x1 + test$x2) :
non-numeric argument to function
这报错了,应该怎么处理啊?

R语言解多元线性方程R语言中输入test之后,数据如下:>testx1 x2 y1 30.0 760.0 114.52 15.0 901.5 77.03 15.0 698.0 59.54 16.0 595.0 54.05 47.8 589.0 135.0然后输入:> Im.test=Im(test$y~test$x1+test$x2)Error in Im(test$y test$x1 + t
你先试试这样
lm.test=lm(y~x1+x2,test)
根据你的报错:non-numeric argument to function
就是说你的数据里面有非数字型的,可能是NA,可能是字符“n/a” 仔细排查一下吧