anchor.diff:          yVal |> Vector.map (fun x -> (x - yMean) / std) 
       
               
  -    ///W_method: 0=identical weighting | 1=Variance //identical y_replicates lead to 1./0.
  +    ///W_method: 0=identical weighting | 1=coefficientOfVariation | 2=variance
       let getWeighting (xVal:Vector<float>) (yVal:Vector<float>) (w_method:int) (numRep:int) =
           if w_method = 0 || numRep = 1 then 
               Matrix.diag(Vector.ones xVal.Length)
  -        else
  -            let Wtemp = Matrix.create xVal.Length xVal.Length 0.
  -            let diagVec = vector [for i = 0 to xVal.Length - 1 do yield 1. / (yVal.[(i*numRep)..(i*numRep + numRep - 1)] |> Seq.stDev)]
  +        elif w_method = 2 then
  +            let Wtemp = Matrix.create xVal.Length xVal.Length 0.            
  +            let diagVec = 
  +                if yVal.Length%numRep = 0 then
  +                    vector [for i = 0 to xVal.Length - 1 do yield 1. / (yVal.[(i*numRep)..(i*numRep + numRep - 1)] |> Seq.stDev)]
  +                else failwithf "arrLength no multiple of replicate number"
               let (maxWtemp,minWtemp) = 
                   let mean = diagVec |> Seq.mean
                   let std  = diagVec |> Seq.stDev
                   (mean + std),(mean - std)
  -    
  +            
               let diagVecNew = 
                   diagVec |> Vector.map (fun x -> match x with
                                                   | x when x > maxWtemp -> maxWtemp
  
positive.code:                 let (gcv,var) = getGCV (aMat |> Matrix.ofArray2D) (Matrix.ofArray2D D) (Matrix.ofArray2D H) W y.Length y a' lambd
                  a',e',gcv,c' 
                          )
              |> unzip4List
              |> fun (a,e,gcv,c) -> 
                  let gcvminIndex = gcv |> Array.findIndex (fun x -> x = (gcv |> Array.min))
                  let gcvmin = gcv.[gcvminIndex]
  
negative.code:                 let length = (float Wtemp.NumCols)
                  diagVecNew |> Vector.map (fun x -> x / trace * length)
              for i = 0 to xVal.Length - 1 do Wtemp.[i,i] <- finalDiag.[i]
              Wtemp
          else
              let Wtemp = Matrix.create xVal.Length xVal.Length 0.
              let cvOfVec =
                  if yVal.Length%numRep = 0 then
                      let length = yVal.Length / numRep 
                      let cv = vector [for i = 0 to length-1 do yield yVal.[i*numRep..i*numRep+numRep-1] |> fun g -> max 0. (System.Math.Log((1./(Math.Abs(Seq.cvPopulation g))),2.))(*(1./((Seq.cvPopulation g) + 0.25))*)] //0.25???
                      cv
                  else failwithf "arrLength no multiple of replicate number"
              printfn "%A" cvOfVec
  
              
              for i = 0 to xVal.Length - 1 do Wtemp.[i,i] <- cvOfVec.[i]
              Wtemp
                  
      let getInitialEstimate (D:Matrix<float>) (H:Matrix<float>) (W:Matrix<float>) (n) (y)= 
  