简体   繁体   English

此R错误消息是什么意思

[英]What does this R error message mean

I am trying to predict a value for certain variable on my model, together with 95% confidence interval and I keep getting the same error that one of my variables is not found. 我试图预测模型上某些变量的值以及95%的置信区间,并且不断收到与未找到我的变量之一相同的错误。

Here is the code bit and error message I am getting: 这是我得到的代码位和错误消息:

pred.frame <- data.frame(lpsa=seq(min(prostate$lpsa), max(prostate$lpsa),
+ length=100))

pp <- predict(pros8.lm, int="p", newdata=pred.frame)
Error in eval(expr, envir, enclos) : object 'lcavol' not found

I've created a data frame with all of my variable included, together with specific values I want to test, but from some reason it does not identify one of them. 我创建了一个数据框,其中包含所有变量以及要测试的特定值,但是由于某种原因,它无法识别其中的一个。

Here is the created data frame: 这是创建的数据框:

newpatient <- data.frame(lcavol = 1.44692, lweight = 3.62301, age = 65.0,
lbph = 0.3001, svi = 0.0000, lcp = -0.79851,
gleason = 7.0, pgg45 = 15.0)

Can someone identify/point out why this does not work? 有人可以识别/指出为什么这行不通吗?

In predict you're specifying the newdata to use is pred.frame . predict您要指定要使用的新数据是pred.frame But in pred.frame , there is no column lcavol (that your model pros8.lm needs to make a prediction. 但是在pred.frame ,没有列lcavol (模型pros8.lm需要进行预测。

You might want this: 您可能想要这样:

    predict(pros8.lm, int="p", newdata=newpatient) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM