Ignore:
Timestamp:
Oct 26, 2006, 4:04:35 PM (15 years ago)
Author:
Peter
Message:

Refs #81 moved mse_ to inherited classes and made mse() pure virtual because mse is calculated different for different classes and therefore this design is more logic. Fixed docs and other things...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/regression/LinearWeighted.cc

    r682 r702  
    3939    // product wx*wy, so we can send in w and a dummie to get what we
    4040    // want.
    41     utility::vector dummie(w.size(),1);
    42     statistics::AveragerPairWeighted ap;
    43     ap.add_values(x,y,w,dummie);
    44 
    45     double m_x = ap.x_averager().mean();
    46     double m_y = ap.y_averager().mean();
    47    
    48     double sxy = ap.sum_xy_centered();
    49 
    50     double sxx = ap.x_averager().sum_xx_centered();
    51     double syy = ap.y_averager().sum_xx_centered();
     41    ap_.reset();
     42    ap_.add_values(x,y,utility::vector(x.size(),1),w);
    5243
    5344    // estimating the noise level. see attached document for motivation
    5445    // of the expression.
    55     s2_= (syy-sxy*sxy/sxx)/(w.sum()-2*(w*w)/w.sum()) ;
     46    s2_= (syy()-sxy()*sxy()/sxx())/(w.sum()-2*(w*w)/w.sum()) ;
    5647   
    57     alpha_ = m_y;
    58     beta_ = sxy/sxx;
    59     alpha_var_ = ap.y_averager().standard_error() *
    60       ap.y_averager().standard_error();
    61     beta_var_ = s2_/sxx
    62     m_x_=m_x;
     48    alpha_ = m_y();
     49    beta_ = sxy()/sxx();
     50    alpha_var_ = ap_.y_averager().standard_error() *
     51      ap_.y_averager().standard_error();
     52    beta_var_ = s2_/sxx()
     53    m_x_=m_x();
    6354  }
    6455
Note: See TracChangeset for help on using the changeset viewer.