Changeset 702 for trunk/yat/regression/LinearWeighted.cc
 Timestamp:
 Oct 26, 2006, 4:04:35 PM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/regression/LinearWeighted.cc
r682 r702 39 39 // product wx*wy, so we can send in w and a dummie to get what we 40 40 // 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); 52 43 53 44 // estimating the noise level. see attached document for motivation 54 45 // 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()) ; 56 47 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(); 63 54 } 64 55
Note: See TracChangeset
for help on using the changeset viewer.