Hello all, I'm fitting an allometric equation that looks like a really clean fit in the log-log space, but when I back transform the fit of the curve appears to need an adjustment - the fitted curve appears to predict values a good deal higher than those from the data. I included a bias correction per
Newman, M. (1993). Regression analysis of logâtransformed data: Statistical bias and its correction. Environmental Toxicology and Chemistry. Retrieved from http://onlinelibrary.wiley.com/doi/10.1002/etc.5620120618/abstract(page 1130) but that doesn't seem to help much - if anything the fit looks worse. Data and code below: temppow<-lm(log(y)~log(x)) plot(log(y)~log(x)) plot(residuals(temppow), main="pow") abline(temppow) plot(y~x, main="pow") tempsum<-summary(temppow)$adj.r.squared tempint<-summary(temppow)$coefficients[1,1] #intercept of power function tempslope<-summary(temppow)$coefficients[2,1] #slope of power function tempmin<-min(x) tempmax<-max(x) lngth<-c(tempmin:tempmax) # vector from the minimum to the maximum values of independent variable prediction<-exp(tempint)*((lngth)^tempslope)*exp((summary(temppow)$sigma^2)/2) # exp((summary(temppow)$sigma^2)/2) is the bias correction #prediction<-exp(tempint+tempslope*log(lngth))*exp((summary(temppow)$sigma^2)/2) lines(prediction) y,x 237537.61,873 5007.148438,227 17705.77306,400 12396.64369,427 228703.4021,1173 350181.9752,1538 59967.79376,630 140322.7774,710 42650.07251,630 5382.858702,264 34405.82429,637 92261.34614,980 144927.1713,1094 362998.7355,1420 203313.6442,1070 168861.649,930 214306.5266,1040 201804.5193,1000 108426.1988,820 181651.8748,980 53675.45849,775 43068.82972,563 92393.35158,805 93305.0618,740 107308.4761,840 139056.5446,775 15411.81924,420 16104.80991,390 25629.07578,502 37121.23438,461 29711.42749,565 33400.49145,510 Any insight you could give on whether the error is somehow hidden in the code or how the bias correction I'm using could be improved is very much appreciated. Also if you have other suggestions, please make them. My deadline on this is coming up soon. Best *Ben Caldwell * University of California, Berkeley [[alternative HTML version deleted]]
______________________________________________ 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.