如何使用简单的线性回归log(y)= b0 + b1 * log(x)预测新值 [英] How to predict a new value using simple linear regression log(y)=b0+b1*log(x)
问题描述
如何使用下面的ml2模型预测身体的新给定值并解释其输出(仅是新的预测输出,而不是模型)
How to predict a new given value of body using the ml2 model below, and interpret its output (new predicted output only, not model)
使用MASS软件包中的Animals数据集构建简单的线性回归模型
Using Animals dataset from MASS package to build a simple linear regression model
ml2<-lm(log(brain)~log(body),data=Animals)
预测新的给定主体为468
pred_body<-data.frame(body=c(468))
predict(ml2,new, interval="confidence")
fit lwr upr
1 5.604506 4.897498 6.311513
但是我不确定y(脑)= 5.6或log(脑)= 5.6吗?
我们如何获得与原始比例相同的预测值?
推荐答案
对于公式log(brain) ~ log(body)
,响应变量为log(brain)
.因此,当您使用predict()
进行预测时,您将获得log(brain)
的拟合值和预测间隔.
With a formula log(brain) ~ log(body)
, the response variable is log(brain)
. So when you make prediction using predict()
, you get fitted values and prediction interval for log(brain)
.
要获得原始比例的相应结果,请
To get corresponding results on original scale, do
exp(predict(ml2,new, interval="confidence"))
这篇关于如何使用简单的线性回归log(y)= b0 + b1 * log(x)预测新值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!