Kurt Sims wrote:
>> I'm looking for a nice simple program that will let me plot the points
> for a scattergram, give it a best fit line and then read an unknown. I
> would love to hear some suggestions.
>> All I need it to do is accept the standards for the X axis and Y axis
> and then give me the reading when I give it an unknown reading off of
> one of the axis.
>> The program can be either PC or Mac based, or even on the web.
Any decent statistical program should be able to do that. In R (or
S-plus) you can do like this:
> conc <- c(0.5,1,1.5,2)
> reading <- c(15.2,30.2,44.6,59)
> standard <- lm(conc~reading)
> summary(standard)
Call:
lm(formula = conc ~ reading)
Residuals:
1 2 3 4
0.006096 -0.008255 -0.002032 0.004191
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0273051 0.0099380 -2.748 0.111
reading 0.0342901 0.0002444 140.296 5.08e-05 ***
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Residual standard error: 0.007969 on 2 degrees of freedom
Multiple R-Squared: 0.9999, Adjusted R-squared: 0.9998
F-statistic: 1.968e+04 on 1 and 2 degrees of freedom, p-value:
5.08e-05
> predict(standard,data.frame(reading=38.3))
[1] 1.286005
That is, for reading=38.3 the `standard' predicts a concentration of
1.29.
With the following command, you get more information than you want
(i.e., the confidence intervals of your prediction: usually they are
wider than you want to believe):
> predict(standard,data.frame(reading=38.3),interval="prediction")
fit lwr upr
[1,] 1.286005 1.247655 1.324354
Yes, of course you can omit the intercept and and get the standard line
go through the origin. And of course, you can get all your readings in
one run, just put them in a vector in a data.frame.
cheers, j.oksanen
--
J.Oksanen -- UHLA (University of Helsinki at Lahti)
C-h i m emacs RET m text RET m formatted RET
"GNU Emacs is evil." Linus Torvalds