2

How to predict a new given value of body using the ml2 model below, and interpret its output (new predicted output only, not model)

Using Animals dataset from MASS package to build a simple linear regression model

ml2<-lm(log(brain)~log(body),data=Animals)

predict a new given body of 468

pred_body<-data.frame(body=c(468))

predict(ml2,new, interval="confidence")

       fit      lwr      upr
1 5.604506 4.897498 6.311513

But i am not so sure predicted y(brain) =5.6 or log(brain)=5.6?

How could we get the predicted value with the same scale as it original?

Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248
Tuyen
  • 977
  • 1
  • 8
  • 23
  • Sorry @李哲源ZheyuanLi . I am new to StackOverflow, but now I know how to accept and vote the answers. Thank you for your time – Tuyen Jun 14 '17 at 05:03

1 Answers1

2

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"))
Zheyuan Li
  • 71,365
  • 17
  • 180
  • 248