Hello,
I'm trying to assess the performance of the ocean colour band ratio algorithms for a couple different regions and sensors, and finding new optimal coefficients for different polynomial degrees using R. I started out simply using the lm() function to find the least squares polynomial through the logged in situ chlorophyll-a and band ratio, then getting the slope and intercept of the linear regression between logged in situ chl-a and the resulting model chl-a. Now I'd like to constrain the linear regression's slope to 1 +- 0.001 and intercept to 0 +- 0.001 so that the results can be compared by RMSE and the coefficient of determination. In O'Reilly et al (1998) this process is described as iterative minimization routines using IDL, but I'm having trouble figuring out how to do it in R. Can anyone explain how to place the constraints on the slope and intercept of the linear regression and then work backward to find optimal polynomial coefficients that fit those constraints?
Thanks,
Stephanie
O'Reilly band ratio - Finding best coefficients with iterative minimization routines?
O'Reilly band ratio - Finding best coefficients with iterative minimization routines?
You may want to consult the R documentation and forums, but terminology can be tricky. I think your problems is often called a box-constrained (linear) regression. There are many examples in the R documentation and forums, for example: Linear Regression with Individual Constraints. Many non-linear regression functions support box constraints. With non-linear tools you can also do things like estimating the logarithm of a parameter:
lp=log(p)
, estimate lp
, then p=exp(lp)
is positive. Note that many older examples use the nls()
function which often behaves badly and is likely to be replaced in the base stats package by the more robust nlsr()
.