On 20/02/2011 18:52, David Winsemius wrote:

On Feb 20, 2011, at 1:27 PM, Ben Ward wrote:

However, the

Y ~ X + Y^2

Produces the best fitting line - it is pretty much on the data points - I'm trying to make a standard curve, with which to take readings from a spectrophotometer off of. Rather than what I would normally use models for - such as hypothesis testing and analysis of data from experiments.

I thought we were leaving behind the model that had the dependent variable on both sides of hte equation. Can you explain how you would construct a chart or a function that will turn those results into something useful?

Sorry for any confusion, I am indeed leaving behind the Y ~ X + Y^2 model, I was only mentioning that it had a higher R squared than anything else I had done.

I'll explain exactly what the chart/function is made from and is for, to remove any mystery or highlight anything important: The curve I'm trying to produce, is from readings from a spectrophotometer, from series of standards called the MacFarland Scale - tubes of solution which were made up to simulate different known numbers of bacteria in a liquid sample: the standards are of different intensities of coloudy-ness, and they represent different numbers of bacteria in a liquid medium. The (X) axis is % light transmission as measured by the spectrophotometer, the cloudier the standard, the lower this value, and the Bacterial Counts on the (Y) axis, are higher, the cloudier a sample (or the standards) are, thus it is higher with lower % Light Transmission. This is a negative curve, which never goes below 0, because you cant have less than no bacteria. This curve/function, which has been made from the standards of known numbers, will then be used to estimate the numbers of bacteria present in proper samples, rather than known standards. I would take the % Light Transmission Readings the spectrophotometer gives me for those standards, and then using the curve - or working through the function, calculate the (Approximate) number of bacteria present in my samples. I took 5, % Light Transmission readings for each standard to make sure the machine wasn't giving me wildly different readings (it' wasnt), and used them to try and construct a curve.

Hence my comment about Y ~ X + Y^2 giving me a better fit (R-Squared). I need a good fit to make reliable predictions. However, since then, I've added an extra standard from the scale (There are about 10/11 standards to the scale, but I've got 9, because the last few can't be made up accurately without introducing error or the lab tech's running into difficulty doing it by hand), and the Y ~ X + Y^2 curve is no longer sufficient after this.

I followed a suggestion (I think by you) to try a GLM, with the poisson distribution, as I mentioned in my last email that went around, which wasn't closely fitting as I would like, it's my first experience with GLM, but to my understanding, the Residual Deviance, was orders higher than the residual degrees of freedom. So under instruction of a textbook, I tried with a quasi-poisson, but still got the same result. Then (again textbook suggestion) tried with a negative binomial distribution, and got a much lower AIC value and a residual deviance much much closer to the residual degrees of freedom (the R print outs of them are on the previous email I sent around).

I hope this has explained when you asked "Can I explain how I would construct a chart or a function that will turn those results into something useful?"

Thanks,
Ben.W

Thanks,
Ben.

On 20/02/2011 11:53, nzcoops wrote:
model<- lm(Approximate.Counts~X..Light.Transmission +
I(Approximate.Counts^2), data=Standards)

Might not be addressing the problem, don't you have Y ~ X + Y^2 here? That's
a violation of the assumptions of an lm isn't it?

Also for plotting CI on a curve look into ggplot2::geom_ribbon, it's much nicer than just plotting lines and is easy to use. had.co.nz should set you
right for setting this up.



David Winsemius, MD
West Hartford, CT




______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to