anchor.diff:  *)
   module GoodnessOfFit =    
       open FSharp.Stats
  -  
  +    open System
       /// Three sum of squares 
       type SumOfSquares = {
  -        /// Regression sum of squares (SSR - explained) 
  +        /// Regression sum of squares (SSR: explained); Sum((yFit-yMean)**2.)
           Regression : float
  -        /// Error sum of squares (SSE - unexplained)
  +        /// Error sum of squares (SSE: unexplained); residual sum of squares; Sum((y-yFit)**2.)
           Error      : float        
  -        /// Total sum of squares (SST - total)
  +        /// Total sum of squares (SST: total); Sum((y-yMean)**2.)
           Total      : float        
           SSxx       : float
           SSxy       : float
  
positive.code:     module OrdinaryLeastSquares =
  
          module Linear =
  
              module RTO = 
                  /// 
                  let calculateANOVA (coef : float) x y =                
  
negative.code:         n * log (sse/n) + k * log (n) 
      
      /// Calculates the residuals
      let getResiduals (fitFunc:float -> float) (x_data : Vector<float>) (y_data : Vector<float>) = 
          Seq.map2 (fun x y -> let y_estimated = fitFunc x
                               (y - y_estimated) ) x_data y_data
  
      /// Calculates SSE: sum of squares of errors
      /// also: unexplained sum of squares; residual sum of squares   
      let calculateSSE (fitFunc:float -> float) (x_data : Vector<float>) (y_data : Vector<float>) = 
          Seq.map2 (fun x y -> let y_estimated = fitFunc x
                               (y - y_estimated) * (y - y_estimated) ) x_data y_data
          |> Seq.sum
  
      /// Calculates SSR: sum of squares regression.
      /// also: explained sum of squares
      let calculateSSR (fitFunc:float -> float) (x_data : Vector<float>) (y_data : Vector<float>) = 
          let meanY = Seq.mean y_data
          y_data |> Seq.mapi (fun i y -> (fitFunc x_data.[i] - meanY)**2.) |> Seq.sum
  
      /// Calculates SST: sum of squares total.
      /// also: total sum of squares
      let calculateSST (y_data : Vector<float>) = 
          let meanY = Seq.mean y_data
          y_data 
          |> Seq.sumBy (fun y -> pown (y - meanY) 2)
  
      /// explained = total - unexplained
  
  