Changeset 728 for trunk/yat


Ignore:
Timestamp:
Jan 4, 2007, 5:07:16 PM (16 years ago)
Author:
Peter
Message:

added virtual function s2 in OneDimensional?.

Location:
trunk/yat/regression
Files:
6 edited

Legend:

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

    r727 r728  
    113113
    114114    /**
     115       \f$ \frac{\sum \epsilon_i^2}{N-2} \f$
     116
     117       @return variance of residuals
     118    */
     119    double s2(void) const;
     120
     121    /**
    115122       The error of the model is estimated as \f$
    116123       \textrm{alpha\_err}^2+\textrm{beta\_err}^2*(x-m_x)*(x-m_x)\f$
     
    127134    Linear(const Linear&);
    128135
    129     double s2(void) const;
    130 
    131136    double alpha_;
    132137    double alpha_var_;
  • trunk/yat/regression/Naive.cc

    r727 r728  
    6666 
    6767
     68  double Naive::s2(void) const
     69  {
     70    return chisq()/(ap_.n()-1);
     71  }
     72
     73
    6874  double Naive::standard_error2(const double x) const
    6975  {
    70     return chisq()/ap_.n()/(ap_.n()-1);
     76    return s2()/ap_.n();
    7177  }
    7278
  • trunk/yat/regression/Naive.h

    r727 r728  
    7474    double predict(const double x) const;
    7575 
     76    /**
     77       \f$ \frac{\sum \epsilon_i^2}{N-1} \f$
     78
     79       @return variance of residuals
     80    */
     81    double s2(void) const;
     82
    7683    ///
    7784    /// @return standard error
  • trunk/yat/regression/OneDimensional.h

    r727 r728  
    114114
    115115    /**
     116       @return variance of residuals
     117    */
     118    virtual double s2(void) const=0;
     119
     120    /**
    116121       The standard error is defined as \f$ E(Y|x - \hat{y}(x))^2 \f$
    117122
  • trunk/yat/regression/Polynomial.cc

    r727 r728  
    7878
    7979
     80  double Polynomial::s2(void) const
     81  {
     82    return chisq()/(ap_.n()-power_-1);
     83  }
     84
     85
    8086  double Polynomial::standard_error2(const double x) const
    8187  {
  • trunk/yat/regression/Polynomial.h

    r727 r728  
    8585    double predict(const double x) const;
    8686
     87    /**
     88       \f$ \frac{\sum \epsilon_i^2}{N-\textrm{DF}} \f$
     89       where DF is number of parameters in model.
     90
     91       @return variance of residuals
     92    */
     93    double s2(void) const;
     94
    8795    ///
    8896    /// @return squared error of model value in @a x
Note: See TracChangeset for help on using the changeset viewer.