From: Ted Harding <Ted.Harding_at_nessie.mcc.ac.uk>

Date: Wed 20 Apr 2005 - 00:20:26 EST

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 20 00:44:00 2005

Date: Wed 20 Apr 2005 - 00:20:26 EST

On 19-Apr-05 Mike White wrote:

*> Hi
*

> I have measured the UV absorbance (abs) of 10 solutions

*> of a substance at known concentrations (conc) and have
**> used a linear model to plot a calibration graph with
**> confidence limits. I now want to predict the concentration
**> of solutions with UV absorbance results given in the
**> new.abs data.frame, however predict.lm only appears to work
**> for new "conc" variables not new "abs" variables.
**>
**> I have search the help files and did find a similar problem
**> in June 2000, but unfortunately no solution was offered.
**> Any help and how to use predict.lm with the new "abs" data
**> to predict "conc" with confidence limits would be appreciated.
**>
**> conc<-seq(100, 280, 20) # mg/l
**> abs<-c(1.064, 1.177, 1.303, 1.414, 1.534, 1.642, 1.744,
**> 1.852, 1.936,2.046) # absorbance units
**> lm.calibration<-lm(abs ~ conc)
**> pred.w.plim <- predict(lm.calibration, interval="prediction")
**> pred.w.clim <- predict(lm.calibration, interval="confidence")
**> matplot(conc, cbind(pred.w.clim, pred.w.plim[,-1]),
**> lty=c(1,2,2,3,3), type="l", ylab="abs", xlab= "conc mg/l")
**> points(conc, abs, pch=21, col="blue")
**>
**> new.abs<-data.frame(abs=c(1.251, 1.324, 1.452))
**>
**> predict(calibration.lm, new.abs) # does not work
*

abs = a + b*conc

You can verify this by comparing the outputs of

predict(lm.calibration, new.abs)

and

predict(lm.calibration)

You will see that they are identical!

*> lm.calibration2<-lm(conc ~ abs)
*

> new.abs<-data.frame(abs=c(1.251, 1.324, 1.452))

*> predict(lm.calibration2,new.abs)
*

1 2 3

131.3813 144.7453 168.1782

Strictly speaking, this approach is somewhat invalid, since under the model

abs = a + b*conc + error

the "inverse regression"

conc = (abs - a)/b = A + B*abs

I don't have time at the moment to go into this approach, but will try to write something later.

Till later,

Ted.

it might be

worth spelling it out for

people who would like to implement it themselves. Later.

E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861

Date: 19-Apr-05 Time: 15:20:26 ------------------------------ XFMail ------------------------------ ______________________________________________R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 20 00:44:00 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:16 EST
*