functions required to implement the weighted regression approach for estuaries