Changeset 698 for trunk/yat/regression


Ignore:
Timestamp:
Oct 26, 2006, 2:39:54 AM (15 years ago)
Author:
Peter
Message:

changed variable msd to mse. refs #81

Location:
trunk/yat/regression
Files:
3 edited

Legend:

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

    r697 r698  
    4242
    4343    // calculating deviation between data and model
    44     msd_ = (ap_.y_averager().sum_xx_centered() - ap_.sum_xy_centered() *
     44    mse_ = (ap_.y_averager().sum_xx_centered() - ap_.sum_xy_centered() *
    4545            ap_.sum_xy_centered()/ap_.x_averager().sum_xx_centered() )/x.size();
    46     r2_= 1-msd_/ap_.x_averager().variance();
    47     alpha_var_ = msd_ / x.size();
    48     beta_var_ = msd_ / ap_.x_averager().sum_xx_centered();
     46    r2_= 1-mse_/ap_.x_averager().variance();
     47    alpha_var_ = mse_ / x.size();
     48    beta_var_ = mse_ / ap_.x_averager().sum_xx_centered();
    4949    m_x_ = ap_.x_averager().mean();
    5050  }
  • trunk/yat/regression/Naive.cc

    r697 r698  
    5050  double Naive::standard_error(const double x) const
    5151  {
    52     return sqrt(msd_/ap_.n());
     52    return sqrt(mse_/ap_.n());
    5353  }
    5454
  • trunk/yat/regression/OneDimensional.h

    r697 r698  
    6363   
    6464    /**
     65       @brief Mean Squared Error
     66
    6567       msd is defined as the mean of the squared residiuals \f$
    6668       \frac{1}{N}\sum{(y_i-\hat{y}_i)^2} \f$, which is minimized when
     
    6971       @return data values mean squared deviation from the model
    7072    */
    71     inline double msd(void) const { return msd_; }
     73    inline double mse(void) const { return mse_; }
    7274
    7375    ///
     
    9092    */
    9193    double prediction_error(const double x) const
    92     { return sqrt(msd()+pow(standard_error(x),2)); }
     94    { return sqrt(mse()+pow(standard_error(x),2)); }
    9395
    9496    ///
     
    112114       fraction of the variance explained by the regression model.
    113115    */
    114     inline double r_squared(void) const { return msd()/variance_; }
     116    inline double r_squared(void) const { return mse()/variance_; }
    115117
    116118    /**
     
    129131
    130132    ///
    131     /// mean squared deviation (model from data points)
     133    /// mean squared error (see mse())
    132134    ///
    133     double msd_;
     135    double mse_;
    134136
    135137    ///
Note: See TracChangeset for help on using the changeset viewer.