anchor.diff:  
     end subroutine stats_residuals
   
  -  ! Calculate mean
     real(dp) function stats_mean(data_arr, mask) result(val)
  +    ! Calculate mean
  +    !
  +    ! data_arr :: array of data values
  +    ! mask :: logical masking array
       real(dp), intent(in) :: data_arr(:)
       logical, intent(in), optional :: mask(:)
   
  
positive.code: 
    end function stats_mean_sq_err
  
    ! Calculate variance
    real(dp) function stats_variance(data_arr, mask) result(val)
      real(dp), intent(in) :: data_arr(:)
      logical, intent(in), optional :: mask(:)
  
  
negative.code:     end if
  
    end function stats_stdev
  
  end module stats
  